From: Wez Furlong Date: Thu, 17 Apr 2003 17:09:59 +0000 (+0000) Subject: NULL columns are NULL pointers X-Git-Tag: RELEASE_0_6~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d9ca8f135b34134881b5d5552e1c322406b789e;p=php NULL columns are NULL pointers --- diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c index 831cff2194..c7ebf8b35e 100644 --- a/ext/sqlite/sqlite.c +++ b/ext/sqlite/sqlite.c @@ -354,10 +354,18 @@ PHP_FUNCTION(sqlite_fetch_array) /* now populate the result */ for (j = 0; j < res->ncolumns; j++) { if (mode & PHPSQLITE_NUM) { - add_index_string(return_value, j, res->table[i + j], 1); + if (res->table[i +j] == NULL) { + add_index_null(return_value, j); + } else { + add_index_string(return_value, j, res->table[i + j], 1); + } } if (mode & PHPSQLITE_ASSOC) { - add_assoc_string(return_value, res->table[j], res->table[i + j], 1); + if (res->table[i + j] == NULL) { + add_assoc_null(return_value, res->table[j]); + } else { + add_assoc_string(return_value, res->table[j], res->table[i + j], 1); + } } }