[php-src] PR #14143: Support custom SplFileInfo objects in Phar::buildFromIterator()
| From: | nielsdos | Date: | Sun, 05 May 2024 19:01:19 +0000 |
| Subject: | [php-src] PR #14143: Support custom SplFileInfo objects in Phar::buildFromIterator() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-26037@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/14143
Author: nielsdos
While it is possible to return a custom SplFileInfo object in the
iterator used by buildFromIterator(), the data is not actually used from
that object, instead the data from the underlying internal structure is
used. This makes it impossible to override some metadata such as the
path name and modification time.
The main motivation comes from two reasons:
- Consistency. We expect our custom methods to be called when having a
custom object.
- Support reproducibility. This is the original use case as requested in
[1].
Add support for this by calling the getMTime() and getPathname() methods
if they're overriden by a user class.
[1] https://github.com/theseer/Autoload/issues/114.