iliaa           Mon May 25 13:02:55 2009 UTC

  Modified files:              
    /php-src/ext/standard       file.c 
  Log:
  
  MFB: Fixed bug #48313 (fgetcsv() return empty string rather then NULL for
  empty rows)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.546&r2=1.547&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.546 php-src/ext/standard/file.c:1.547
--- php-src/ext/standard/file.c:1.546   Thu May 21 01:39:48 2009
+++ php-src/ext/standard/file.c Mon May 25 13:02:55 2009
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: file.c,v 1.546 2009/05/21 01:39:48 jani Exp $ */
+/* $Id: file.c,v 1.547 2009/05/25 13:02:55 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -2360,6 +2360,15 @@
 
        array_init(return_value);
 
+       while (*p == ' ' || *p == '\t') {
+               p++;
+       }
+
+       if (*p == '\r' || *p == '\n') {
+               add_next_index_null(return_value);
+               goto end;
+       }
+
        while(p < e) {
                switch (state) {
                        case PHP_FGETCSV_READY:
@@ -2551,7 +2560,7 @@
                                break;
                }
        }
-
+end:
        if (stream) {
                efree(buffer);
        }
@@ -2568,6 +2577,15 @@
 
        array_init(return_value);
 
+       while (*p == ' ' || *p == '\t') {
+               p++;
+       }
+
+       if (*p == '\r' || *p == '\n') {
+               add_next_index_null(return_value);
+               goto end;
+       }
+
        while(p < e) {
                switch (state) {
                        case PHP_FGETCSV_READY:
@@ -2756,7 +2774,7 @@
                                break;
                }
        }
-
+end:
        if (stream) {
                efree(buffer);
        }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to