From: Ilia Alshanetsky Date: Mon, 18 May 2009 18:45:30 +0000 (+0000) Subject: Fixed bug #48313 (fgetcsv() does not return null for empty rows) X-Git-Tag: php-5.3.0RC3~218 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e99d4e9adc97398e76f5e8a143207ebcfc81efe5;p=php Fixed bug #48313 (fgetcsv() does not return null for empty rows) --- diff --git a/ext/standard/file.c b/ext/standard/file.c index d83f911805..eae751a5cb 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2343,8 +2343,12 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char } /* 3. Now pass our field back to php */ - *comp_end = '\0'; - add_next_index_stringl(return_value, temp, comp_end - temp, 1); + if (comp_end - temp) { + *comp_end = '\0'; + add_next_index_stringl(return_value, temp, comp_end - temp, 1); + } else { + add_next_index_null(return_value); + } } while (inc_len > 0); out: