Skip to content

Commit 7db1904

Browse files
committed
jit: fix Uninitialized string offset warning being emitted
The offset is an invalid type and should return early
1 parent 59ac77f commit 7db1904

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Zend/tests/offsets/strings/const_dimension/object_offset_behaviour.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Object offset behaviour
33
--XFAIL--
4-
Uninitialized string offset warning on read is emitted with const offset
4+
Object of class stdClass could not be converted to int warning with const offset in JIT
55
--FILE--
66
<?php
77

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,9 @@ static zend_string* ZEND_FASTCALL zend_jit_fetch_dim_str_r_helper(zend_string *s
10981098
} else {
10991099
offset = Z_LVAL_P(dim);
11001100
}
1101+
if (UNEXPECTED(EG(exception) != NULL)) {
1102+
return ZSTR_EMPTY_ALLOC();
1103+
}
11011104
return zend_jit_fetch_dim_str_offset(str, offset);
11021105
}
11031106

0 commit comments

Comments
 (0)