diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2003-01-08 00:44:58 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2003-01-08 00:44:58 +0000 |
| commit | 7a16fdbd27903c5b91dcab88868a04555d269a4a (patch) | |
| tree | bc32617151b3e71b2b634353d52ecba5c72845c3 | |
| parent | 4978b31363e03d124a0d60271fb91749928521d3 (diff) | |
| download | php-git-7a16fdbd27903c5b91dcab88868a04555d269a4a.tar.gz | |
MFH
| -rw-r--r-- | sapi/cgi/cgi_main.c | 7 | ||||
| -rw-r--r-- | sapi/cli/php_cli.c | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index e9b644a4a4..d9280d658e 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1413,6 +1413,13 @@ consult the installation file that came with this distribution, or visit \n\ while (c != 10 && c != 13) { c = fgetc(file_handle.handle.fp); /* skip to end of line */ } + /* handle situations where line is terminated by \r\n */ + if (c == 13) { + if (fgetc(file_handle.handle.fp) != 10) { + long pos = ftell(file_handle.handle.fp); + fseek(file_handle.handle.fp, pos - 1, SEEK_SET); + } + } CG(zend_lineno) = -2; } else { rewind(file_handle.handle.fp); diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 7fae3020b1..20a2b6bb36 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -697,6 +697,13 @@ int main(int argc, char *argv[]) while (c != 10 && c != 13) { c = fgetc(file_handle.handle.fp); /* skip to end of line */ } + /* handle situations where line is terminated by \r\n */ + if (c == 13) { + if (fgetc(file_handle.handle.fp) != 10) { + long pos = ftell(file_handle.handle.fp); + fseek(file_handle.handle.fp, pos - 1, SEEK_SET); + } + } CG(zend_lineno) = -2; } else { rewind(file_handle.handle.fp); |
