DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:findbadphp.php

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tips:findbadphp.php [2011-12-20 20:42]
rikblok old revision restored
tips:findbadphp.php [2013-08-31 01:25] (current)
81.83.194.5 Fixed needle and haystack being the wrong way round, and improved trailing characters search to accept trailing new lines which PHP ignores.
Line 48: Line 48:
             $check = file_get_contents("$dir/$file",0,null,             $check = file_get_contents("$dir/$file",0,null,
                                 filesize("$dir/$file")-5,5);                                 filesize("$dir/$file")-5,5);
-            $pos = strpos('?>',$check); +            $pos = strpos($check, '?>'); 
-            if($pos !== false && substr($check,-2) != '?>' ){+            if($pos !== false && !(substr($check,-2) == '?>' || substr($check,-3) == "?>\n"){
                 echo "$dir/$file has trailing chars after closing ?>\n";                 echo "$dir/$file has trailing chars after closing ?>\n";
                 continue;                 continue;
tips/findbadphp.php.txt · Last modified: 2013-08-31 01:25 by 81.83.194.5