From: Ilia Alshanetsky Date: Sun, 19 Mar 2006 17:35:36 +0000 (+0000) Subject: Properly calculate the size of the result array. X-Git-Tag: php-5.1.3RC2~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ccd89d14723295550e43667a51d9b3350bf48ce;p=php Properly calculate the size of the result array. --- diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 5037a9e3ae..c86aa91ac3 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -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: