Skip to content

Commit 2520bfc

Browse files
committed
More fixes
1 parent 7cd8bc2 commit 2520bfc

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

php_phongo.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,14 @@ zend_object_handlers* phongo_get_std_object_handlers(void);
6868

6969
#define PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_temp, intern, props, size) \
7070
do { \
71-
if (!(intern)->php_properties) { \
72-
ALLOC_HASHTABLE((intern)->php_properties); \
73-
zend_hash_init((intern)->php_properties, 0, NULL, ZVAL_PTR_DTOR, 0); \
74-
GC_ADDREF((intern)->php_properties); \
75-
} \
7671
if (is_temp) { \
77-
(props) = zend_array_dup((intern)->php_properties); \
72+
ALLOC_HASHTABLE(props); \
73+
zend_hash_init((props), (size), NULL, ZVAL_PTR_DTOR, 0); \
74+
} else if ((intern)->properties) { \
75+
(props) = (intern)->properties; \
7876
} else { \
79-
(props) = zend_array_dup((intern)->php_properties); \
80-
if ((intern)->properties) { \
81-
HashTable *__tmp = (intern)->properties; \
82-
(intern)->properties = NULL; \
83-
zend_hash_release(__tmp); \
84-
} \
77+
ALLOC_HASHTABLE(props); \
78+
zend_hash_init((props), (size), NULL, ZVAL_PTR_DTOR, 0); \
8579
(intern)->properties = (props); \
8680
} \
8781
} while (0)
@@ -102,7 +96,11 @@ zend_object_handlers* phongo_get_std_object_handlers(void);
10296
zend_hash_init(props, 0, NULL, ZVAL_PTR_DTOR, 0); \
10397
_intern_extractor(zobj)->php_properties = props; \
10498
} \
105-
return zend_hash_find(props, member); \
99+
zval *ret = zend_hash_find(props, member); \
100+
if (ret) { \
101+
return ret; \
102+
} \
103+
return &EG(uninitialized_zval); \
106104
} \
107105
\
108106
static zval *php_phongo_##_name##_write_property(zend_object *zobj, zend_string *name, zval *value, void **cache_slot) \

0 commit comments

Comments
 (0)