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

From: Date: Sat, 31 Oct 2026 15:27:53 +0000
Subject: [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143077@lists.php.net to get a copy of this message
Author: Jorg Sowa (jorgsowa) Date: 2026-10-31T16:24:30+01:00 Commit: https://github.com/php/php-src/commit/de1e70b3d7a45f6ff60b62725fe60eb02a916138 Raw diff: https://github.com/php/php-src/commit/de1e70b3d7a45f6ff60b62725fe60eb02a916138.diff Merge branch 'PHP-8.5' into PHP-8.6 # Conflicts: # Zend/zend_ast.c Changed paths: A Zend/tests/constexpr/new_named_params_duplicate_leak.phpt M NEWS M Zend/zend_ast.c Diff: diff --git a/NEWS b/NEWS index 591bfbb1f511..ee4a0eed7803 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,8 @@ PHP NEWS abstract on properties. (Jorg Sowa) . Fixed AST export of readonly anonymous classes dropping the readonly modifier. (Jorg Sowa) + . Fixed memory leak of a duplicate named argument in new in initializer. + (Jorg Sowa) - CLI: . Fixed bug GH-24697 (PHP_HTTP_PARSER_STRICT build option doesn't work). diff --git a/Zend/tests/constexpr/new_named_params_duplicate_leak.phpt b/Zend/tests/constexpr/new_named_params_duplicate_leak.phpt new file mode 100644 index 000000000000..244b670ab1c6 --- /dev/null +++ b/Zend/tests/constexpr/new_named_params_duplicate_leak.phpt @@ -0,0 +1,21 @@ +--TEST-- +Duplicate named param in new in const expr does not leak the argument +--FILE-- +<?php + +class D {} +class C { + public function __construct(public $a) {} +} + +function f($x = new C(a: new D, a: new D)) {} + +try { + f(); +} catch (Error $e) { + echo $e::class, ": ", $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Error: Named parameter $a overwrites previous argument diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index cae351fe3157..84290d1520ad 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1173,6 +1173,7 @@ static zend_result ZEND_FASTCALL zend_ast_evaluate_inner( zend_throw_error(NULL, "Named parameter $%pS overwrites previous argument", name); + zval_ptr_dtor(&arg); zend_array_destroy(args); zval_ptr_dtor(result); return FAILURE;

« previous php.cvs (#143077) next »