php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #72046 PharData::buildFromIterator() directory support
Submitted: 2016-04-17 21:56 UTC Modified: 2021-02-05 12:38 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: tklingenberg at lastflood dot net Assigned:
Status: Open Package: PHAR related
PHP Version: 5.6.20 OS: Linux
Private report: No CVE-ID: None
 [2016-04-17 21:56 UTC] tklingenberg at lastflood dot net
Description:
------------
When building from an iterator, the iterator can return SplFileInfo objects.

These can represent a *file* or a *directory*.

Right now each iteration is treated as a file.

It would be great to support directories as well and whenever encountering a directory SplFileInfo to add it's path as empty directory (compare PharData::addEmptyDir())



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-17 22:01 UTC] tklingenberg at lastflood dot net
Previous behaviour (#46060) that was fixed for addDir() is now still on itertor process with a directory: Directory path as zero-byte file.
 [2021-01-27 14:21 UTC] cmb@php.net
IMHO, a reasonable feature request!

> Previous behaviour (#46060) that was fixed for addDir() is now
> still on itertor process with a directory: Directory path as
> zero-byte file.

This is no longer the case as of PHP 7.4.0 (and hasn't been on
Windows), since opening a directory is no longer erroneously
supported.
 [2021-01-27 15:46 UTC] tklingenberg at lastflood dot net
Is there anything I can for it? Just asking as the original report is quite old and I think I could add an example script for creating a phar in PHP with an empty directory via building from iterator.
 [2021-02-05 12:38 UTC] cmb@php.net
> Is there anything I can for it?

A pull request implementing that feature would be welcome!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC