File tree Expand file tree Collapse file tree
ext/phar/tests/buildFromIterator_user_overrides Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ PHP NEWS
5656 . Fixed bug GH-24461 (DISCARD ALL on persistent connection cleanup drops
5757 PgBouncer's prepared statements). (David Carlier, Artem Ukrainskiy)
5858
59+ - Phar:
60+ . Fixed Phar::buildFromIterator() accepting a negative getMTime() on 32bit
61+ platforms. (Marc Bennewitz)
62+
5963- SAPI:
6064 . Fixed infinite loop in sapi_header_op() for headers of 4 GiB or more.
6165 (Martin Mirchev)
Original file line number Diff line number Diff line change 1+ --TEST--
2+ buildFromIterator with user overrides - negative getMTime()
3+ --EXTENSIONS--
4+ phar
5+ --INI--
6+ phar.readonly=0
7+ phar.require_hash=0
8+ --FILE--
9+ <?php
10+
11+ class MySplFileInfo extends SplFileInfo {
12+ public function getMTime (): int |false {
13+ echo "[MTime] \n" ;
14+ return -1 ;
15+ }
16+ }
17+
18+ class MyIterator extends RecursiveDirectoryIterator {
19+ public function current (): SplFileInfo {
20+ return new MySplFileInfo (parent ::current ()->getPathname ());
21+ }
22+ }
23+
24+ $ workdir = __DIR__ .'/getMTime_negative ' ;
25+ mkdir ($ workdir . '/content ' , recursive: true );
26+ file_put_contents ($ workdir . '/content/hello.txt ' , "Hello world. " );
27+
28+ try {
29+ $ phar = new \Phar ($ workdir . "/test.phar " );
30+ $ phar ->startBuffering ();
31+ $ phar ->buildFromIterator (
32+ new RecursiveIteratorIterator (
33+ new MyIterator ($ workdir . '/content ' , FilesystemIterator::SKIP_DOTS )
34+ ),
35+ $ workdir
36+ );
37+ $ phar ->stopBuffering ();
38+ } catch (Throwable $ e ) {
39+ echo $ e ::class, ': ' , $ e ->getMessage (), "\n" ;
40+ }
41+
42+ ?>
43+ --CLEAN--
44+ <?php
45+ $ workdir = __DIR__ .'/getMTime_negative ' ;
46+ @unlink ($ workdir . '/content/hello.txt ' );
47+ @unlink ($ workdir . '/test.phar ' );
48+ @rmdir ($ workdir . '/content ' );
49+ @rmdir ($ workdir );
50+ ?>
51+ --EXPECTF--
52+ [MTime]
53+ BadMethodCallException: Entry content%chello.txt cannot be created: timestamp is limited to 32-bit
You can’t perform that action at this time.
0 commit comments