diff --git a/NEWS b/NEWS index c5602d1cf86b..99cb66865daa 100644 --- a/NEWS +++ b/NEWS @@ -155,6 +155,10 @@ PHP NEWS . Fixed bug GH-25588 (Use-after-free of a string parameter omitted on a later execute() or rebound while fetching). (Ilia Alshanetsky) +- PGSQL: + . Fixed bug GH-25760 (pg_fetch_all_columns() crashes with JIT when the result + for an empty set is modified). (Tomasz Kowalczyk) + - Phar: . Fixed bug GH-25528 (Phar::setSignatureAlgorithm(): OpenSSL signing reads a freed private key). (Artem Ukrainskiy) diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index be2a0c3639b6..a02fce257cee 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -319,7 +319,7 @@ static const func_info_t func_infos[] = { F1("pg_fetch_array", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL|MAY_BE_FALSE), F1("pg_fetch_object", MAY_BE_OBJECT|MAY_BE_FALSE), F1("pg_fetch_all", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY), - F1("pg_fetch_all_columns", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL), + FN("pg_fetch_all_columns", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL), F1("pg_last_oid", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE), F1("pg_lo_create", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE), F1("pg_lo_open", MAY_BE_OBJECT|MAY_BE_FALSE), diff --git a/ext/pgsql/pgsql.stub.php b/ext/pgsql/pgsql.stub.php index 9bd78eb3ad4f..61d41dcffc23 100644 --- a/ext/pgsql/pgsql.stub.php +++ b/ext/pgsql/pgsql.stub.php @@ -654,7 +654,6 @@ function pg_fetch_all(PgSql\Result $result, int $mode = PGSQL_ASSOC): array {} /** * @return array - * @refcount 1 */ function pg_fetch_all_columns(PgSql\Result $result, int $field = 0): array {} diff --git a/ext/pgsql/pgsql_arginfo.h b/ext/pgsql/pgsql_arginfo.h index c9b0c85880da..294212cf3550 100644 --- a/ext/pgsql/pgsql_arginfo.h +++ b/ext/pgsql/pgsql_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 368fabe2efd0e7d490ca80ecab0d92c4d5381e5e */ + * Stub hash: 8f175d8ed14f4bc7156fc232e3280ab06fbe276d */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_connect, 0, 1, PgSql\\Connection, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0) diff --git a/ext/pgsql/tests/gh25760.phpt b/ext/pgsql/tests/gh25760.phpt new file mode 100644 index 000000000000..69148e9a0432 --- /dev/null +++ b/ext/pgsql/tests/gh25760.phpt @@ -0,0 +1,31 @@ +--TEST-- +GH-25760: pg_fetch_all_columns() crashes with JIT when the result for an empty set is modified +--EXTENSIONS-- +pgsql +opcache +--SKIPIF-- + +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.jit_buffer_size=64M +opcache.file_update_protection=0 +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + int(1) +}