summaryrefslogtreecommitdiff
path: root/ext/dom/php_dom.c
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2007-08-06 16:22:24 +0000
committerRob Richards <rrichards@php.net>2007-08-06 16:22:24 +0000
commit9abc90728dbb96cce14b5e354e77cada286538fe (patch)
tree96b887fcd2fb4604f11cd7a3820b1658c816d09d /ext/dom/php_dom.c
parent12ddff7032f9d49bcc8eb94db3440fd081245bff (diff)
downloadphp-git-9abc90728dbb96cce14b5e354e77cada286538fe.tar.gz
MFH: fix bug #42082 (NodeList length zero should be empty). (Hannes)
add and update tests
Diffstat (limited to 'ext/dom/php_dom.c')
-rw-r--r--ext/dom/php_dom.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 396e11714c..83f1cb9b7c 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -411,7 +411,20 @@ static int dom_property_exists(zval *object, zval *member, int check_empty TSRML
ret = zend_hash_find((HashTable *)obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd);
}
if (ret == SUCCESS) {
- retval = 1;
+ zval *tmp;
+
+ if (check_empty == 2) {
+ retval = 1;
+ } else if (hnd->read_func(obj, &tmp TSRMLS_CC) == SUCCESS) {
+ tmp->refcount = 1;
+ tmp->is_ref = 0;
+ if (check_empty == 1) {
+ retval = zend_is_true(tmp);
+ } else if (check_empty == 0) {
+ retval = (Z_TYPE_P(tmp) != IS_NULL);
+ }
+ zval_ptr_dtor(&tmp);
+ }
} else {
std_hnd = zend_get_std_object_handlers();
retval = std_hnd->has_property(object, member, check_empty TSRMLS_CC);