From a7210008db8e24100bbe2fd8e3e4630571a713ce Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 16 Jun 2010 23:13:29 +0000 Subject: [PATCH] - Fix crash when calling a method of a class that inherits PDOStatement if instantiated directly --- ext/pdo/pdo_stmt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 8d4e853bb5..56f79e1d59 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -2282,6 +2282,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]) { -- 2.40.0