[php-src] master: Merge branch 'PHP-8.6'

From: Date: Tue, 13 Oct 2026 16:53:01 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142231@lists.php.net to get a copy of this message
Author: ndossche (ndossche) Date: 2026-10-13T18:52:50+02:00 Commit: https://github.com/php/php-src/commit/41256a06ab74bfc2d61813c626e8ce922f96387d Raw diff: https://github.com/php/php-src/commit/41256a06ab74bfc2d61813c626e8ce922f96387d.diff Merge branch 'PHP-8.6' * PHP-8.6: Fix GH-24289: finfo::file() reports the wrong argument number Changed paths: A ext/fileinfo/tests/gh24289.phpt M ext/fileinfo/fileinfo.c Diff: diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 36247b7196f4..4bc76b44ea72 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -297,7 +297,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 (#142231) next »