[php-src] Issue #10766: PharData archive created with Phar::Zip format does not keep files metadata (datetime)
| From: | franck-paul | Date: | Fri, 03 Mar 2023 20:00:31 +0000 |
| Subject: | [php-src] Issue #10766: PharData archive created with Phar::Zip format does not keep files metadata (datetime) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243844@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10766
Author: franck-paul
### Description
Having a file created this day (2023-03-03) named
myfile.txt in /tmp
directory.
The following code:
```php
<?php
$a = new \PharData('/tmp/archive.zip', \FilesystemIterator::SKIP_DOTS |
\FilesystemIterator::UNIX_PATHS, null, \Phar::ZIP);
$a->addFile('/tmp/myfile.txt', 'name');
$b = new \PharData('/tmp/archive.tar', \FilesystemIterator::SKIP_DOTS |
\FilesystemIterator::UNIX_PATHS, null, \Phar::TAR);
$b->addFile('/tmp/myfile.txt', 'name');
```
Resulted in this output (uncompress '/tmp/archive.zip' archive):
```
name 1980-01-01
```
But I expected this output instead (uncompress '/tmp/archive.tar' archive):
```
name 2023-03-03
```
### PHP Version
PHP 8.2.0
### Operating System
MacOS 13.2