From e40a6fcf3bb778c18740c251b71414eb1ea2f4f8 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sat, 17 Dec 2022 16:02:55 +0100 Subject: [PATCH 1/2] Initialize ping_auto_globals_mask to prevent undefined behaviour --- ext/opcache/ZendAccelerator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index e5d7f650045c..99bb33573f3b 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -4444,6 +4444,8 @@ static int accel_preload(const char *config, bool in_child) if (PG(auto_globals_jit)) { ping_auto_globals_mask = zend_accel_get_auto_globals(); + } else { + ping_auto_globals_mask = 0; } if (EG(zend_constants)) { From f5d1b7c70384ab85ac0000fe46c91539c9f92626 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 18 Dec 2022 14:16:01 +0100 Subject: [PATCH 2/2] Add a regression test for auto_globals_jit=0 with preloading on --- .../tests/preloading_no_auto_globals_jit.inc | 6 ++++++ .../tests/preloading_no_auto_globals_jit.phpt | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 ext/opcache/tests/preloading_no_auto_globals_jit.inc create mode 100644 ext/opcache/tests/preloading_no_auto_globals_jit.phpt diff --git a/ext/opcache/tests/preloading_no_auto_globals_jit.inc b/ext/opcache/tests/preloading_no_auto_globals_jit.inc new file mode 100644 index 000000000000..ad80df7733d1 --- /dev/null +++ b/ext/opcache/tests/preloading_no_auto_globals_jit.inc @@ -0,0 +1,6 @@ + +--FILE-- +count_global_server()); +?> +--EXPECTF-- +int(%d)