These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use rdx\imap\IMAPMailbox; |
||
4 | |||
5 | require 'env.php'; |
||
6 | require 'autoload.php'; |
||
7 | |||
8 | header('Content-type: text/plain'); |
||
9 | |||
10 | $mbox = new IMAPMailbox(IMAP_11NK5_HOST, IMAP_11NK5_USER, IMAP_11NK5_PASS, 'INBOX', ['ssl', 'novalidate-cert']); |
||
11 | |||
12 | $messages = $mbox->messages(false); |
||
0 ignored issues
–
show
|
|||
13 | echo count($messages) . " new messages...\n\n"; |
||
14 | |||
15 | |||
16 | exit; |
||
17 | |||
18 | |||
19 | foreach ( $messages AS $message ) { |
||
20 | |||
21 | $title = $message->subject(); |
||
22 | var_dump($title); |
||
23 | |||
24 | $message->parts(); |
||
25 | $body = $message->plainBody; |
||
26 | if ( $body ) { |
||
27 | $text = $body->content(); |
||
28 | |||
29 | if ( preg_match('#^https?://[a-z0-9]#i', $text) ) { |
||
30 | $tags = preg_split('/\s+/', $text); |
||
31 | |||
32 | $url = array_shift($tags); |
||
33 | |||
34 | $tags = implode(' ', $tags); |
||
35 | |||
36 | if ( $tags ) { |
||
37 | var_dump($url); |
||
38 | var_dump($tags); |
||
39 | |||
40 | if ( $message->unseen ) { |
||
41 | $q = compact('title', 'url', 'tags'); |
||
42 | $qs = http_build_query($q); |
||
43 | |||
44 | $rsp = @file_get_contents('http://hotblocks.nl/tags/index.php?'.$qs); |
||
45 | echo "SUBMIT URL: "; |
||
46 | if ( $rsp ) { |
||
47 | var_dump(strlen($rsp)); |
||
48 | } |
||
49 | else { |
||
50 | echo "FAIL\n"; |
||
51 | $message->unflag('seen'); |
||
52 | } |
||
53 | } |
||
54 | /*else { |
||
1 ignored issue
–
show
Unused Code
Comprehensibility
introduced
by
57% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
55 | // 25% chance |
||
56 | if ( !rand(0, 3) ) { |
||
57 | echo "UNFLAG SEEN: "; |
||
58 | var_dump($message->unflag('seen')); |
||
59 | } |
||
60 | }*/ |
||
61 | } |
||
62 | } |
||
63 | } |
||
64 | |||
65 | echo "\n\n\n\n\n\n"; |
||
66 | |||
67 | } |
||
68 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: