summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli_warning.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-05-26 07:28:43 +0000
committerAndrey Hristov <andrey@php.net>2010-05-26 07:28:43 +0000
commitce682f1b269c90f8c9a8ae37c394ea6b96c893a5 (patch)
treea46c330efaa07f37418e9eedccdb656a5359bd1b /ext/mysqli/mysqli_warning.c
parent89e93723fb11a623a42518d5de2c6f5e51243fda (diff)
downloadphp-git-ce682f1b269c90f8c9a8ae37c394ea6b96c893a5.tar.gz
Add checks to check the underlying pointer in the resource.
It can happen that the underlying pointer is freed (like in the case of connection reconnect), and then it cannot be allocated anymore, which means that NULL will be used consequently by the functions that fetch the resource and the crash is immediate.
Diffstat (limited to 'ext/mysqli/mysqli_warning.c')
-rw-r--r--ext/mysqli/mysqli_warning.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c
index 80c26eb0dd..2236db9262 100644
--- a/ext/mysqli/mysqli_warning.c
+++ b/ext/mysqli/mysqli_warning.c
@@ -280,11 +280,11 @@ PHP_METHOD(mysqli_warning, __construct)
if (obj->zo.ce == mysqli_link_class_entry) {
MY_MYSQL *mysql;
- MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &z, "mysqli_link", MYSQLI_STATUS_VALID);
+ MYSQLI_FETCH_RESOURCE_CONN(mysql, &z, MYSQLI_STATUS_VALID);
hdl = mysql->mysql;
} else if (obj->zo.ce == mysqli_stmt_class_entry) {
MY_STMT *stmt;
- MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &z, "mysqli_stmt", MYSQLI_STATUS_VALID);
+ MYSQLI_FETCH_RESOURCE_STMT(stmt, &z, MYSQLI_STATUS_VALID);
hdl = mysqli_stmt_get_connection(stmt->stmt);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid class argument");