summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-06-16 23:13:29 +0000
committerFelipe Pena <felipe@php.net>2010-06-16 23:13:29 +0000
commit93cd95fb3549439753cf3de66d85d9a962501597 (patch)
treea9830a793e50f4469c28553e8effba6c28a51a6c
parent0be30007294d26326c70f19d15b27d96dbef4d9f (diff)
downloadphp-git-93cd95fb3549439753cf3de66d85d9a962501597.tar.gz
- Fix crash when calling a method of a class that inherits PDOStatement if instantiated directly
-rwxr-xr-xext/pdo/pdo_stmt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index ccacdbfc18..ba84498ff6 100755
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2289,6 +2289,10 @@ static union _zend_function *dbstmt_method_get(
if (zend_hash_find(&Z_OBJCE_P(object)->function_table, lc_method_name,
method_len+1, (void**)&fbc) == FAILURE) {
pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(object TSRMLS_CC);
+ /* instance not created by PDO object */
+ if (!stmt->dbh) {
+ goto out;
+ }
/* not a pre-defined method, nor a user-defined method; check
* the driver specific methods */
if (!stmt->dbh->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_STMT]) {