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 revisionPrevious revision
Next revisionBoth sides next revision
tips:findbadphp.php [2011-12-20 20:42] – old revision restored rikbloktips:findbadphp.php [2013-08-31 01:25] – Fixed needle and haystack being the wrong way round, and improved trailing characters search to accept trailing new lines which PHP ignores. 81.83.194.5
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: 2022-01-26 05:56 by schplurtz

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki