#51068 [Asn]: DirectoryIterator glob:// don't support current path relative queries
| From: | aharvey@php.net | Date: | Wed, 17 Feb 2010 17:10:38 +0000 |
| Subject: | #51068 [Asn]: DirectoryIterator glob:// don't support current path relative queries | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-147792@lists.php.net to get a copy of this message | ||
ID: 51068
Updated by: aharvey@php.net
Reported By: pedro dot laguna at pentura dot com
Status: Assigned
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 5.3.1
Assigned To: colder
New Comment:
I kept looking into this after my initial post; I wasn't quite
expecting this to be assigned quite so fast!
A quick and dirty patch against PHP_5_3 that appears to fix this is at
http://www.adamharvey.name/patches/bug-51068-spl_directory.patch
-- I
can cook up a .phpt to go with it pretty rapidly if desired. This also
doesn't look terribly difficult to port to trunk.
Previous Comments:
------------------------------------------------------------------------
[2010-02-17 16:58:57] colder@php.net
I'll look into it.
Looks like glob://* makes DirectoryIterator generate paths like /file,
which is wrong.
------------------------------------------------------------------------
[2010-02-17 16:57:44] pedro dot laguna at pentura dot com
pedro@pedro:~$ php --version
PHP 5.3.1-0.dotdeb.1 with Suhosin-Patch (cli) (built: Dec 5 2009
20:08:29)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
pedro@pedro:~$ apache2 -v
Server version: Apache/2.2.12 (Ubuntu)
Server built: Nov 12 2009 22:49:46
------------------------------------------------------------------------
[2010-02-17 16:47:59] pajoye@php.net
Which SAPI do you use? (or with which web server)
------------------------------------------------------------------------
[2010-02-17 16:28:28] pedro dot laguna at pentura dot com
Without the size object reference it works as expected.
------------------------------------------------------------------------
[2010-02-17 16:15:39] aharvey@php.net
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());
}
?>
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/51068
--
Edit this bug report at http://bugs.php.net/?id=51068&edit=1