Bug #78799 [NEW]: Calling iterator_count() is killing the validity of RecursiveDirectoryIterator

From: Date: Sat, 09 Nov 2019 01:46:22 +0000
Subject: Bug #78799 [NEW]: Calling iterator_count() is killing the validity of RecursiveDirectoryIterator
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223655@lists.php.net to get a copy of this message
From: krmgns at gmail dot com Operating system: Ubuntu PHP version: 7.4.0RC5 Package: SPL related Bug Type: Bug Bug description:Calling iterator_count() is killing the validity of RecursiveDirectoryIterator Description: ------------ Hi, Calling iterator_count() is affecting RecursiveDirectoryIterator::valid() and RecursiveDirectoryIterator::valid() is returning false after iterator_count() call. I am not sure that is a bug or just a behavior of PHP, but simply looks weird invalidating it without any iteration act such as while or foreach. Test script: --------------- $iter = new RecursiveDirectoryIterator("/tmp/", RecursiveDirectoryIterator::SKIP_DOTS); var_dump($iter->valid()); var_dump(iterator_count($iter)); var_dump($iter->valid()); Expected result: ---------------- bool(true) int(24) bool(true) Actual result: -------------- bool(true) int(24) bool(false) -- Edit bug report at https://bugs.php.net/bug.php?id=78799&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78799&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78799&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78799&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78799&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78799&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78799&r=support Expected behavior: https://bugs.php.net/fix.php?id=78799&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78799&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78799&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78799&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78799&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78799&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78799&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78799&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78799&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78799&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78799&r=mysqlcfg

« previous php.bugs (#223655) next »