diff options
Diffstat (limited to 'sapi/cli/php_cli.c')
-rw-r--r-- | sapi/cli/php_cli.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index a98865f531..412180b577 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -695,6 +695,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(start_lineno) = 2; } else { rewind(file_handle.handle.fp); |