]> granicus.if.org Git - php/commitdiff
Fixed bug #48313 (fgetcsv() does not return null for empty rows)
authorIlia Alshanetsky <iliaa@php.net>
Mon, 18 May 2009 18:45:30 +0000 (18:45 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 18 May 2009 18:45:30 +0000 (18:45 +0000)
ext/standard/file.c

index d83f91180505131c29c72a736f7868235c6395c7..eae751a5cbbd6e7138253ff417ad5896dd0f7cca 100644 (file)
@@ -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: