From a5d34272516754c8970a0f465341a8dd7d6b5b2a Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Tue, 22 Oct 2002 15:34:50 +0000 Subject: [PATCH] When doing automatic line end detection, pick the line end that is found first. --- main/streams.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/streams.c b/main/streams.c index e288445b3b..d5e3123052 100755 --- a/main/streams.c +++ b/main/streams.c @@ -644,8 +644,8 @@ PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len if (stream->flags & PHP_STREAM_FLAG_DETECT_EOL) { cr = memchr(readptr, '\r', avail); lf = memchr(readptr, '\n', avail); - - if (cr && lf != cr + 1) { + + if (cr && lf != cr + 1 && !(lf && lf < cr)) { /* mac */ stream->flags ^= PHP_STREAM_FLAG_DETECT_EOL; stream->flags |= PHP_STREAM_FLAG_EOL_MAC; -- 2.50.1