diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-08-10 10:38:33 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-08-10 10:38:33 +0200 |
commit | 896dad4c794f7826812bcfdbaaa9f0b3518d9385 (patch) | |
tree | 6ccdc3ec130c5857463878992ee74ef2014fb046 /main | |
parent | 74c43818066585a5155c6c07b46b3d1727fd14b8 (diff) | |
download | php-git-896dad4c794f7826812bcfdbaaa9f0b3518d9385.tar.gz |
Fixed bug #77561
Unconditionally strip shebang lines when using the CLI SAPI,
independently of whether they occur in the primary or non-primary
script. It's unlikely that someone intentionally wants to print
that shebang line when including a script, and this regularly
causes issues when scripts are used in multiple contexts, e.g.
for direct invocation and as a phar bootstrap.
Diffstat (limited to 'main')
-rw-r--r-- | main/main.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/main/main.c b/main/main.c index b90484f159..390b08c4aa 100644 --- a/main/main.c +++ b/main/main.c @@ -2533,20 +2533,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file) zend_set_timeout(INI_INT("max_execution_time"), 0); } - /* - If cli primary file has shebang line and there is a prepend file, - the `skip_shebang` will be used by prepend file but not primary file, - save it and restore after prepend file been executed. - */ - if (CG(skip_shebang) && prepend_file_p) { - CG(skip_shebang) = 0; - if (zend_execute_scripts(ZEND_REQUIRE, NULL, 1, prepend_file_p) == SUCCESS) { - CG(skip_shebang) = 1; - retval = (zend_execute_scripts(ZEND_REQUIRE, NULL, 2, primary_file, append_file_p) == SUCCESS); - } - } else { - retval = (zend_execute_scripts(ZEND_REQUIRE, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS); - } + retval = (zend_execute_scripts(ZEND_REQUIRE, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS); } zend_end_try(); if (EG(exception)) { |