]> granicus.if.org Git - php/commitdiff
MFH
authorIlia Alshanetsky <iliaa@php.net>
Wed, 8 Jan 2003 00:44:58 +0000 (00:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 8 Jan 2003 00:44:58 +0000 (00:44 +0000)
sapi/cgi/cgi_main.c
sapi/cli/php_cli.c

index e9b644a4a425620c55f5d9722d372059c60260d6..d9280d658e75412488d83c18a43235f95e0a4614 100644 (file)
@@ -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);
index 7fae3020b127aa16c850844dc6bab1d8cee59f4e..20a2b6bb368f65f4e976f37b72a88a9c522ff4dc 100644 (file)
@@ -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);