-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-10766: PharData archive created with Phar::Zip format does not…
… keep files metadata (datetime) Due to an incorrect check, the datetime was never actually set. To test this we need to write the file using phar, but read the file using a different method to not get a cached, or a value that's been transformed twice and is therefore accidentally correct. Closes GH-10769
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--TEST-- | ||
GH-10766 (PharData archive created with Phar::Zip format does not keep files metadata (datetime)) | ||
--EXTENSIONS-- | ||
phar | ||
zip | ||
--INI-- | ||
phar.readonly=0 | ||
--FILE-- | ||
<?php | ||
$phar = new PharData(__DIR__ . '/gh10766.zip', 0, null, Phar::ZIP); | ||
$phar->addFromString('name', 'contents'); | ||
unset($phar); | ||
|
||
// Re-read from disk, but using the zip extension because the phar bug will not make it possible | ||
// to use their timestamp methods. | ||
$zip = new ZipArchive(); | ||
$zip->open(__DIR__ . '/gh10766.zip'); | ||
var_dump($zip->statName('name')['mtime'] > 315529200 /* earliest possible zip timestamp */); | ||
$zip->close(); | ||
?> | ||
--CLEAN-- | ||
<?php | ||
unlink(__DIR__ . '/gh10766.zip'); | ||
?> | ||
--EXPECT-- | ||
bool(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters