]> granicus.if.org Git - php/commitdiff
fix #35430 (PDO crashes on incorrect FETCH_FUNC use)
authorAntony Dovgal <tony2001@php.net>
Sun, 27 Nov 2005 20:56:46 +0000 (20:56 +0000)
committerAntony Dovgal <tony2001@php.net>
Sun, 27 Nov 2005 20:56:46 +0000 (20:56 +0000)
ext/pdo/pdo_stmt.c

index 43922d16480fe3c51e7c402e744429330ffceb17..765cd89a567f2309caca429ee8bc6f2357c43f66 100755 (executable)
@@ -1305,13 +1305,15 @@ static PHP_METHOD(PDOStatement, fetchAll)
                switch(ZEND_NUM_ARGS()) {
                case 0:
                case 1:
+                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "no fetch function specified" TSRMLS_CC);
+                       error = 1;
                        break;
                case 3:
                case 2:
                        stmt->fetch.func.function = arg2;
+                       do_fetch_func_prepare(stmt TSRMLS_CC);
                        break;
                }
-               do_fetch_func_prepare(stmt TSRMLS_CC);
                break;
        
        case PDO_FETCH_COLUMN: