From: Ilia Alshanetsky Date: Tue, 22 Oct 2002 15:34:50 +0000 (+0000) Subject: When doing automatic line end detection, pick the line end that is found X-Git-Tag: php-4.3.0pre2~195 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5d34272516754c8970a0f465341a8dd7d6b5b2a;p=php When doing automatic line end detection, pick the line end that is found first. --- 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;