Skip to content

Commit

Permalink
Unset
Browse files Browse the repository at this point in the history
  • Loading branch information
Girgias committed Feb 6, 2024
1 parent f7291a2 commit 9f3c3ee
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 14 deletions.
10 changes: 8 additions & 2 deletions Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -6649,8 +6649,14 @@ ZEND_VM_C_LABEL(num_index_dim):
if (OP2_TYPE == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
// TODO Unset no default handler
Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
zend_class_entry *ce = Z_OBJCE_P(container);
// TODO Check ce implements interface
if (ce->dimension_handlers && ce->dimension_handlers->unset_dimension) {
ce->dimension_handlers->unset_dimension(Z_OBJ_P(container), offset);
} else {
// TODO Slow function which is never inlined?
zend_throw_error(NULL, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
}
} else if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
} else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) {
Expand Down
60 changes: 48 additions & 12 deletions Zend/zend_vm_execute.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9f3c3ee

Please sign in to comment.