Skip to content

Commit 48ff654

Browse files
committed
Fixed bug #80433
Use ZEND_STRTOL to allow leading zeros in opcache.jit option.
1 parent c61390c commit 48ff654

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ PHP NEWS
2020
. Fixed bug #80404 (Incorrect range inference result when division results
2121
in float). (Nikita)
2222
. Fixed bug #80377 (Opcache misses executor_globals). (Nikita)
23+
. Fixed bug #80433 ( Unable to disable the use of the AVX command when using
24+
JIT). (Nikita)
2325

2426
- Standard:
2527
. Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb)

ext/opcache/jit/zend_jit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4079,8 +4079,6 @@ static int zend_jit_parse_config_num(zend_long jit)
40794079

40804080
ZEND_EXT_API int zend_jit_config(zend_string *jit, int stage)
40814081
{
4082-
zend_ulong num;
4083-
40844082
if (stage != ZEND_INI_STAGE_STARTUP && !JIT_G(enabled)) {
40854083
if (stage == ZEND_INI_STAGE_RUNTIME) {
40864084
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)
41184116
JIT_G(trigger) = ZEND_JIT_ON_SCRIPT_LOAD;
41194117
JIT_G(opt_flags) = ZEND_JIT_REG_ALLOC_GLOBAL | ZEND_JIT_CPU_AVX;
41204118
return SUCCESS;
4121-
} else if (ZEND_HANDLE_NUMERIC(jit, num)) {
4122-
if (zend_jit_parse_config_num((zend_long)num) != SUCCESS) {
4119+
} else {
4120+
char *end;
4121+
zend_long num = ZEND_STRTOL(ZSTR_VAL(jit), &end, 10);
4122+
if (end != ZSTR_VAL(jit) + ZSTR_LEN(jit) || zend_jit_parse_config_num(num) != SUCCESS) {
41234123
goto failure;
41244124
}
41254125
JIT_G(enabled) = 1;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Leading zero in opcache.jit option
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit=0205
7+
--SKIPIF--
8+
<?php require_once('skipif.inc'); ?>
9+
--FILE--
10+
===DONE===
11+
--EXPECT--
12+
===DONE===

0 commit comments

Comments
 (0)