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
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: forums at artfulrobot dot uk
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Thu Nov 21 19:01:29 2024 UTC