]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #34809 (FETCH_INTO in PDO crashes without a destination object).
authorIlia Alshanetsky <iliaa@php.net>
Mon, 10 Oct 2005 14:44:16 +0000 (14:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 10 Oct 2005 14:44:16 +0000 (14:44 +0000)
NEWS
ext/pdo/pdo_stmt.c

diff --git a/NEWS b/NEWS
index 81cf00bd338b62b577728272827ce243223f7848..a4bebec4ec61682b8b1fb21d62a9392d8e32d79b 100644 (file)
--- 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)
index f01fe279b722c9e6eaa6c88a42a9072bf50099d9..6be0029c6ec3758851e10e77b98e0b3703112e3a 100755 (executable)
@@ -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);