From 06efe44c2ebd1255676e00af4fc4002d6742e5f5 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Sun, 13 Oct 2024 02:02:23 +0200 Subject: [PATCH] Skip shebang in cli-server router script Fixes GH-16373 Closes GH-16403 --- NEWS | 4 ++++ sapi/cli/php_cli_server.c | 1 + 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 29b53c4b7ff..4b7b0cd0fa1 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 8.2.26 +- Cli: + . Fixed bug GH-16373 (Shebang is not skipped for router script in cli-server + started through shebang). (ilutov) + - COM: . Fixed out of bound writes to SafeArray data. (cmb) diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 732ac27c9a2..422576e96ab 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -2271,6 +2271,7 @@ static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server } ZVAL_UNDEF(&retval); + CG(skip_shebang) = true; if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE, &retval, 1, &zfd)) { if (Z_TYPE(retval) != IS_UNDEF) { decline = Z_TYPE(retval) == IS_FALSE;