summaryrefslogtreecommitdiff
path: root/ext/mysqli/php_mysqli_structs.h
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-08-14 12:44:13 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-08-14 12:44:13 +0200
commitce38d3a919c1363efbeb592d77df5f255f205419 (patch)
tree61156dbad2deef190f285d7342cffa03d81031e5 /ext/mysqli/php_mysqli_structs.h
parent196671a2b2505f042de3790ae5830121c7feb475 (diff)
downloadphp-git-ce38d3a919c1363efbeb592d77df5f255f205419.tar.gz
Don't assert mysql->mysql is non-null
There is an edge case in constructor behavior where we can end up with mysql->mysql being NULL (rather than mysql itself already being NULL). I think that ultimately that's a bug in the constructor code, and we should probably be destroying the outer structure on construction failure as well. However it's pretty hard to unravel with when considering all the construction permutations.
Diffstat (limited to 'ext/mysqli/php_mysqli_structs.h')
-rw-r--r--ext/mysqli/php_mysqli_structs.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h
index f02da59848..cc4556c107 100644
--- a/ext/mysqli/php_mysqli_structs.h
+++ b/ext/mysqli/php_mysqli_structs.h
@@ -252,7 +252,10 @@ extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * resul
#define MYSQLI_FETCH_RESOURCE_CONN(__ptr, __id, __check) \
{ \
MYSQLI_FETCH_RESOURCE((__ptr), MY_MYSQL *, (__id), "mysqli_link", (__check)); \
- ZEND_ASSERT((__ptr)->mysql && "Missing connection?"); \
+ if (!(__ptr)->mysql) { \
+ zend_throw_error(NULL, "%s object is not fully initialized", ZSTR_VAL(Z_OBJCE_P(__id)->name)); \
+ RETURN_THROWS(); \
+ } \
}
#define MYSQLI_FETCH_RESOURCE_STMT(__ptr, __id, __check) \