]> granicus.if.org Git - php/commitdiff
Fixed bug #80433
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 27 Nov 2020 09:51:57 +0000 (10:51 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 27 Nov 2020 09:51:57 +0000 (10:51 +0100)
Use ZEND_STRTOL to allow leading zeros in opcache.jit option.

NEWS
ext/opcache/jit/zend_jit.c
ext/opcache/tests/jit/ini_leading_zero.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index dc16cf7deb7bf507579692c41eeb638166e045d0..8ad31db07b1ee68d1404f14945b669582d127bc7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,8 @@ PHP                                                                        NEWS
   . Fixed bug #80404 (Incorrect range inference result when division results
     in float). (Nikita)
   . Fixed bug #80377 (Opcache misses executor_globals). (Nikita)
+  . Fixed bug #80433 (         Unable to disable the use of the AVX command when using
+    JIT). (Nikita)
 
 - Standard:
   . Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb)
index 32df2e41b3d46f930841598a41180519dbb75e06..9d17f174740bc586dc7b8c65f776c1ece01b7e1d 100644 (file)
@@ -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 (file)
index 0000000..5e9d38d
--- /dev/null
@@ -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===