php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72394 PharData fails to iterate certain Tar files
Submitted: 2016-06-13 11:24 UTC Modified: 2016-06-13 13:47 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: forums at artfulrobot dot uk Assigned:
Status: Verified Package: PHAR related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-06-13 11:24 UTC] forums at artfulrobot dot uk
Description:
------------
---
From manual page: http://www.php.net/class.phardata
---

This fails to iterate certain Tar files, see example below. If this is a by-design limitation it should be noted.

Test script:
---------------
#!/bin/bash
# Create a tar file.
mkdir -p orig-dir/subdir; touch orig-dir/{a,b,subdir/c}; cd orig-dir
tar czf ../test.tgz ./; cd ../

# PHP
<?php
$a = new PharData('test.tgz', RecursiveDirectoryIterator::SKIP_DOTS);
print count($a) . " files\n";
foreach (new RecursiveIteratorIterator($a) as $path => $fileinfo) {
  print "  " . $path . "\n"; // never runs.
}


Expected result:
----------------
3 files
 phar:///some/path/./a
 phar:///some/path/./b
 phar:///some/path/./subdir/c

Actual result:
--------------
5 files

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-13 11:24 UTC] forums at artfulrobot dot uk
-Summary: PhpData's limitations are not listed. +Summary: PharData's limitations are not listed.
 [2016-06-13 11:24 UTC] forums at artfulrobot dot uk
oops, wrong name in title
 [2016-06-13 12:56 UTC] cmb@php.net
-Summary: PharData's limitations are not listed. +Summary: PharData fails to iterate certain Tar files -Status: Open +Status: Verified -Type: Documentation Problem +Type: Bug -Package: Documentation problem +Package: PHAR related
 [2016-06-13 12:56 UTC] cmb@php.net
Even when RecursiveDirectoryIterator::SKIP_DOTS is not passed to
the constructor, I see the same behavior, and to me that looks
like a bug, not a limitation.
 [2016-06-13 13:47 UTC] forums at artfulrobot dot uk
yeah, I thought it was a bug, but because I only use packaged versions of PHP (Debian, Ubuntu) and neither of those is considered up-to-date enough to have an option in the bug reporter, I figured I'd say it was wrong documentation...

FWIW: I can confirm this bug is in PHP 5.6.20 and PHP 7.0.4.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Aug 24 00:01:26 2019 UTC