1
0
mirror of https://github.com/php/php-src.git synced 2026-04-10 17:43:13 +02:00

- Make unset consistent with the way array offsets work

This commit is contained in:
Andi Gutmans
2000-06-09 13:07:26 +00:00
parent e346a6b538
commit a712da5cee

View File

@@ -2159,17 +2159,32 @@ send_by_ref:
ht = NULL;
break;
}
if (ht) {
if (ht) {
switch (offset->type) {
case IS_DOUBLE:
case IS_RESOURCE:
case IS_BOOL:
case IS_LONG:
zend_hash_index_del(ht, offset->value.lval);
break;
case IS_NULL:
zend_hash_del(ht,"",1);
break;
{
long index;
if (offset->type == IS_DOUBLE) {
index = (long) offset->value.lval;
} else {
index = offset->value.lval;
}
zend_hash_index_del(ht, index);
break;
}
case IS_STRING:
zend_hash_del(ht, offset->value.str.val, offset->value.str.len+1);
break;
case IS_NULL:
zend_hash_del(ht, "", sizeof(""));
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
break;
}
}
} else {