]> granicus.if.org Git - php/commitdiff
Fix #35431; LAZY fetch and fetchAll == crash.
authorWez Furlong <wez@php.net>
Sun, 27 Nov 2005 21:01:58 +0000 (21:01 +0000)
committerWez Furlong <wez@php.net>
Sun, 27 Nov 2005 21:01:58 +0000 (21:01 +0000)
Lazy makes no sense with fetchAll; disallow it.

ext/pdo/pdo_stmt.c

index c29036f50b4e7790f602e3044171f5d1ce3be07a..a6f7d1f8265daa8cc55eab2bec7e905bc843970a 100755 (executable)
@@ -1138,6 +1138,13 @@ static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, int mode, int fetch_all TSRMLS
                        return 0;
                }
                return 1;
+
+       case PDO_FETCH_LAZY:
+               if (fetch_all) {
+                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_LAZY can't be used with PDOStatement::fetchAll()" TSRMLS_CC);
+                       return 0;
+               }
+               /* fall through */
        
        default:
                if ((flags & PDO_FETCH_SERIALIZE) == PDO_FETCH_SERIALIZE) {