File tree Expand file tree Collapse file tree 2 files changed +11
-19
lines changed
Expand file tree Collapse file tree 2 files changed +11
-19
lines changed Original file line number Diff line number Diff line change @@ -641,26 +641,11 @@ PHP_FUNCTION(file)
641641 p ++ ;
642642parse_eol :
643643 if (skip_blank_lines ) {
644- size_t eol_len = 1 ;
645-
646- if (eol_marker == '\n' ) {
647- if (p - ZSTR_VAL (target_buf ) >= 2 && * (p - 2 ) == '\r' && * (p - 1 ) == '\n' ) {
648- eol_len = 2 ;
649- } else if (p == e && p > s ) {
650- const char * check = p - 1 ;
651- while (check > s && * check == '\r' ) {
652- check -- ;
653- }
654- if (check == s && * check == '\r' ) {
655- s = p ;
656- continue ;
657- }
658- eol_len = 1 ;
659- }
644+ const char * c = s ;
645+ while (c < p && (* c == '\n' || * c == '\r' )) {
646+ c ++ ;
660647 }
661-
662- size_t line_len = p - s ;
663- if (line_len == eol_len ) {
648+ if (c == p ) {
664649 s = p ;
665650 continue ;
666651 }
Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ var_dump($lines);
4343file_put_contents ($ test_file , "\r\n" );
4444$ lines = file ($ test_file , FILE_SKIP_EMPTY_LINES );
4545var_dump ($ lines );
46+
47+ file_put_contents ($ test_file , "\r\r\n\n" );
48+ $ lines = file ($ test_file , FILE_SKIP_EMPTY_LINES );
49+ var_dump ($ lines );
50+
4651?>
4752--CLEAN--
4853<?php unlink (__DIR__ . "/file_skip_empty_lines.tmp " ); ?>
@@ -122,3 +127,5 @@ array(0) {
122127}
123128array(0) {
124129}
130+ array(0) {
131+ }
You can’t perform that action at this time.
0 commit comments