File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Bug #24773 (unset() of integers treated as arrays causes a crash)
6
6
unset($ array ["lvl1 " ]["lvl2 " ]["b " ]);
7
7
?>
8
8
--EXPECTF--
9
- Fatal error: Uncaught TypeError : Cannot access offset of type string in unset in %s:%d
9
+ Fatal error: Uncaught Error : Cannot unset string offsets in %s:%d
10
10
Stack trace:
11
11
#0 {main}
12
12
thrown in %s on line %d
Original file line number Diff line number Diff line change @@ -1728,7 +1728,12 @@ ZEND_API ZEND_COLD void zend_illegal_container_offset(const zend_string *contain
1728
1728
zend_zval_type_name (offset ));
1729
1729
return ;
1730
1730
case BP_VAR_UNSET :
1731
- zend_type_error ("Cannot access offset of type %s in unset" , zend_zval_type_name (offset ));
1731
+ /* Consistent error for when trying to unset a string offset */
1732
+ if (zend_string_equals (container , ZSTR_KNOWN (ZEND_STR_STRING ))) {
1733
+ zend_throw_error (NULL , "Cannot unset string offsets" );
1734
+ } else {
1735
+ zend_type_error ("Cannot access offset of type %s in unset" , zend_zval_type_name (offset ));
1736
+ }
1732
1737
return ;
1733
1738
default :
1734
1739
zend_type_error ("Cannot access offset of type %s on %s" ,
You can’t perform that action at this time.
0 commit comments