Commit 336954a2f54 for php
commit 336954a2f54b48e82499de6807a772d8e07cab7c
Author: Alexander Danilov <10532067+adapik@users.noreply.github.com>
Date: Tue Nov 24 23:32:09 2026 +0200
opcache: Use ZEND_HANDLE_NUMERIC in JIT symtable helpers (#25715)
diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c
index 2fa48320c50..d9b91d299f5 100644
--- a/ext/opcache/jit/zend_jit_helpers.c
+++ b/ext/opcache/jit/zend_jit_helpers.c
@@ -309,24 +309,10 @@ static zend_execute_data* ZEND_FASTCALL zend_jit_int_extend_stack_helper(uint32_
static zval* ZEND_FASTCALL zend_jit_symtable_find(HashTable *ht, zend_string *str)
{
zend_ulong idx;
- register const char *tmp = ZSTR_VAL(str);
- do {
- if (*tmp > '9') {
- break;
- } else if (*tmp < '0') {
- if (*tmp != '-') {
- break;
- }
- tmp++;
- if (*tmp > '9' || *tmp < '0') {
- break;
- }
- }
- if (_zend_handle_numeric_str_ex(ZSTR_VAL(str), ZSTR_LEN(str), &idx)) {
- return zend_hash_index_find(ht, idx);
- }
- } while (0);
+ if (ZEND_HANDLE_NUMERIC(str, idx)) {
+ return zend_hash_index_find(ht, idx);
+ }
return zend_hash_find(ht, str);
}
@@ -367,29 +353,15 @@ static zval* ZEND_FASTCALL zend_jit_hash_lookup_rw(HashTable *ht, zend_string *s
static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_string *str)
{
zend_ulong idx;
- register const char *tmp = ZSTR_VAL(str);
zval *retval;
- do {
- if (*tmp > '9') {
- break;
- } else if (*tmp < '0') {
- if (*tmp != '-') {
- break;
- }
- tmp++;
- if (*tmp > '9' || *tmp < '0') {
- break;
- }
+ if (ZEND_HANDLE_NUMERIC(str, idx)) {
+ retval = zend_hash_index_find(ht, idx);
+ if (!retval) {
+ retval = zend_undefined_offset_write(ht, idx);
}
- if (_zend_handle_numeric_str_ex(ZSTR_VAL(str), ZSTR_LEN(str), &idx)) {
- retval = zend_hash_index_find(ht, idx);
- if (!retval) {
- retval = zend_undefined_offset_write(ht, idx);
- }
- return retval;
- }
- } while (0);
+ return retval;
+ }
retval = zend_hash_find(ht, str);
if (!retval) {
@@ -402,24 +374,10 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_strin
static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string *str)
{
zend_ulong idx;
- register const char *tmp = ZSTR_VAL(str);
- do {
- if (*tmp > '9') {
- break;
- } else if (*tmp < '0') {
- if (*tmp != '-') {
- break;
- }
- tmp++;
- if (*tmp > '9' || *tmp < '0') {
- break;
- }
- }
- if (_zend_handle_numeric_str_ex(ZSTR_VAL(str), ZSTR_LEN(str), &idx)) {
- return zend_hash_index_lookup(ht, idx);
- }
- } while (0);
+ if (ZEND_HANDLE_NUMERIC(str, idx)) {
+ return zend_hash_index_lookup(ht, idx);
+ }
return zend_hash_lookup(ht, str);
}