summaryrefslogtreecommitdiff
path: root/ext/dom/php_dom.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom/php_dom.c')
-rw-r--r--ext/dom/php_dom.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index def54c99fb..ad297ca778 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -356,7 +356,7 @@ zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot,
/* }}} */
/* {{{ dom_write_property */
-void dom_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *dom_write_property(zval *object, zval *member, zval *value, void **cache_slot)
{
dom_object *obj = Z_DOMOBJ_P(object);
zend_string *member_str = zval_get_string(member);
@@ -368,10 +368,12 @@ void dom_write_property(zval *object, zval *member, zval *value, void **cache_sl
if (hnd) {
hnd->write_func(obj, value);
} else {
- zend_std_write_property(object, member, value, cache_slot);
+ value = zend_std_write_property(object, member, value, cache_slot);
}
zend_string_release_ex(member_str, 0);
+
+ return value;
}
/* }}} */
@@ -408,6 +410,28 @@ static int dom_property_exists(zval *object, zval *member, int check_empty, void
}
/* }}} */
+/* {{{ dom_get_properties */
+static HashTable *dom_get_properties(zval *object)
+{
+ dom_object *obj = Z_DOMOBJ_P(object);
+ HashTable *props = zend_std_get_properties(object);
+
+ if (obj->prop_handler != NULL) {
+ zend_string *key;
+ dom_prop_handler *hnd;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(obj->prop_handler, key, hnd) {
+ zval val;
+
+ if (hnd->read_func(obj, &val) == SUCCESS) {
+ zend_hash_update(props, key, &val);
+ }
+ } ZEND_HASH_FOREACH_END();
+ }
+ return props;
+}
+/* }}} */
+
static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ */
{
dom_object *obj = Z_DOMOBJ_P(object);
@@ -600,6 +624,7 @@ PHP_MINIT_FUNCTION(dom)
dom_object_handlers.get_property_ptr_ptr = dom_get_property_ptr_ptr;
dom_object_handlers.clone_obj = dom_objects_store_clone_obj;
dom_object_handlers.has_property = dom_property_exists;
+ dom_object_handlers.get_properties = dom_get_properties;
dom_object_handlers.get_debug_info = dom_get_debug_info;
memcpy(&dom_nnodemap_object_handlers, &dom_object_handlers, sizeof(zend_object_handlers));
@@ -1573,12 +1598,3 @@ int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty)
} /* }}} end dom_nodelist_has_dimension */
#endif /* HAVE_DOM */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */