]> granicus.if.org Git - php/commitdiff
- Improved initialization
authorFelipe Pena <felipe@php.net>
Sun, 27 Jun 2010 22:13:41 +0000 (22:13 +0000)
committerFelipe Pena <felipe@php.net>
Sun, 27 Jun 2010 22:13:41 +0000 (22:13 +0000)
sapi/cgi/cgi_main.c
sapi/cli/php_cli.c

index 09c5b1fd1d80d8dea10db77cd589c1edc86d93fe..e7b987459148ab887f9505d14dfccc821795d8ee 100644 (file)
@@ -2084,6 +2084,7 @@ consult the installation file that came with this distribution, or visit \n\
                                }
                        }
 
+                       CG(shebang_len) = 0;
                        if (CGIG(check_shebang_line) && file_handle.handle.fp && (file_handle.handle.fp != stdin)) {
                                /* #!php support */
                                c = fgetc(file_handle.handle.fp);
@@ -2101,7 +2102,6 @@ consult the installation file that came with this distribution, or visit \n\
                                        CG(shebang_len) = ftell(file_handle.handle.fp);
                                        CG(start_lineno) = 2;
                                } else {
-                                       CG(shebang_len) = 0;
                                        rewind(file_handle.handle.fp);
                                }
                        }
index cf2d2d55823e42367657cbf5561d83249814070f..d303f80756c83830c9e585d1371b212d45592b52 100644 (file)
@@ -630,7 +630,6 @@ static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file,
                CG(shebang_len) = ftell(file_handle->handle.fp);
                *lineno = 2;
        } else {
-               CG(shebang_len) = 0;
                rewind(file_handle->handle.fp);
        }
 
@@ -1060,6 +1059,7 @@ int main(int argc, char *argv[])
                        script_file=argv[php_optind];
                        php_optind++;
                }
+               CG(shebang_len) = 0;
                if (script_file) {
                        if (cli_seek_file_begin(&file_handle, script_file, &lineno TSRMLS_CC) != SUCCESS) {
                                goto err;
@@ -1268,6 +1268,7 @@ int main(int argc, char *argv[])
                                                        exit_status=254;
                                                }
                                        } else {
+                                               CG(shebang_len) = 0;
                                                if (script_file) {
                                                        if (cli_seek_file_begin(&file_handle, script_file, &lineno TSRMLS_CC) != SUCCESS) {
                                                                exit_status = 1;