[php-src] Issue #12532: PharData created from zip has incorrect timestamp
| From: | danepowell | Date: | Fri, 27 Oct 2023 04:33:47 +0000 |
| Subject: | [php-src] Issue #12532: PharData created from zip has incorrect timestamp | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245664@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12532
Author: danepowell
### Description
The following code (see attached zip):
[test.zip](https://github.com/php/php-src/files/13184920/test.zip)
```php
<?php
$phar = new PharData('test.zip');
print($phar->getMTime());
```
Resulted in this output:
```
1680317060
```
But I expected this output instead:
```
1680284661
```
Actually, I would perhaps expect the mtime to be that of the zipfile itself, not of its contents. I
don't think the behavior of setting the mtime based on contents is documented anywhere.
Regardless, the mtime should have _some_ correlation to a real value 😄
It looks like this was last touched in https://github.com/php/php-src/issues/10766
(https://github.com/php/php-src/commit/e633be3e87c59aa20c1a7edce2c259b48e2833f7) and this introduced
the bug.
### PHP Version
8.2.11
### Operating System
macOS