Skip to content

Commit f47b7f1

Browse files
authored
Cleanup name handling in magic methods (php#13733)
The copy was introduced in bc59289, and later changed in 5752745, to prevent indirect modifications of magic method arguments. This is no longer necessary because we no longer deal with zvals, but with string directly that the VM has retrieved either as a constant, or via zval_try_get_tmp_string().
1 parent 805326f commit f47b7f1

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

Zend/zend_object_handlers.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,6 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int
610610
uintptr_t property_offset;
611611
const zend_property_info *prop_info = NULL;
612612
uint32_t *guard = NULL;
613-
zend_string *tmp_name = NULL;
614613

615614
#if DEBUG_OBJECT_HANDLERS
616615
fprintf(stderr, "Read object #%d property: %s\n", zobj->handle, ZSTR_VAL(name));
@@ -692,9 +691,6 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int
692691
guard = zend_get_property_guard(zobj, name);
693692

694693
if (!((*guard) & IN_ISSET)) {
695-
if (!tmp_name && !ZSTR_IS_INTERNED(name)) {
696-
tmp_name = zend_string_copy(name);
697-
}
698694
GC_ADDREF(zobj);
699695
ZVAL_UNDEF(&tmp_result);
700696

@@ -769,8 +765,6 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int
769765
retval = &EG(uninitialized_zval);
770766

771767
exit:
772-
zend_tmp_string_release(tmp_name);
773-
774768
return retval;
775769
}
776770
/* }}} */
@@ -1822,7 +1816,6 @@ ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has
18221816
zval *value = NULL;
18231817
uintptr_t property_offset;
18241818
const zend_property_info *prop_info = NULL;
1825-
zend_string *tmp_name = NULL;
18261819

18271820
property_offset = zend_get_property_offset(zobj->ce, name, 1, cache_slot, &prop_info);
18281821

@@ -1887,9 +1880,6 @@ ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has
18871880
zval rv;
18881881

18891882
/* have issetter - try with it! */
1890-
if (!tmp_name && !ZSTR_IS_INTERNED(name)) {
1891-
tmp_name = zend_string_copy(name);
1892-
}
18931883
GC_ADDREF(zobj);
18941884
(*guard) |= IN_ISSET; /* prevent circular getting */
18951885
zend_std_call_issetter(zobj, name, &rv);
@@ -1912,7 +1902,6 @@ ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has
19121902
}
19131903

19141904
exit:
1915-
zend_tmp_string_release(tmp_name);
19161905
return result;
19171906
}
19181907
/* }}} */

0 commit comments

Comments
 (0)