|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-06-28 02:12 UTC] requinix@php.net
-Summary: DirectoryIterator entries invalidated after its
destruction
+Summary: DirectoryIterator::current returns itself, also other
classes
[2019-06-28 02:12 UTC] requinix@php.net
[2021-05-12 13:16 UTC] cmb@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2021-05-12 13:16 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Description: ------------ It's reproducible on all php >= 7 versions (including 7.4-rc) I probably am missing something, but I cannot find it documented anywhere, hence the behaviour surprises me. Test script: --------------- <?php $files = iterator_to_array(new DirectoryIterator(__DIR__)); var_dump($files[0]->getRealPath()); foreach (new DirectoryIterator(__DIR__) as $f) { var_dump($f->getRealPath()); break; } Expected result: ---------------- string(4) "/app" string(4) "/app" Actual result: -------------- bool(false) string(4) "/app"