diff --git a/NEWS b/NEWS index 495a49d6aa1a..eec562d42299 100644 --- a/NEWS +++ b/NEWS @@ -116,6 +116,11 @@ PHP NEWS . Fixed the JIT freeing the string returned by mb_encode_mimeheader() or mb_output_handler() while it is still in use. (Ilia Alshanetsky) +- MySQLi: + . Fixed bug GH-25779 (mysqli_fetch_object() crashes with JIT when the + constructor keeps a reference and the result is discarded). + (Tomasz Kowalczyk) + - Opcache: . Fixed bug GH-24801 (JIT: SIGFPE in ir_fold MUL_OV constant folding). (waroad) diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index faff2f43b5c7..ce6369193014 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -249,7 +249,6 @@ static const func_info_t func_infos[] = { F1("mysqli_fetch_all", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY), F1("mysqli_fetch_array", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_NULL|MAY_BE_FALSE), F1("mysqli_fetch_assoc", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_NULL|MAY_BE_FALSE), - F1("mysqli_fetch_object", MAY_BE_OBJECT|MAY_BE_NULL|MAY_BE_FALSE), F1("mysqli_fetch_row", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ANY|MAY_BE_NULL|MAY_BE_FALSE), F1("mysqli_get_connection_stats", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY), F1("mysqli_get_client_stats", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING), diff --git a/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php index de287b347dee..23b215565329 100644 --- a/ext/mysqli/mysqli.stub.php +++ b/ext/mysqli/mysqli.stub.php @@ -1423,7 +1423,6 @@ function mysqli_fetch_array(mysqli_result $result, int $mode = MYSQLI_BOTH): arr */ function mysqli_fetch_assoc(mysqli_result $result): array|null|false {} -/** @refcount 1 */ function mysqli_fetch_object(mysqli_result $result, string $class = "stdClass", array $constructor_args = []): object|null|false {} /** diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h index e45c3550a6c5..636ee9a5dfcf 100644 --- a/ext/mysqli/mysqli_arginfo.h +++ b/ext/mysqli/mysqli_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 32baf7b0642af68dea551687bc44ae47d708d810 */ + * Stub hash: 1e669ba66edc3e15201e15e67661794b11a3929e */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING) ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0) diff --git a/ext/mysqli/tests/gh25779.phpt b/ext/mysqli/tests/gh25779.phpt new file mode 100644 index 000000000000..d89f8deb180a --- /dev/null +++ b/ext/mysqli/tests/gh25779.phpt @@ -0,0 +1,47 @@ +--TEST-- +GH-25779: mysqli_fetch_object() crashes with JIT when the constructor keeps a reference and the result is discarded +--EXTENSIONS-- +mysqli +opcache +--SKIPIF-- + +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.jit_buffer_size=64M +opcache.file_update_protection=0 +--FILE-- + +--EXPECTF-- +array(1) { + [0]=> + object(Row)#%d (1) { + ["id"]=> + string(1) "1" + } +} +destruct