From a20fdbfe152366f6f7f8f7e991ca94017e611d03 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Fri, 29 Apr 2022 22:34:00 +0200 Subject: [PATCH] Do not optimize out ini_get() when the entry does not exist during compilation The entry may exist later if dl is enabled --- Zend/Optimizer/sccp.c | 4 ++++ ext/opcache/tests/gh8466.phpt | 23 +++++++++++++++++++ .../tests/general_functions/dl-001.phpt | 5 ++-- .../tests/general_functions/dl-002.phpt | 5 ++-- .../tests/general_functions/dl-003.phpt | 5 ++-- 5 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 ext/opcache/tests/gh8466.phpt diff --git a/Zend/Optimizer/sccp.c b/Zend/Optimizer/sccp.c index 891b1f0982d5a..54333baaafc98 100644 --- a/Zend/Optimizer/sccp.c +++ b/Zend/Optimizer/sccp.c @@ -17,6 +17,7 @@ +----------------------------------------------------------------------+ */ +#include "php.h" #include "zend_API.h" #include "zend_exceptions.h" #include "zend_ini.h" @@ -908,6 +909,9 @@ static inline int ct_eval_func_call( ini_entry = zend_hash_find_ptr(EG(ini_directives), Z_STR_P(args[0])); if (!ini_entry) { + if (PG(enable_dl)) { + return FAILURE; + } ZVAL_FALSE(result); } else if (ini_entry->modifiable != ZEND_INI_SYSTEM) { return FAILURE; diff --git a/ext/opcache/tests/gh8466.phpt b/ext/opcache/tests/gh8466.phpt new file mode 100644 index 0000000000000..a85a39f549977 --- /dev/null +++ b/ext/opcache/tests/gh8466.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug GH-8466: ini_get() is optimized out when the option does not exist during compilation +--SKIPIF-- + +--FILE-- +