Commit e5a723e8387 for php.net
commit e5a723e83873d1cc6b72a19d163c55fbefc37a80
Author: Ilija Tovilo <ilija.tovilo@me.com>
Date: Wed Mar 25 19:38:00 2026 +0100
Avoid goto into zend_try block in do_cli()
We must not jump into a zend_try block because that skips setting up of
EG(bailout), which will deref null when trying to bailout. In practice, this bug
is impossible to trigger, given php_execute_script() already guards against
bailout.
Fixes GH-21420
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index d1781eab671..ca5cc91219b 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -867,8 +867,10 @@ static int do_cli(int argc, char **argv) /* {{{ */
fprintf(stdout, "Executing for the first time...\n");
fflush(stdout);
}
+ } zend_end_try();
do_repeat:
+ zend_try {
/* only set script_file if not set already and not in direct mode and not at end of parameter list */
if (argc > php_optind
&& !script_file