diff options
author | Johannes Schlüter <johannes@php.net> | 2014-02-23 14:18:24 +0100 |
---|---|---|
committer | Johannes Schlüter <johannes@php.net> | 2014-02-23 14:18:24 +0100 |
commit | 756ee95605ab0677bfd20e0d1f0ba1053b2075d7 (patch) | |
tree | 79785c1311623dff4dea47b93a5c17362867fc64 /ext/pdo_mysql | |
parent | ce1fd72776292dd81c0e39d470631d9a3f62ddb6 (diff) | |
download | php-git-756ee95605ab0677bfd20e0d1f0ba1053b2075d7.tar.gz |
We can't dereference dbh if it is NULL
Diffstat (limited to 'ext/pdo_mysql')
-rw-r--r-- | ext/pdo_mysql/pdo_mysql.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index 95f2840fcb..697e7c0b58 100644 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -64,7 +64,12 @@ static MYSQLND * pdo_mysql_convert_zv_to_mysqlnd(zval * zv TSRMLS_DC) if (Z_TYPE_P(zv) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), php_pdo_get_dbh_ce() TSRMLS_CC)) { pdo_dbh_t * dbh = zend_object_store_get_object(zv TSRMLS_CC); - if (!dbh || dbh->driver != &pdo_mysql_driver) { + if (!dbh) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to retrieve handle from object store"); + return NULL; + } + + if (dbh->driver != &pdo_mysql_driver) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Provided PDO instance is not using MySQL but %s", dbh->driver->driver_name); return NULL; } |