iliaa           Tue Apr 15 15:48:20 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/standard       file.c 
    /php-src    NEWS 
  Log:
  MFB: Fixed bug #44034 (FILE_IGNORE_NEW_LINES in file() does not work as
  expected when lines end in \r\n)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.11&r2=1.409.2.6.2.28.2.12&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.11 
php-src/ext/standard/file.c:1.409.2.6.2.28.2.12
--- php-src/ext/standard/file.c:1.409.2.6.2.28.2.11     Sun Mar 30 15:05:48 2008
+++ php-src/ext/standard/file.c Tue Apr 15 15:48:20 2008
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: file.c,v 1.409.2.6.2.28.2.11 2008/03/30 15:05:48 iliaa Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.28.2.12 2008/04/15 15:48:20 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -775,16 +775,20 @@
                        } while ((p = memchr(p, eol_marker, (e-p))));
                } else {
                        do {
-                               if (skip_blank_lines && !(p-s)) {
+                               int windows_eol = 0;
+                               if (eol_marker == '\n' && *(p - 1) == '\r') {
+                                       windows_eol++;
+                               }
+                               if (skip_blank_lines && !(p-s-windows_eol)) {
                                        s = ++p;
                                        continue;
                                }
                                if (PG(magic_quotes_runtime)) {
                                        /* s is in target_buf which is freed at 
the end of the function */
-                                       slashed = php_addslashes(s, (p-s), 
&len, 0 TSRMLS_CC);
+                                       slashed = php_addslashes(s, 
(p-s-windows_eol), &len, 0 TSRMLS_CC);
                                        add_index_stringl(return_value, i++, 
slashed, len, 0);
                                } else {
-                                       add_index_stringl(return_value, i++, 
estrndup(s, p-s), p-s, 0);
+                                       add_index_stringl(return_value, i++, 
estrndup(s, p-s-windows_eol), p-s-windows_eol, 0);
                                }
                                s = ++p;
                        } while ((p = memchr(p, eol_marker, (e-p))));
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.158&r2=1.2027.2.547.2.965.2.159&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.158 
php-src/NEWS:1.2027.2.547.2.965.2.159
--- php-src/NEWS:1.2027.2.547.2.965.2.158       Mon Apr 14 08:15:11 2008
+++ php-src/NEWS        Tue Apr 15 15:48:20 2008
@@ -158,6 +158,8 @@
   (Derick, iuri dot fiedoruk at hp dot com).
 - Fixed bug #44214 (Crash using preg_replace_callback() and global variable).
   (Nuno, Scott)
+- Fixed bug #44034 (FILE_IGNORE_NEW_LINES in file() does not work as expected
+  when lines end in \r\n). (Ilia)
 - Fixed bug #43960 (strtotime() returns timestamp in the future when given a
   bogus string). (Derick)
 - Fixed bug #43832 (mysqli_get_charset() doesn't expose charset comment).



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

Reply via email to