php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57850 Phar object cannot be iterated over
Submitted: 2007-09-27 00:27 UTC Modified: 2007-10-03 23:33 UTC
From: cellog@php.net Assigned: cellog (profile)
Status: Closed Package: phar (PECL)
PHP Version: 5.2.1 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cellog@php.net
New email:
PHP Version: OS:

 

 [2007-09-27 00:27 UTC] cellog@php.net
Description:
------------
when attempting to iterate over a phar, if RecursiveDirectoryIterator::KEY_AS_FILENAME is not passed in, we get an exception with an exceptionally odd error message

Reproduce code:
---------------
<?php
$p = new Phar('/tmp/blah.phar');
foreach ($p as $path => $info) {
    echo $path;
}

Actual result:
--------------
<br />
<b>Fatal error</b>:  Uncaught exception 'UnexpectedValueException' with message 'Cannot access phar file entry '/data' in archive '&#65533;&#65533;'' in PHPDocument1:3
Stack trace:
#0 [internal function]: PharFileInfo-&gt;__construct('phar:///tmp/bla...')
#1 PHPDocument1(3): RecursiveDirectoryIterator-&gt;current()
#2 /var/www/dummy.php(1): include('PHPDocument1')
#3 {main}
  thrown in <b>PHPDocument1</b> on line <b>3</b><br />


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-27 00:44 UTC] greg at chiaraquartet dot net
see http://pear.php.net/~greg/blah.phar for reproduce case
 [2007-10-03 23:07 UTC] greg at chiaraquartet dot net
actually, this is correct behavior.  The error message is not.

PharFileInfo should accept a directory as an argument.
 [2007-10-03 23:33 UTC] greg at chiaraquartet dot net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 01:01:28 2024 UTC