ID: 28217 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Feedback +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: n/a PHP Version: 5CVS-2004-04-29 (dev) New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php No it should definitively not cast to a string because it would mean that in a foreach iteration you would no longer have access to the memebrs. The problem is that we needed to disable autocasting using __tostring for php 5.0. The class in question was designed to have that feature and that won't be changed. >From a design perspective the idea is to have the object work as an inner iterator. That means the objects is always it own current eleemnt because when used as an iterator it changes it's own state upon calling rewind() or next(). Previous Comments: ------------------------------------------------------------------------ [2004-04-29 23:08:14] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2004-04-29 16:57:11] [EMAIL PROTECTED] Description: ------------ Just the check the following line in the reproduce code: if($it->isDir() && !$it->isDot() && $it->current() != 'CVS') { if you don't cast $it->current to a string it will output an error, so I need to write: if($it->isDir() && !$it->isDot() && (string) $it->current() != 'CVS') { This should really cast it to a string automatically. Reproduce code: --------------- <?php function recurse($it) { for( ; $it->valid(); $it->next()) { if($it->isDir() && !$it->isDot() && $it->current() != 'CVS') { echo $it->current() . "\n"; if($it->hasChildren()) { recurse($it->getChildren()); } } elseif($it->isFile() && $it->current() != '.cvsignore') { if(!php_check_syntax($it->current())) { echo $it->current(); } } } } recurse(new RecursiveDirectoryIterator('phpdoc/en')); ?> Actual result: -------------- Notice: Object of class RecursiveDirectoryIterator could not be converted to int eger in c:\cvs\recurse.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28217&edit=1
