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: 2021-01-29 15:52 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: cmb (profile)
Status: Duplicate Package: PHAR related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
14 - 11 = ?
Subscribe to this entry?

 
 [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.
 [2021-01-29 15:52 UTC] cmb@php.net
-Status: Verified +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2021-01-29 15:52 UTC] cmb@php.net
This is actually a duplicate of bug #71966.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC