summaryrefslogtreecommitdiff
path: root/ext/xmlreader/php_xmlreader.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-03-17 10:15:58 +0000
committerAntony Dovgal <tony2001@php.net>2006-03-17 10:15:58 +0000
commit652d77eca45e5db0f9256e6bcc4ba2dab5657bd3 (patch)
tree70acdbe0b42fda0ead3fef913269eb69506401d9 /ext/xmlreader/php_xmlreader.c
parent76a7240d70ae90eb614cb0ecab772309b8798030 (diff)
downloadphp-git-652d77eca45e5db0f9256e6bcc4ba2dab5657bd3.tar.gz
fix #36743 (In a class extending XMLReader array properties are not writable)
Diffstat (limited to 'ext/xmlreader/php_xmlreader.c')
-rw-r--r--ext/xmlreader/php_xmlreader.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index 22bf7fdc4d..a662d6086b 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -110,6 +110,40 @@ static int xmlreader_property_reader(xmlreader_object *obj, xmlreader_prop_handl
}
/* }}} */
+/* {{{ xmlreader_get_property_ptr_ptr */
+zval **xmlreader_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC)
+{
+ xmlreader_object *obj;
+ zval tmp_member;
+ zval **retval = NULL;
+ xmlreader_prop_handler *hnd;
+ zend_object_handlers *std_hnd;
+ int ret = FAILURE;
+
+ if (member->type != IS_STRING) {
+ tmp_member = *member;
+ zval_copy_ctor(&tmp_member);
+ convert_to_string(&tmp_member);
+ member = &tmp_member;
+ }
+
+ obj = (xmlreader_object *)zend_objects_get_address(object TSRMLS_CC);
+
+ if (obj->prop_handler != NULL) {
+ ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd);
+ }
+ if (ret == FAILURE) {
+ std_hnd = zend_get_std_object_handlers();
+ retval = std_hnd->get_property_ptr_ptr(object, member TSRMLS_CC);
+ }
+
+ if (member == &tmp_member) {
+ zval_dtor(member);
+ }
+ return retval;
+}
+/* }}} */
+
/* {{{ xmlreader_read_property */
zval *xmlreader_read_property(zval *object, zval *member, int type TSRMLS_DC)
{
@@ -1098,7 +1132,7 @@ PHP_MINIT_FUNCTION(xmlreader)
memcpy(&xmlreader_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
xmlreader_object_handlers.read_property = xmlreader_read_property;
xmlreader_object_handlers.write_property = xmlreader_write_property;
- xmlreader_object_handlers.get_property_ptr_ptr = NULL;
+ xmlreader_object_handlers.get_property_ptr_ptr = xmlreader_get_property_ptr_ptr;
INIT_CLASS_ENTRY(ce, "XMLReader", xmlreader_functions);
ce.create_object = xmlreader_objects_new;