Commit 1e24c518786 for php
commit 1e24c5187863c31244ff6544bce63c894c5b56b1
Merge: 532fcd118ce 6d7cc61e048
Author: Gina Peter Banyard <girgias@php.net>
Date: Sun Nov 8 07:38:27 2026 +0000
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Zend: fix object_init_with_constructor() with positional args in named_params
zend_test: add additional tests with zend_object_init_with_constructor()
zend_test: add missing opcache enable INI setting
diff --cc ext/zend_test/test.c
index b67815f11ed,4bd96976a96..3831759c4a4
--- a/ext/zend_test/test.c
+++ b/ext/zend_test/test.c
@@@ -600,28 -566,28 +600,49 @@@ static ZEND_FUNCTION(zend_object_init_w
ZVAL_COPY_VALUE(return_value, &obj);
}
-
+ /* Instantiate a class and run the constructor via object_init_with_constructor */
+ static ZEND_FUNCTION(zend_object_init_with_constructor_array)
+ {
+ zend_class_entry *ce = NULL;
+ HashTable *args;
+
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_CLASS(ce)
+ Z_PARAM_ARRAY_HT(args)
+ ZEND_PARSE_PARAMETERS_END();
+
+ zval obj;
+ /* We don't use return_value directly to check for memory leaks of the API on failure */
+ zend_result status = object_init_with_constructor(&obj, ce, 0, NULL, args);
+ if (status == FAILURE) {
+ RETURN_THROWS();
+ }
+ ZEND_ASSERT(!EG(exception));
+ ZVAL_COPY_VALUE(return_value, &obj);
+ }
+
+static ZEND_FUNCTION(zend_call_method_if_exists)
+{
+ zend_object *obj = NULL;
+ zend_string *method_name;
+ uint32_t num_args = 0;
+ zval *args = NULL;
+ ZEND_PARSE_PARAMETERS_START(2, -1)
+ Z_PARAM_OBJ(obj)
+ Z_PARAM_STR(method_name)
+ Z_PARAM_VARIADIC('*', args, num_args)
+ ZEND_PARSE_PARAMETERS_END();
+
+ zend_result status = zend_call_method_if_exists(obj, method_name, return_value, num_args, args);
+ if (status == FAILURE) {
+ ZEND_ASSERT(Z_ISUNDEF_P(return_value));
+ if (EG(exception)) {
+ RETURN_THROWS();
+ }
+ RETURN_NULL();
+ }
+}
+
static ZEND_FUNCTION(zend_get_unit_enum)
{
ZEND_PARSE_PARAMETERS_NONE();
diff --cc ext/zend_test/test.stub.php
index e6a8eee79cf,785390dd70c..500240d0f24
--- a/ext/zend_test/test.stub.php
+++ b/ext/zend_test/test.stub.php
@@@ -305,9 -287,8 +305,10 @@@ namespace
function zend_call_method(object|string $obj_or_class, string $method, mixed $arg1 = UNKNOWN, mixed $arg2 = UNKNOWN): mixed {}
function zend_object_init_with_constructor(string $class, mixed ...$args): mixed {}
+ function zend_object_init_with_constructor_array(string $class, array $args): mixed {}
+ function zend_call_method_if_exists(object $obj, string $method, mixed ...$args): mixed {}
+
function zend_test_zend_ini_parse_quantity(string $str): int {}
function zend_test_zend_ini_parse_uquantity(string $str): int {}
diff --cc ext/zend_test/test_arginfo.h
index d35ae490d8d,45545edf5db..40c38d2e65c
Binary files differ