diff options
-rw-r--r-- | ext/dom/document.c | 6 | ||||
-rw-r--r-- | ext/dom/dom_iterators.c | 2 | ||||
-rw-r--r-- | ext/dom/xpath.c | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c index 85f9ff0030..22e40e6752 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1288,6 +1288,11 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) { return; } + if (!source_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string supplied as input"); + RETURN_FALSE; + } + newdoc = dom_document_parser(id, mode, source TSRMLS_CC); if (!newdoc) @@ -1721,6 +1726,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) } if (!source_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string supplied as input"); RETURN_FALSE; } diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c index f71bc60e0e..6e027c243e 100644 --- a/ext/dom/dom_iterators.c +++ b/ext/dom/dom_iterators.c @@ -206,6 +206,7 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC) zend_hash_move_forward(nodeht); if (zend_hash_get_current_data(nodeht, (void **) &entry)==SUCCESS) { curattr = *entry; + curattr->refcount++; } } else { curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->ptr)->node; @@ -273,6 +274,7 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object TS zend_hash_internal_pointer_reset(nodeht); if (zend_hash_get_current_data(nodeht, (void **) &entry)==SUCCESS) { curattr = *entry; + curattr->refcount++; } } else { nodep = (xmlNode *)dom_object_get_node(objmap->baseobj); diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 76767fa1f7..28b118e50c 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -252,7 +252,7 @@ PHP_FUNCTION(dom_xpath_query) add_next_index_zval(retval, child); } } else { - RETURN_FALSE; + retval = NULL; } php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC); |