]> granicus.if.org Git - php/commitdiff
Properly calculate the size of the result array.
authorIlia Alshanetsky <iliaa@php.net>
Sun, 19 Mar 2006 17:35:36 +0000 (17:35 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 19 Mar 2006 17:35:36 +0000 (17:35 +0000)
ext/pdo/pdo_stmt.c

index 5037a9e3ae6bb6881fc76a4eafc30de21707773c..c86aa91ac3ad433bbf36af03a0604dcc4c739143 100755 (executable)
@@ -833,7 +833,13 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
                        case PDO_FETCH_BOTH:
                        case PDO_FETCH_NUM:
                        case PDO_FETCH_NAMED:
-                               array_init(return_value);
+                               if (!return_all) {
+                                       ALLOC_HASHTABLE(return_value->value.ht);
+                                       zend_hash_init(return_value->value.ht, stmt->column_count, NULL, ZVAL_PTR_DTOR, 0);                     
+                                       Z_TYPE_P(return_value) = IS_ARRAY;
+                               } else {
+                                       array_init(return_value);
+                               }
                                break;
 
                        case PDO_FETCH_COLUMN: