ID: 51068 Updated by: ahar...@php.net Reported By: pedro dot laguna at pentura dot com -Status: Bogus +Status: Feedback Bug Type: SPL related Operating System: Linux PHP Version: 5.3.1 New Comment:
Hold up a sec, Jani. That's pretty much the example in the manual for the glob:// wrapper, just without a relative path, and it should work. I suspect this is going to end up with Marcus, since he implemented glob:// in the first place, but in the meantime, OP, can you try the following script and confirm that it doesn't throw an exception (and prints the file names in the current directory)? Thanks. <?php $it = new DirectoryIterator("glob://*"); foreach($it as $f) { printf("%s<br />", $f->getFilename()); } ?> Previous Comments: ------------------------------------------------------------------------ [2010-02-17 16:11:43] pedro dot laguna at pentura dot com I know that I have many ways to do it, but I'm exposing that the current glob:// wrapper is not working properly. If it supports relative paths should support the current path when you don't specify a full or relative path. ------------------------------------------------------------------------ [2010-02-17 15:57:25] j...@php.net Use something that is actually supported: http://php.net/globiterator ------------------------------------------------------------------------ [2010-02-17 14:39:58] pedro dot laguna at pentura dot com Description: ------------ glob:// wrapper doesn't support current queries like glob://* Reproduce code: --------------- <?php $it = new DirectoryIterator("glob://*"); foreach($it as $f) { printf("%s: %.1FK<br />", $f->getFilename(), $f->getSize()/1024); } ?> Expected result: ---------------- tree.php: 1.0K findregex.php: 0.6K findfile.php: 0.7K dba_dump.php: 0.9K nocvsdir.php: 1.1K phar_from_dir.php: 1.0K ini_groups.php: 0.9K directorytree.php: 0.9K dba_array.php: 1.1K class_tree.php: 1.8K Actual result: -------------- PHP Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileInfo::getSize(): stat failed for /tree.php' in /home/pedro/public_html/glob.php:7 Stack trace: #0 /home/pedro/public_html/glob.php(7): SplFileInfo->getSize() #1 {main} thrown in /home/pedro/public_html/glob.php on line 7 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=51068&edit=1