[php-src] master: Merge branch 'PHP-8.6'
| From: | Arnaud Le Blanc | Date: | Mon, 02 Nov 2026 15:38:30 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143220@lists.php.net to get a copy of this message | ||
Author: Arnaud Le Blanc (arnaud-lb)
Date: 2026-11-02T16:38:19+01:00
Commit: https://github.com/php/php-src/commit/844dad90f586df61fc0ebbc0b616e207d6be3798
Raw diff: https://github.com/php/php-src/commit/844dad90f586df61fc0ebbc0b616e207d6be3798.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
Add test for Phar::buildFromIterator() with a negative getMTime() (#24779)
Changed paths:
A ext/phar/tests/buildFromIterator_user_overrides/getMTime_negative.phpt
Diff:
diff --git a/ext/phar/tests/buildFromIterator_user_overrides/getMTime_negative.phpt
b/ext/phar/tests/buildFromIterator_user_overrides/getMTime_negative.phpt
new file mode 100644
index 000000000000..315705781647
--- /dev/null
+++ b/ext/phar/tests/buildFromIterator_user_overrides/getMTime_negative.phpt
@@ -0,0 +1,53 @@
+--TEST--
+buildFromIterator with user overrides - negative getMTime()
+--EXTENSIONS--
+phar
+--INI--
+phar.readonly=0
+phar.require_hash=0
+--FILE--
+<?php
+
+class MySplFileInfo extends SplFileInfo {
+ public function getMTime(): int|false {
+ echo "[MTime]\n";
+ return -1;
+ }
+}
+
+class MyIterator extends RecursiveDirectoryIterator {
+ public function current(): SplFileInfo {
+ return new MySplFileInfo(parent::current()->getPathname());
+ }
+}
+
+$workdir = __DIR__.'/getMTime_negative';
+mkdir($workdir . '/content', recursive: true);
+file_put_contents($workdir . '/content/hello.txt', "Hello world.");
+
+try {
+ $phar = new \Phar($workdir . "/test.phar");
+ $phar->startBuffering();
+ $phar->buildFromIterator(
+ new RecursiveIteratorIterator(
+ new MyIterator($workdir . '/content', FilesystemIterator::SKIP_DOTS)
+ ),
+ $workdir
+ );
+ $phar->stopBuffering();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
+}
+
+?>
+--CLEAN--
+<?php
+$workdir = __DIR__.'/getMTime_negative';
+@unlink($workdir . '/content/hello.txt');
+@unlink($workdir . '/test.phar');
+@rmdir($workdir . '/content');
+@rmdir($workdir);
+?>
+--EXPECTF--
+[MTime]
+BadMethodCallException: Entry content%chello.txt cannot be created: timestamp is limited to 32-bit