Skip to content

Commit 1299207

Browse files
committed
Unset
1 parent a72c150 commit 1299207

File tree

2 files changed

+56
-14
lines changed

2 files changed

+56
-14
lines changed

Zend/zend_vm_def.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6649,8 +6649,14 @@ ZEND_VM_C_LABEL(num_index_dim):
66496649
if (OP2_TYPE == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
66506650
offset++;
66516651
}
6652-
// TODO Unset no default handler
6653-
Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
6652+
zend_class_entry *ce = Z_OBJCE_P(container);
6653+
// TODO Check ce implements interface
6654+
if (ce->dimension_handlers && ce->dimension_handlers->unset_dimension) {
6655+
ce->dimension_handlers->unset_dimension(Z_OBJ_P(container), offset);
6656+
} else {
6657+
// TODO Slow function which is never inlined?
6658+
zend_throw_error(NULL, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
6659+
}
66546660
} else if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
66556661
zend_throw_error(NULL, "Cannot unset string offsets");
66566662
} else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) {

Zend/zend_vm_execute.h

Lines changed: 48 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)