summaryrefslogtreecommitdiff
path: root/ext/opcache
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-11-27 10:51:57 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-11-27 10:51:57 +0100
commit48ff654fb98dad6dd4ff7d0dd4f5fdab8dc7df3b (patch)
tree366fb11334f81d2b58af1a54a8af067d83083f22 /ext/opcache
parentc61390cfb45fea97af8ba631f5970f4330f76a2a (diff)
downloadphp-git-48ff654fb98dad6dd4ff7d0dd4f5fdab8dc7df3b.tar.gz
Fixed bug #80433
Use ZEND_STRTOL to allow leading zeros in opcache.jit option.
Diffstat (limited to 'ext/opcache')
-rw-r--r--ext/opcache/jit/zend_jit.c8
-rw-r--r--ext/opcache/tests/jit/ini_leading_zero.phpt12
2 files changed, 16 insertions, 4 deletions
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
index 32df2e41b3..9d17f17474 100644
--- a/ext/opcache/jit/zend_jit.c
+++ b/ext/opcache/jit/zend_jit.c
@@ -4079,8 +4079,6 @@ static int zend_jit_parse_config_num(zend_long jit)
ZEND_EXT_API int zend_jit_config(zend_string *jit, int stage)
{
- zend_ulong num;
-
if (stage != ZEND_INI_STAGE_STARTUP && !JIT_G(enabled)) {
if (stage == ZEND_INI_STAGE_RUNTIME) {
zend_error(E_WARNING, "Cannot change opcache.jit setting at run-time (JIT is disabled)");
@@ -4118,8 +4116,10 @@ ZEND_EXT_API int zend_jit_config(zend_string *jit, int stage)
JIT_G(trigger) = ZEND_JIT_ON_SCRIPT_LOAD;
JIT_G(opt_flags) = ZEND_JIT_REG_ALLOC_GLOBAL | ZEND_JIT_CPU_AVX;
return SUCCESS;
- } else if (ZEND_HANDLE_NUMERIC(jit, num)) {
- if (zend_jit_parse_config_num((zend_long)num) != SUCCESS) {
+ } else {
+ char *end;
+ zend_long num = ZEND_STRTOL(ZSTR_VAL(jit), &end, 10);
+ if (end != ZSTR_VAL(jit) + ZSTR_LEN(jit) || zend_jit_parse_config_num(num) != SUCCESS) {
goto failure;
}
JIT_G(enabled) = 1;
diff --git a/ext/opcache/tests/jit/ini_leading_zero.phpt b/ext/opcache/tests/jit/ini_leading_zero.phpt
new file mode 100644
index 0000000000..5e9d38d409
--- /dev/null
+++ b/ext/opcache/tests/jit/ini_leading_zero.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Leading zero in opcache.jit option
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.jit=0205
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+===DONE===
+--EXPECT--
+===DONE===