Skip to content

Commit 8b2b856

Browse files
committed
Remove some unnecessary zend_delete_global_variable uses
1 parent 792f8fb commit 8b2b856

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

ext/spl/spl_array.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,9 @@ static void spl_array_unset_dimension_ex(int check_inherited, zend_object *objec
532532
switch (Z_TYPE_P(offset)) {
533533
case IS_STRING:
534534
ht = spl_array_get_hash_table(intern);
535-
if (ht == &EG(symbol_table)) {
536-
if (zend_delete_global_variable(Z_STR_P(offset))) {
537-
zend_error(E_WARNING,"Undefined array key \"%s\"", Z_STRVAL_P(offset));
538-
}
539-
} else {
540-
zval *data = zend_symtable_find(ht, Z_STR_P(offset));
541535

536+
{
537+
zval *data = zend_symtable_find(ht, Z_STR_P(offset));
542538
if (data) {
543539
if (Z_TYPE_P(data) == IS_INDIRECT) {
544540
data = Z_INDIRECT_P(data);

ext/standard/array.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2986,15 +2986,10 @@ static void php_splice(HashTable *in_hash, zend_long offset, zend_long length, H
29862986
Z_TRY_ADDREF_P(entry);
29872987
if (p->key == NULL) {
29882988
zend_hash_next_index_insert_new(removed, entry);
2989-
zend_hash_del_bucket(in_hash, p);
29902989
} else {
29912990
zend_hash_add_new(removed, p->key, entry);
2992-
if (in_hash == &EG(symbol_table)) {
2993-
zend_delete_global_variable(p->key);
2994-
} else {
2995-
zend_hash_del_bucket(in_hash, p);
2996-
}
29972991
}
2992+
zend_hash_del_bucket(in_hash, p);
29982993
}
29992994
} else { /* otherwise just skip those entries */
30002995
int pos2 = pos;
@@ -3003,11 +2998,7 @@ static void php_splice(HashTable *in_hash, zend_long offset, zend_long length, H
30032998
p = in_hash->arData + idx;
30042999
if (Z_TYPE(p->val) == IS_UNDEF) continue;
30053000
pos2++;
3006-
if (p->key && in_hash == &EG(symbol_table)) {
3007-
zend_delete_global_variable(p->key);
3008-
} else {
3009-
zend_hash_del_bucket(in_hash, p);
3010-
}
3001+
zend_hash_del_bucket(in_hash, p);
30113002
}
30123003
}
30133004
iter_pos = zend_hash_iterators_lower_pos(in_hash, iter_pos);
@@ -4444,11 +4435,7 @@ PHP_FUNCTION(array_unique)
44444435
if (p->key == NULL) {
44454436
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
44464437
} else {
4447-
if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) {
4448-
zend_delete_global_variable(p->key);
4449-
} else {
4450-
zend_hash_del(Z_ARRVAL_P(return_value), p->key);
4451-
}
4438+
zend_hash_del(Z_ARRVAL_P(return_value), p->key);
44524439
}
44534440
}
44544441
}

0 commit comments

Comments
 (0)