[php-src] PR #23766: Fix GH-22854: Guard against NULL handle dereference in mysqli property access

From: Date: Sat, 19 Sep 2026 04:16:09 +0000
Subject: [php-src] PR #23766: Fix GH-22854: Guard against NULL handle dereference in mysqli property access
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-38576@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/23766 Author: prateekbhujel When a connection fails on a pre-allocated mysqli instance (such as calling $mysqli->connect(...) after instantiation), mysql->mysql is closed and set to NULL while the instance remains in MYSQLI_STATUS_INITIALIZED. Reading properties like $mysqli->errno or $mysqli->error, or inspecting the object with var_dump(), accessed mysql->mysql without checking for NULL, triggering an assertion failure on debug builds and a crash on release builds. Similarly, statement and result property readers lacked NULL guards on the underlying pointers. This adds NULL checks across the property access macros and reader functions in mysqli_prop.c to safely throw an Error on verbose access or return FAILURE in quiet/debug mode. Fixes https://github.com/php/php-src/issues/22854

« previous php.git-pulls (#38576) next »