xref: /PHP-8.3/ext/phar/tests/zip/gh10766.phpt (revision e633be3e)
1--TEST--
2GH-10766 (PharData archive created with Phar::Zip format does not keep files metadata (datetime))
3--EXTENSIONS--
4phar
5zip
6--INI--
7phar.readonly=0
8--FILE--
9<?php
10$phar = new PharData(__DIR__ . '/gh10766.zip', 0, null, Phar::ZIP);
11$phar->addFromString('name', 'contents');
12unset($phar);
13
14// Re-read from disk, but using the zip extension because the phar bug will not make it possible
15// to use their timestamp methods.
16$zip = new ZipArchive();
17$zip->open(__DIR__ . '/gh10766.zip');
18var_dump($zip->statName('name')['mtime'] > 315529200 /* earliest possible zip timestamp */);
19$zip->close();
20?>
21--CLEAN--
22<?php
23unlink(__DIR__ . '/gh10766.zip');
24?>
25--EXPECT--
26bool(true)
27