Bug #52233 [Com]: DirectoryIterator glob:// fails with getSize() with using relative paths
| From: | kassner@php.net | Date: | Sat, 03 Jan 2015 15:52:28 +0000 |
| Subject: | Bug #52233 [Com]: DirectoryIterator glob:// fails with getSize() with using relative paths | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-189626@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52233&edit=1
ID: 52233
Comment by: kassner@php.net
Reported by: pedro dot laguna at pentura dot com
Summary: DirectoryIterator glob:// fails with getSize() with
using relative paths
Status: Open
Type: Bug
Package: SPL related
Operating System: Linux
PHP Version: 5.3.2
Block user comment: N
Private report: N
New Comment:
Reproducible on PHP 5.5.20.
[root@brian ~]# php bug.php
bin: 20.0K<br />PHP Fatal error: Uncaught exception 'RuntimeException' with message
'SplFileInfo::getSize(): stat failed for /bug.php' in /root/bug.php:4
Stack trace:
#0 /root/bug.php(4): SplFileInfo->getSize()
#1 {main}
thrown in /root/bug.php on line 4
[root@brian ~]# php -v
PHP 5.5.20 (cli) (built: Dec 17 2014 14:58:05)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
Previous Comments:
------------------------------------------------------------------------
[2010-07-02 10:38:59] pedro dot laguna at pentura dot com
Description:
------------
glob:// wrapper doesn't support current queries like glob://*
Test script:
---------------
<?php
$it = new DirectoryIterator("glob://*");
foreach($it as $f) {
printf("%s: %.1FK<br />", $f->getFilename(), $f->getSize()/1024);
}
?>
Expected result:
----------------
A list of files with their file size associated as show in the glob example page:
http://php.net/manual/en/wrappers.glob.php
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:
--------------
Fatal error: Uncaught exception 'RuntimeException' with message
'SplFileInfo::getSize(): stat failed for /CREDITS' in /home/pedro/Desktop/php-
5.3.2/sapi/cli/test.php:4
Stack trace:
#0 /home/pedro/Desktop/php-5.3.2/sapi/cli/test.php(4): SplFileInfo->getSize()
#1 {main}
thrown in /home/pedro/Desktop/php-5.3.2/sapi/cli/test.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=52233&edit=1