Skip to content

Commit f412bc6

Browse files
Girgiasiluuu1994
andcommitted
Fix Bug #81160: isset/empty doesn't throw a TypeError on invalid string offset
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
1 parent 6f95273 commit f412bc6

18 files changed

+985
-481
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5115,7 +5115,8 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op
51155115
return 0;
51165116
}
51175117
case ZEND_FETCH_IS:
5118-
return (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT));
5118+
return (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT))
5119+
|| (t1 & MAY_BE_STRING && t2 & MAY_BE_STRING);
51195120
case ZEND_ISSET_ISEMPTY_DIM_OBJ:
51205121
return (t1 & MAY_BE_OBJECT) || (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT));
51215122
case ZEND_FETCH_DIM_IS:

Zend/tests/bug60362.phpt

Lines changed: 0 additions & 75 deletions
This file was deleted.

Zend/tests/bug62680.phpt

Lines changed: 0 additions & 11 deletions
This file was deleted.

Zend/tests/bug69889.phpt

Lines changed: 0 additions & 21 deletions
This file was deleted.

Zend/tests/empty_str_offset.phpt

Lines changed: 0 additions & 135 deletions
This file was deleted.

Zend/tests/isset_str_offset.phpt

Lines changed: 0 additions & 129 deletions
This file was deleted.

0 commit comments

Comments
 (0)