summaryrefslogtreecommitdiff
path: root/Zend/zend_object_handlers.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_object_handlers.c')
-rw-r--r--Zend/zend_object_handlers.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index c77754fe46..f316bc81d4 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -475,20 +475,24 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf
}
/* }}} */
+static void zend_property_guard_dtor(zval *el) /* {{{ */ {
+ efree(Z_PTR_P(el));
+}
+/* }}} */
+
static zend_long *zend_get_property_guard(zend_object *zobj, zend_string *member) /* {{{ */
{
- zval stub, *guard;
+ zend_long stub, *guard;
if (!zobj->guards) {
ALLOC_HASHTABLE(zobj->guards);
- zend_hash_init(zobj->guards, 8, NULL, NULL, 0);
- } else if ((guard = zend_hash_find(zobj->guards, member)) != NULL) {
- return &Z_LVAL_P(guard);
+ zend_hash_init(zobj->guards, 8, NULL, zend_property_guard_dtor, 0);
+ } else if ((guard = (zend_long *)zend_hash_find_ptr(zobj->guards, member)) != NULL) {
+ return guard;
}
- ZVAL_LONG(&stub, 0);
- guard = zend_hash_add_new(zobj->guards, member, &stub);
- return &Z_LVAL_P(guard);
+ stub = 0;
+ return (zend_long *)zend_hash_add_mem(zobj->guards, member, &stub, sizeof(zend_ulong));
}
/* }}} */