[php-src] PHP-8.5: ext/pgsql: pg_get_notify() result is never === false with opcache enabled

From: Date: Fri, 27 Nov 2026 04:45:07 +0000
Subject: [php-src] PHP-8.5: ext/pgsql: pg_get_notify() result is never === false with opcache enabled
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-144242@lists.php.net to get a copy of this message
Author: Tomasz Kowalczyk (thunderer) Committer: David Carlier (devnexen) Date: 2026-11-27T04:40:43Z Commit: https://github.com/php/php-src/commit/c87656f16f249fba44c249684bd677e2ada6885f Raw diff: https://github.com/php/php-src/commit/c87656f16f249fba44c249684bd677e2ada6885f.diff ext/pgsql: pg_get_notify() result is never === false with opcache enabled pg_get_notify() returns false when no notification is pending, but the @return tag in the stub omitted |false. The generated optimizer info therefore had no MAY_BE_FALSE, and opcache removed === false checks on the result, also with the JIT disabled. This adds |false to the tag and regenerates the arginfo and optimizer info. The test fails without the change. Fix GH-25802 Close GH-25803 Changed paths: A ext/pgsql/tests/gh25802.phpt M NEWS M Zend/Optimizer/zend_func_infos.h M ext/pgsql/pgsql.stub.php M ext/pgsql/pgsql_arginfo.h Diff: diff --git a/NEWS b/NEWS index e42393462d83..e12f30201909 100644 --- a/NEWS +++ b/NEWS @@ -175,6 +175,8 @@ PHP NEWS - PGSQL: . Fixed bug GH-25772 (pg_fetch_object() crashes with JIT when the constructor keeps a reference and the result is discarded). (Tomasz Kowalczyk) + . Fixed bug GH-25802 (pg_get_notify() result is never === false with opcache + enabled). (Tomasz Kowalczyk) - Phar: . Fixed bug GH-25528 (Phar::setSignatureAlgorithm(): OpenSSL signing reads a diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index ce6369193014..632e7bf98bad 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -333,7 +333,7 @@ static const func_info_t func_infos[] = { F1("pg_result_error_field", MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL), F1("pg_get_result", MAY_BE_OBJECT|MAY_BE_FALSE), F1("pg_result_status", MAY_BE_STRING|MAY_BE_LONG), - F1("pg_get_notify", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING), + F1("pg_get_notify", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE), F1("pg_socket", MAY_BE_RESOURCE|MAY_BE_FALSE), F1("pg_meta_data", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE), F1("pg_convert", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE), diff --git a/ext/pgsql/pgsql.stub.php b/ext/pgsql/pgsql.stub.php index 31774ed56fee..e9c5c3922292 100644 --- a/ext/pgsql/pgsql.stub.php +++ b/ext/pgsql/pgsql.stub.php @@ -906,7 +906,7 @@ function pg_get_result(PgSql\Connection $connection): PgSql\Result|false {} function pg_result_status(PgSql\Result $result, int $mode = PGSQL_STATUS_LONG): string|int {} /** - * @return array<int|string, int|string> + * @return array<int|string, int|string>|false * @refcount 1 */ function pg_get_notify(PgSql\Connection $connection, int $mode = PGSQL_ASSOC): array|false {} diff --git a/ext/pgsql/pgsql_arginfo.h b/ext/pgsql/pgsql_arginfo.h index 3839f550edbd..5ee977a14f04 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: 891bd725ce4b52880ee9349861a15537541bd0ed */ + * Stub hash: 34a8f9c339c47db2dedd5db3bae59abd9ae66c7a */ 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/gh25802.phpt b/ext/pgsql/tests/gh25802.phpt new file mode 100644 index 000000000000..2a1fa2711e08 --- /dev/null +++ b/ext/pgsql/tests/gh25802.phpt @@ -0,0 +1,29 @@ +--TEST-- +GH-25802: pg_get_notify() result is never === false with opcache enabled +--EXTENSIONS-- +pgsql +opcache +--SKIPIF-- +<?php include("inc/skipif.inc"); ?> +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +--FILE-- +<?php +include('inc/config.inc'); + +function check(PgSql\Connection $db): void { + $msg = pg_get_notify($db); + var_dump($msg === false); +} + +$db = pg_connect($conn_str); +check($db); +pg_query($db, 'LISTEN pg_get_notify_false'); +pg_query($db, 'NOTIFY pg_get_notify_false'); +check($db); +?> +--EXPECT-- +bool(true) +bool(false)

« previous php.cvs (#144242) next »