[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5

From: Date: Tue, 13 Oct 2026 16:52:59 +0000
Subject: [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142229@lists.php.net to get a copy of this message
Author: ndossche (ndossche) Date: 2026-10-13T18:52:29+02:00 Commit: https://github.com/php/php-src/commit/06c95e72749d23b4e5cfc6fad0569701537b0d6e Raw diff: https://github.com/php/php-src/commit/06c95e72749d23b4e5cfc6fad0569701537b0d6e.diff Merge branch 'PHP-8.4' into PHP-8.5 * PHP-8.4: Fix GH-24289: finfo::file() reports the wrong argument number Changed paths: A ext/fileinfo/tests/gh24289.phpt M NEWS M ext/fileinfo/fileinfo.c Diff: diff --git a/NEWS b/NEWS index 73d7145593f6..a8b32cd0d65e 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,10 @@ PHP NEWS (Nicolas Grekas) . Fix escape analysis for objects implementing ArrayAccess. (ndossche, Arnaud) +- Fileinfo: + . Fixed bug GH-24289 (finfo::file() reports the wrong argument number for + an invalid $filename). (Lazizbek Ergashev) + - FPM: . Fixed bug GH-24229 (fcgi_close() passes shutdown() a literal 1, which is SHUT_RD in WASI). (Ryosuke Ishibashi) diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index baae75715495..cc2f7307396b 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -301,7 +301,7 @@ PHP_FUNCTION(finfo_file) struct magic_set *magic = Z_FINFO_P(self)->magic; if (UNEXPECTED(ZSTR_LEN(path) == 0)) { - zend_argument_must_not_be_empty_error(2); + zend_argument_must_not_be_empty_error(hasThis() ? 1 : 2); RETURN_THROWS(); } php_stream_context *context = php_stream_context_from_zval(zcontext, false); diff --git a/ext/fileinfo/tests/gh24289.phpt b/ext/fileinfo/tests/gh24289.phpt new file mode 100644 index 000000000000..035fca7e96b4 --- /dev/null +++ b/ext/fileinfo/tests/gh24289.phpt @@ -0,0 +1,23 @@ +--TEST-- +GH-24289 (finfo::file() reports the wrong argument number for an invalid $filename) +--EXTENSIONS-- +fileinfo +--FILE-- +<?php + +$finfo = new finfo(); +try { + var_dump($finfo->file('')); +} catch (Throwable $e) { + echo $e::class, ": ", $e->getMessage() . \PHP_EOL; +} +try { + var_dump($finfo->file("\0")); +} catch (Throwable $e) { + echo $e::class, ": ", $e->getMessage() . \PHP_EOL; +} + +?> +--EXPECT-- +ValueError: finfo::file(): Argument #1 ($filename) must not be empty +ValueError: finfo::file(): Argument #1 ($filename) must not contain any null bytes

« previous php.cvs (#142229) next »