Closed
Description
Description
The attached zip file contains one text file with a modified time of 1680284661:
test.zip
Running this code in a directory with the zip file on macOS:
<?php
$phar = new PharData('test.zip');
print($phar->getMTime());
Resulted in this output:
1680317060
But I expected this output instead:
1680284661
Some people also get 1680284660 as output. Note that 1680317060 and 1680284661 are exactly 9 hours and 1 second apart, making me think this could be a timezone issue and the 1 second might be a rounding error.
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 😄
PHP Version
8.2.11 from Homebrew
Operating System
macOS 13.6 (2021 Macbook Pro, Apple M1 Max)