From: Ilia Alshanetsky Date: Mon, 10 Oct 2005 14:44:16 +0000 (+0000) Subject: MFH: Fixed bug #34809 (FETCH_INTO in PDO crashes without a destination object). X-Git-Tag: php-5.1.0RC2~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5fe9808aa2bce54ae92497a6870caa17ec4208e;p=php MFH: Fixed bug #34809 (FETCH_INTO in PDO crashes without a destination object). --- diff --git a/NEWS b/NEWS index 81cf00bd33..a4bebec4ec 100644 --- a/NEWS +++ b/NEWS @@ -45,6 +45,8 @@ PHP NEWS (Andrey) - Fixed bug #34810 (mysqli::init() and others use wrong $this pointer without checks). (Tony) +- Fixed bug #34809 (FETCH_INTO in PDO crashes without a destination object). + (Ilia) - Fixed bug #34802 (Fixed crash on object instantiation failure). (Ilia) - Fixed bug #34796 (missing SSL linking in ext/ftp when configured as shared). (Jani) diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index f01fe279b7..6be0029c6e 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -830,6 +830,12 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, break; case PDO_FETCH_INTO: + if (!stmt->fetch.into) { + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch-into object specified." TSRMLS_CC); + return 0; + break; + } + Z_TYPE_P(return_value) = IS_OBJECT; Z_OBJ_HANDLE_P(return_value) = Z_OBJ_HANDLE_P(stmt->fetch.into); Z_OBJ_HT_P(return_value) = Z_OBJ_HT_P(stmt->fetch.into);