diff --git a/NEWS b/NEWS index 1acf398d1c3f..e59388f18f23 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,8 @@ PHP NEWS . Fixed bug GH-25313 (Assertion !EG(exception) in ZEND_FE_FREE when unpacking a generator into a by-ref parameter throws). (ndossche) . Fix OSS-Fuzz #588264417. (ndossche) + . Fixed bug GH-25788 (clone() with properties corrupts memory with JIT when + __clone() keeps a reference and the result is discarded). (Tomasz Kowalczyk) - Curl: . Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire) diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index 76d63862cbc8..b7b8ef6952da 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -1,7 +1,6 @@ /* This is a generated file, edit the .stub.php files instead. */ static const func_info_t func_infos[] = { - F1("clone", MAY_BE_OBJECT), F1("zend_version", MAY_BE_STRING), FN("func_get_args", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ANY), F1("get_class_vars", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF), diff --git a/Zend/tests/clone/gh25788.phpt b/Zend/tests/clone/gh25788.phpt new file mode 100644 index 000000000000..2c388c6512e1 --- /dev/null +++ b/Zend/tests/clone/gh25788.phpt @@ -0,0 +1,42 @@ +--TEST-- +GH-25788: clone() with properties corrupts memory with JIT when __clone() keeps a reference and the result is discarded +--EXTENSIONS-- +opcache +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.jit_buffer_size=64M +opcache.file_update_protection=0 +--FILE-- + 2]); +} + +test(new Row()); +var_dump(Row::$rows); +?> +--EXPECTF-- +destruct +array(1) { + [0]=> + object(Row)#%d (1) { + ["id"]=> + int(2) + } +} +destruct diff --git a/Zend/zend_builtin_functions.stub.php b/Zend/zend_builtin_functions.stub.php index 9b2267b531eb..59340a15d474 100644 --- a/Zend/zend_builtin_functions.stub.php +++ b/Zend/zend_builtin_functions.stub.php @@ -7,7 +7,6 @@ class stdClass { } -/** @refcount 1 */ function clone(object $object, array $withProperties = []): object {} function exit(string|int $status = 0): never {} diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h index cf349b551ac2..8dba24e1ecd5 100644 --- a/Zend/zend_builtin_functions_arginfo.h +++ b/Zend/zend_builtin_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9b49f527064695c812cd204d9efc63c13681d942 */ + * Stub hash: 224d318c4732573fc63a3b49930a1d2f8a760e3d */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_clone, 0, 1, IS_OBJECT, 0) ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0)