From: Wez Furlong Date: Tue, 24 Sep 2002 02:46:38 +0000 (+0000) Subject: Fix EOL markers for file() so that Mac EOL work correctly. X-Git-Tag: MODERN_SYMMETRIC_SESSION_BEHAVIOUR_20021003~212 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4cdf8c7c36c56bda0518a49bc594b653665f1883;p=php Fix EOL markers for file() so that Mac EOL work correctly. --- diff --git a/ext/standard/file.c b/ext/standard/file.c index 12d15a3b45..c19a0977bd 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -468,6 +468,7 @@ PHP_FUNCTION(file) char *slashed, *target_buf; register int i = 0; int target_len, len; + char eol_marker = '\n'; zend_bool use_include_path = 0; zend_bool reached_eof = 0; php_stream *stream; @@ -507,9 +508,14 @@ PHP_FUNCTION(file) reached_eof = 1; } } + + /* mini-hack because I don't feel like re-writing this whole function */ + if (stream->flags & PHP_STREAM_FLAG_EOL_MAC) + eol_marker = '\r'; + if (!reached_eof) { target_len += strlen(target_buf+target_len); - if (target_buf[target_len-1] != '\n') { + if (target_buf[target_len-1] != eol_marker) { continue; } }