summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-06-27 22:13:41 +0000
committerFelipe Pena <felipe@php.net>2010-06-27 22:13:41 +0000
commit22e2302e787e9b876f87effd21ff36c41e77d707 (patch)
tree364dd51aeb9929f62202f42f913762652bfc6071 /sapi
parent3396a6d18522f26d315e2ee59c130d02e2ae14b2 (diff)
downloadphp-git-22e2302e787e9b876f87effd21ff36c41e77d707.tar.gz
- Improved initialization
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cgi/cgi_main.c2
-rw-r--r--sapi/cli/php_cli.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index e5d3dba575..ab6e5edff7 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -2079,6 +2079,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);
@@ -2096,7 +2097,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);
}
}
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index c071b4dc65..cde66d1e15 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -655,7 +655,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);
}
@@ -1089,6 +1088,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;
@@ -1328,6 +1328,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;