Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion Zend/Optimizer/zend_func_infos.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion ext/mysqli/mysqli.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

/**
Expand Down
2 changes: 1 addition & 1 deletion ext/mysqli/mysqli_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions ext/mysqli/tests/gh25779.phpt
Original file line number Diff line number Diff line change
@@ -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--
<?php
require_once __DIR__ . '/test_setup/test_helpers.inc';
mysqli_check_skip_test();
?>
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.jit=function
opcache.jit_buffer_size=64M
opcache.file_update_protection=0
--FILE--
<?php
require_once __DIR__ . '/test_setup/test_helpers.inc';

class Row {
public static array $rows = [];

public function __construct() {
self::$rows[] = $this;
}
Comment thread
kamil-tekiela marked this conversation as resolved.
Resolved

public function __destruct() { echo "destruct\n"; }
}

function test(mysqli_result $result) {
mysqli_fetch_object($result, Row::class);
}

$link = default_mysqli_connect();
test(mysqli_query($link, "SELECT 1 AS id"));
var_dump(Row::$rows);
?>
--EXPECTF--
array(1) {
[0]=>
object(Row)#%d (1) {
["id"]=>
string(1) "1"
}
}
destruct
Loading