Edit report at http://bugs.php.net/bug.php?id=52966&edit=1
ID: 52966 Updated by: cataphr...@php.net Reported by: grzegorz at securelink dot pl Summary: No error with endless dir() Status: Open Type: Bug Package: Directory function related Operating System: Linux PHP Version: 5.3.3 Block user comment: N New Comment: PHP cannot guess what you want to do and warn you if the code you write doesn't do it. It's your responsibility to write correct programs. Previous Comments: ------------------------------------------------------------------------ [2010-10-01 20:27:03] grzegorz at securelink dot pl Description: ------------ Hi! I writted buggy code and php engine crashed. Test script: --------------- function list_dir($dir) { $d = dir($dir); while (false !== ($entry = $d->read())) { if(is_dir($entry)) { if($entry != "." && $entry != "..") { continue; } list_dir("$dir/$entry"); } else { echo "$dir/$entry\n"; } } } list_dir("/"); Expected result: ---------------- Hmm ... I want some error or warning. Actual result: -------------- PHP Warning: dir(/var/www/priv/./././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././ in /var/www/priv/dir_tree.php on line 3 Warning: dir(/var/www/priv/./././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././././././././././ ././././././././././././././././././././././././././././././././ in /var/www/priv/dir_tree.php on line 3 PHP Fatal error: Call to a member function read() on a non-object in /var/www/priv/dir_tree.php on line 4 Fatal error: Call to a member function read() on a non-object in /var/www/priv/dir_tree.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52966&edit=1