summaryrefslogtreecommitdiff
path: root/ext/dom
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom')
-rw-r--r--ext/dom/attr.c2
-rw-r--r--ext/dom/document.c74
-rw-r--r--ext/dom/dom_iterators.c4
-rw-r--r--ext/dom/domimplementation.c7
-rw-r--r--ext/dom/element.c24
-rw-r--r--ext/dom/namednodemap.c12
-rw-r--r--ext/dom/node.c28
-rw-r--r--ext/dom/nodelist.c4
-rw-r--r--ext/dom/php_dom.c24
-rw-r--r--ext/dom/tests/DOMDocument_loadHTML_error1.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_saveHTML_variant2.phpt26
-rw-r--r--ext/dom/tests/bug47430.phpt4
-rw-r--r--ext/dom/text.c2
-rw-r--r--ext/dom/xml_common.h8
-rw-r--r--ext/dom/xpath.c6
15 files changed, 127 insertions, 100 deletions
diff --git a/ext/dom/attr.c b/ext/dom/attr.c
index 5a1b308..98f645f 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.c
@@ -228,7 +228,7 @@ int dom_attr_owner_element_read(dom_object *obj, zval **retval TSRMLS_DC)
return SUCCESS;
}
- if (NULL == (*retval = php_dom_create_object(nodeparent, &ret, NULL, *retval, obj TSRMLS_CC))) {
+ if (NULL == (*retval = php_dom_create_object(nodeparent, &ret, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
}
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 0161916..1d7f46a 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -149,10 +149,12 @@ ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtml, 0, 0, 1)
ZEND_ARG_INFO(0, source)
+ ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtmlfile, 0, 0, 1)
ZEND_ARG_INFO(0, source)
+ ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtml, 0, 0, 0)
@@ -259,7 +261,7 @@ int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
return SUCCESS;
}
- if (NULL == (*retval = php_dom_create_object((xmlNodePtr) dtdptr, &ret, NULL, *retval, obj TSRMLS_CC))) {
+ if (NULL == (*retval = php_dom_create_object((xmlNodePtr) dtdptr, &ret, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
}
@@ -309,7 +311,7 @@ int dom_document_document_element_read(dom_object *obj, zval **retval TSRMLS_DC)
return SUCCESS;
}
- if (NULL == (*retval = php_dom_create_object(root, &ret, NULL, *retval, obj TSRMLS_CC))) {
+ if (NULL == (*retval = php_dom_create_object(root, &ret, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
}
@@ -899,7 +901,7 @@ Since:
*/
PHP_FUNCTION(dom_document_create_element)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlNode *node;
xmlDocPtr docp;
dom_object *intern;
@@ -922,7 +924,7 @@ PHP_FUNCTION(dom_document_create_element)
RETURN_FALSE;
}
- DOM_RET_OBJ(rv, node, &ret, intern);
+ DOM_RET_OBJ(node, &ret, intern);
}
/* }}} end dom_document_create_element */
@@ -932,7 +934,7 @@ Since:
*/
PHP_FUNCTION(dom_document_create_document_fragment)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlNode *node;
xmlDocPtr docp;
dom_object *intern;
@@ -949,7 +951,7 @@ PHP_FUNCTION(dom_document_create_document_fragment)
RETURN_FALSE;
}
- DOM_RET_OBJ(rv, node, &ret, intern);
+ DOM_RET_OBJ(node, &ret, intern);
}
/* }}} end dom_document_create_document_fragment */
@@ -959,7 +961,7 @@ Since:
*/
PHP_FUNCTION(dom_document_create_text_node)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlNode *node;
xmlDocPtr docp;
int ret, value_len;
@@ -977,7 +979,7 @@ PHP_FUNCTION(dom_document_create_text_node)
RETURN_FALSE;
}
- DOM_RET_OBJ(rv, node, &ret, intern);
+ DOM_RET_OBJ(node, &ret, intern);
}
/* }}} end dom_document_create_text_node */
@@ -987,7 +989,7 @@ Since:
*/
PHP_FUNCTION(dom_document_create_comment)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlNode *node;
xmlDocPtr docp;
int ret, value_len;
@@ -1005,7 +1007,7 @@ PHP_FUNCTION(dom_document_create_comment)
RETURN_FALSE;
}
- DOM_RET_OBJ(rv, node, &ret, intern);
+ DOM_RET_OBJ(node, &ret, intern);
}
/* }}} end dom_document_create_comment */
@@ -1015,7 +1017,7 @@ Since:
*/
PHP_FUNCTION(dom_document_create_cdatasection)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlNode *node;
xmlDocPtr docp;
int ret, value_len;
@@ -1033,7 +1035,7 @@ PHP_FUNCTION(dom_document_create_cdatasection)
RETURN_FALSE;
}
- DOM_RET_OBJ(rv, node, &ret, intern);
+ DOM_RET_OBJ(node, &ret, intern);
}
/* }}} end dom_document_create_cdatasection */
@@ -1043,7 +1045,7 @@ Since:
*/
PHP_FUNCTION(dom_document_create_processing_instruction)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlNode *node;
xmlDocPtr docp;
int ret, value_len, name_len = 0;
@@ -1068,7 +1070,7 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
node->doc = docp;
- DOM_RET_OBJ(rv, node, &ret, intern);
+ DOM_RET_OBJ(node, &ret, intern);
}
/* }}} end dom_document_create_processing_instruction */
@@ -1078,7 +1080,7 @@ Since:
*/
PHP_FUNCTION(dom_document_create_attribute)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlAttrPtr node;
xmlDocPtr docp;
int ret, name_len;
@@ -1101,7 +1103,7 @@ PHP_FUNCTION(dom_document_create_attribute)
RETURN_FALSE;
}
- DOM_RET_OBJ(rv, (xmlNodePtr) node, &ret, intern);
+ DOM_RET_OBJ((xmlNodePtr) node, &ret, intern);
}
/* }}} end dom_document_create_attribute */
@@ -1112,7 +1114,7 @@ Since:
*/
PHP_FUNCTION(dom_document_create_entity_reference)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlNode *node;
xmlDocPtr docp = NULL;
dom_object *intern;
@@ -1135,7 +1137,7 @@ PHP_FUNCTION(dom_document_create_entity_reference)
RETURN_FALSE;
}
- DOM_RET_OBJ(rv, (xmlNodePtr) node, &ret, intern);
+ DOM_RET_OBJ((xmlNodePtr) node, &ret, intern);
}
/* }}} end dom_document_create_entity_reference */
@@ -1171,7 +1173,6 @@ Since: DOM Level 2
*/
PHP_FUNCTION(dom_document_import_node)
{
- zval *rv = NULL;
zval *id, *node;
xmlDocPtr docp;
xmlNodePtr nodep, retnodep;
@@ -1211,13 +1212,13 @@ PHP_FUNCTION(dom_document_import_node)
nsptr = xmlSearchNsByHref (nodep->doc, root, nodep->ns->href);
if (nsptr == NULL) {
int errorcode;
- nsptr = dom_get_ns(root, nodep->ns->href, &errorcode, nodep->ns->prefix);
+ nsptr = dom_get_ns(root, (char *) nodep->ns->href, &errorcode, (char *) nodep->ns->prefix);
}
xmlSetNs(retnodep, nsptr);
}
}
- DOM_RET_OBJ(rv, (xmlNodePtr) retnodep, &ret, intern);
+ DOM_RET_OBJ((xmlNodePtr) retnodep, &ret, intern);
}
/* }}} end dom_document_import_node */
@@ -1227,7 +1228,7 @@ Since: DOM Level 2
*/
PHP_FUNCTION(dom_document_create_element_ns)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlDocPtr docp;
xmlNodePtr nodep = NULL;
xmlNsPtr nsptr = NULL;
@@ -1280,7 +1281,7 @@ PHP_FUNCTION(dom_document_create_element_ns)
nodep->ns = nsptr;
- DOM_RET_OBJ(rv, nodep, &ret, intern);
+ DOM_RET_OBJ(nodep, &ret, intern);
}
/* }}} end dom_document_create_element_ns */
@@ -1290,7 +1291,7 @@ Since: DOM Level 2
*/
PHP_FUNCTION(dom_document_create_attribute_ns)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlDocPtr docp;
xmlNodePtr nodep = NULL, root;
xmlNsPtr nsptr;
@@ -1345,7 +1346,7 @@ PHP_FUNCTION(dom_document_create_attribute_ns)
RETURN_FALSE;
}
- DOM_RET_OBJ(rv, nodep, &ret, intern);
+ DOM_RET_OBJ(nodep, &ret, intern);
}
/* }}} end dom_document_create_attribute_ns */
@@ -1382,7 +1383,7 @@ Since: DOM Level 2
*/
PHP_FUNCTION(dom_document_get_element_by_id)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlDocPtr docp;
xmlAttrPtr attrp;
int ret, idname_len;
@@ -1398,7 +1399,7 @@ PHP_FUNCTION(dom_document_get_element_by_id)
attrp = xmlGetID(docp, (xmlChar *) idname);
if (attrp && attrp->parent) {
- DOM_RET_OBJ(rv, (xmlNodePtr) attrp->parent, &ret, intern);
+ DOM_RET_OBJ((xmlNodePtr) attrp->parent, &ret, intern);
} else {
RETVAL_NULL();
}
@@ -1660,7 +1661,7 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int sourc
/* {{{ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) */
static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
- zval *id, *rv = NULL;
+ zval *id;
xmlDoc *docp = NULL, *newdoc;
dom_doc_propsptr doc_prop;
dom_object *intern;
@@ -1712,7 +1713,7 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
RETURN_TRUE;
} else {
- DOM_RET_OBJ(rv, (xmlNodePtr) newdoc, &ret, NULL);
+ DOM_RET_OBJ((xmlNodePtr) newdoc, &ret, NULL);
}
}
/* }}} end dom_parser_document */
@@ -1979,7 +1980,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
int is_valid;
char resolved_path[MAXPATHLEN + 1];
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
return;
}
@@ -2068,7 +2069,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
int is_valid;
char resolved_path[MAXPATHLEN + 1];
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
return;
}
@@ -2150,17 +2151,18 @@ PHP_FUNCTION(dom_document_relaxNG_validate_xml)
static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
{
- zval *id, *rv = NULL;
+ zval *id;
xmlDoc *docp = NULL, *newdoc;
dom_object *intern;
dom_doc_propsptr doc_prop;
char *source;
int source_len, refcount, ret;
+ long options = 0;
htmlParserCtxtPtr ctxt;
id = getThis();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
return;
}
@@ -2180,6 +2182,10 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
RETURN_FALSE;
}
+ if (options) {
+ htmlCtxtUseOptions(ctxt, options);
+ }
+
ctxt->vctxt.error = php_libxml_ctx_error;
ctxt->vctxt.warning = php_libxml_ctx_warning;
if (ctxt->sax != NULL) {
@@ -2218,7 +2224,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
RETURN_TRUE;
} else {
- DOM_RET_OBJ(rv, (xmlNodePtr) newdoc, &ret, NULL);
+ DOM_RET_OBJ((xmlNodePtr) newdoc, &ret, NULL);
}
}
/* }}} */
diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c
index 758181b..92302b1 100644
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.c
@@ -251,7 +251,7 @@ err:
zval_ptr_dtor((zval**)&curobj);
if (curnode) {
MAKE_STD_ZVAL(curattr);
- curattr = php_dom_create_object(curnode, &ret, NULL, curattr, objmap->baseobj TSRMLS_CC);
+ curattr = php_dom_create_object(curnode, &ret, curattr, objmap->baseobj TSRMLS_CC);
}
iterator->curobj = curattr;
@@ -330,7 +330,7 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
err:
if (curnode) {
MAKE_STD_ZVAL(curattr);
- curattr = php_dom_create_object(curnode, &ret, NULL, curattr, objmap->baseobj TSRMLS_CC);
+ curattr = php_dom_create_object(curnode, &ret, curattr, objmap->baseobj TSRMLS_CC);
}
iterator->curobj = curattr;
diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c
index 2fa39ca..92715ce 100644
--- a/ext/dom/domimplementation.c
+++ b/ext/dom/domimplementation.c
@@ -91,7 +91,6 @@ Since: DOM Level 2
*/
PHP_METHOD(domimplementation, createDocumentType)
{
- zval *rv = NULL;
xmlDtd *doctype;
int ret, name_len = 0, publicid_len = 0, systemid_len = 0;
char *name = NULL, *publicid = NULL, *systemid = NULL;
@@ -141,7 +140,7 @@ PHP_METHOD(domimplementation, createDocumentType)
RETURN_FALSE;
}
- DOM_RET_OBJ(rv, (xmlNodePtr) doctype, &ret, NULL);
+ DOM_RET_OBJ((xmlNodePtr) doctype, &ret, NULL);
}
/* }}} end dom_domimplementation_create_document_type */
@@ -151,7 +150,7 @@ Since: DOM Level 2
*/
PHP_METHOD(domimplementation, createDocument)
{
- zval *node = NULL, *rv = NULL;
+ zval *node = NULL;
xmlDoc *docp;
xmlNode *nodep;
xmlDtdPtr doctype = NULL;
@@ -238,7 +237,7 @@ PHP_METHOD(domimplementation, createDocument)
xmlFree(localname);
}
- DOM_RET_OBJ(rv, (xmlNodePtr) docp, &ret, NULL);
+ DOM_RET_OBJ((xmlNodePtr) docp, &ret, NULL);
if (doctobj != NULL) {
doctobj->document = ((dom_object *)((php_libxml_node_ptr *)docp->_private)->_private)->document;
diff --git a/ext/dom/element.c b/ext/dom/element.c
index 9792741..c6a1902 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.c
@@ -371,7 +371,7 @@ Since:
*/
PHP_FUNCTION(dom_element_set_attribute)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlNode *nodep;
xmlNodePtr attr = NULL;
int ret, name_len, value_len, name_valid;
@@ -426,7 +426,7 @@ PHP_FUNCTION(dom_element_set_attribute)
RETURN_FALSE;
}
- DOM_RET_OBJ(rv, attr, &ret, intern);
+ DOM_RET_OBJ(attr, &ret, intern);
}
/* }}} end dom_element_set_attribute */
@@ -485,7 +485,7 @@ Since:
*/
PHP_FUNCTION(dom_element_get_attribute_node)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlNodePtr nodep, attrp;
int name_len, ret;
dom_object *intern;
@@ -521,7 +521,7 @@ PHP_FUNCTION(dom_element_get_attribute_node)
attrp->ns = curns;
}
- DOM_RET_OBJ(rv, (xmlNodePtr) attrp, &ret, intern);
+ DOM_RET_OBJ((xmlNodePtr) attrp, &ret, intern);
}
/* }}} end dom_element_get_attribute_node */
@@ -531,7 +531,7 @@ Since:
*/
PHP_FUNCTION(dom_element_set_attribute_node)
{
- zval *id, *node, *rv = NULL;
+ zval *id, *node;
xmlNode *nodep;
xmlAttr *attrp, *existattrp = NULL;
dom_object *intern, *attrobj, *oldobj;
@@ -583,7 +583,7 @@ PHP_FUNCTION(dom_element_set_attribute_node)
/* Returns old property if removed otherwise NULL */
if (existattrp != NULL) {
- DOM_RET_OBJ(rv, (xmlNodePtr) existattrp, &ret, intern);
+ DOM_RET_OBJ((xmlNodePtr) existattrp, &ret, intern);
} else {
RETVAL_NULL();
}
@@ -597,7 +597,7 @@ Since:
*/
PHP_FUNCTION(dom_element_remove_attribute_node)
{
- zval *id, *node, *rv = NULL;
+ zval *id, *node;
xmlNode *nodep;
xmlAttr *attrp;
dom_object *intern, *attrobj;
@@ -623,7 +623,7 @@ PHP_FUNCTION(dom_element_remove_attribute_node)
xmlUnlinkNode((xmlNodePtr) attrp);
- DOM_RET_OBJ(rv, (xmlNodePtr) attrp, &ret, intern);
+ DOM_RET_OBJ((xmlNodePtr) attrp, &ret, intern);
}
/* }}} end dom_element_remove_attribute_node */
@@ -925,7 +925,7 @@ Since: DOM Level 2
*/
PHP_FUNCTION(dom_element_get_attribute_node_ns)
{
- zval *id, *rv = NULL;
+ zval *id;
xmlNodePtr elemp;
xmlAttrPtr attrp;
dom_object *intern;
@@ -944,7 +944,7 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns)
RETURN_NULL();
}
- DOM_RET_OBJ(rv, (xmlNodePtr) attrp, &ret, intern);
+ DOM_RET_OBJ((xmlNodePtr) attrp, &ret, intern);
}
/* }}} end dom_element_get_attribute_node_ns */
@@ -955,7 +955,7 @@ Since: DOM Level 2
*/
PHP_FUNCTION(dom_element_set_attribute_node_ns)
{
- zval *id, *node, *rv = NULL;
+ zval *id, *node;
xmlNode *nodep;
xmlNs *nsp;
xmlAttr *attrp, *existattrp = NULL;
@@ -1014,7 +1014,7 @@ PHP_FUNCTION(dom_element_set_attribute_node_ns)
/* Returns old property if removed otherwise NULL */
if (existattrp != NULL) {
- DOM_RET_OBJ(rv, (xmlNodePtr) existattrp, &ret, intern);
+ DOM_RET_OBJ((xmlNodePtr) existattrp, &ret, intern);
} else {
RETVAL_NULL();
}
diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c
index 1935fcc..e6c8fff 100644
--- a/ext/dom/namednodemap.c
+++ b/ext/dom/namednodemap.c
@@ -126,7 +126,7 @@ Since:
*/
PHP_FUNCTION(dom_namednodemap_get_named_item)
{
- zval *id, *rv = NULL;
+ zval *id;
int ret, namedlen=0;
dom_object *intern;
xmlNodePtr itemnode = NULL;
@@ -166,7 +166,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
}
if (itemnode) {
- DOM_RET_OBJ(rv, itemnode, &ret, objmap->baseobj);
+ DOM_RET_OBJ(itemnode, &ret, objmap->baseobj);
return;
} else {
RETVAL_NULL();
@@ -200,7 +200,7 @@ Since:
*/
PHP_FUNCTION(dom_namednodemap_item)
{
- zval *id, *rv = NULL;
+ zval *id;
long index;
int ret;
dom_object *intern;
@@ -243,7 +243,7 @@ PHP_FUNCTION(dom_namednodemap_item)
}
if (itemnode) {
- DOM_RET_OBJ(rv, itemnode, &ret, objmap->baseobj);
+ DOM_RET_OBJ(itemnode, &ret, objmap->baseobj);
return;
}
}
@@ -258,7 +258,7 @@ Since: DOM Level 2
*/
PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
{
- zval *id, *rv = NULL;
+ zval *id;
int ret, namedlen=0, urilen=0;
dom_object *intern;
xmlNodePtr itemnode = NULL;
@@ -298,7 +298,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
}
if (itemnode) {
- DOM_RET_OBJ(rv, itemnode, &ret, objmap->baseobj);
+ DOM_RET_OBJ(itemnode, &ret, objmap->baseobj);
return;
} else {
RETVAL_NULL();
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 5bcb234..4e58421 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -429,7 +429,7 @@ int dom_node_parent_node_read(dom_object *obj, zval **retval TSRMLS_DC)
return SUCCESS;
}
- if (NULL == (*retval = php_dom_create_object(nodeparent, &ret, NULL, *retval, obj TSRMLS_CC))) {
+ if (NULL == (*retval = php_dom_create_object(nodeparent, &ret, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
}
@@ -498,7 +498,7 @@ int dom_node_first_child_read(dom_object *obj, zval **retval TSRMLS_DC)
return SUCCESS;
}
- if (NULL == (*retval = php_dom_create_object(first, &ret, NULL, *retval, obj TSRMLS_CC))) {
+ if (NULL == (*retval = php_dom_create_object(first, &ret, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
}
@@ -535,7 +535,7 @@ int dom_node_last_child_read(dom_object *obj, zval **retval TSRMLS_DC)
return SUCCESS;
}
- if (NULL == (*retval = php_dom_create_object(last, &ret, NULL, *retval, obj TSRMLS_CC))) {
+ if (NULL == (*retval = php_dom_create_object(last, &ret, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
}
@@ -569,7 +569,7 @@ int dom_node_previous_sibling_read(dom_object *obj, zval **retval TSRMLS_DC)
return SUCCESS;
}
- if (NULL == (*retval = php_dom_create_object(prevsib, &ret, NULL, *retval, obj TSRMLS_CC))) {
+ if (NULL == (*retval = php_dom_create_object(prevsib, &ret, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
}
@@ -602,7 +602,7 @@ int dom_node_next_sibling_read(dom_object *obj, zval **retval TSRMLS_DC)
ALLOC_ZVAL(*retval);
- if (NULL == (*retval = php_dom_create_object(nextsib, &ret, NULL, *retval, obj TSRMLS_CC))) {
+ if (NULL == (*retval = php_dom_create_object(nextsib, &ret, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
}
@@ -674,7 +674,7 @@ int dom_node_owner_document_read(dom_object *obj, zval **retval TSRMLS_DC)
ALLOC_ZVAL(*retval);
- if (NULL == (*retval = php_dom_create_object((xmlNodePtr) docp, &ret, NULL, *retval, obj TSRMLS_CC))) {
+ if (NULL == (*retval = php_dom_create_object((xmlNodePtr) docp, &ret, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
}
@@ -1087,7 +1087,7 @@ PHP_FUNCTION(dom_node_insert_before)
xmlUnlinkNode((xmlNodePtr) lastattr);
php_libxml_node_free_resource((xmlNodePtr) lastattr TSRMLS_CC);
} else {
- DOM_RET_OBJ_EX(child, &ret, intern);
+ DOM_RET_OBJ(child, &ret, intern);
return;
}
}
@@ -1129,7 +1129,7 @@ PHP_FUNCTION(dom_node_insert_before)
xmlUnlinkNode((xmlNodePtr) lastattr);
php_libxml_node_free_resource((xmlNodePtr) lastattr TSRMLS_CC);
} else {
- DOM_RET_OBJ_EX(child, &ret, intern);
+ DOM_RET_OBJ(child, &ret, intern);
return;
}
}
@@ -1148,7 +1148,7 @@ PHP_FUNCTION(dom_node_insert_before)
dom_reconcile_ns(parentp->doc, new_child);
- DOM_RET_OBJ_EX(new_child, &ret, intern);
+ DOM_RET_OBJ(new_child, &ret, intern);
}
/* }}} end dom_node_insert_before */
@@ -1232,7 +1232,7 @@ PHP_FUNCTION(dom_node_replace_child)
xmlReplaceNode(oldchild, newchild);
dom_reconcile_ns(nodep->doc, newchild);
}
- DOM_RET_OBJ_EX(oldchild, &ret, intern);
+ DOM_RET_OBJ(oldchild, &ret, intern);
return;
} else {
php_dom_throw_error(NOT_FOUND_ERR, dom_get_strict_error(intern->document) TSRMLS_CC);
@@ -1281,7 +1281,7 @@ PHP_FUNCTION(dom_node_remove_child)
while (children) {
if (children == child) {
xmlUnlinkNode(child);
- DOM_RET_OBJ_EX(child, &ret, intern);
+ DOM_RET_OBJ(child, &ret, intern);
return;
}
children = children->next;
@@ -1389,7 +1389,7 @@ PHP_FUNCTION(dom_node_append_child)
dom_reconcile_ns(nodep->doc, new_child);
- DOM_RET_OBJ_EX(new_child, &ret, intern);
+ DOM_RET_OBJ(new_child, &ret, intern);
}
/* }}} end dom_node_append_child */
@@ -1478,7 +1478,7 @@ PHP_FUNCTION(dom_node_clone_node)
intern = NULL;
}
- DOM_RET_OBJ_EX(node, &ret, intern);
+ DOM_RET_OBJ(node, &ret, intern);
}
/* }}} end dom_node_clone_node */
@@ -1825,7 +1825,7 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
if (Z_TYPE_PP(tmpns) == IS_STRING) {
char *prefix;
ulong idx;
- int prefix_key_len;
+ uint prefix_key_len;
if (zend_hash_get_current_key_ex(Z_ARRVAL_PP(tmp),
&prefix, &prefix_key_len, &idx, 0, NULL) == HASH_KEY_IS_STRING) {
diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c
index a179e1f..21d2350 100644
--- a/ext/dom/nodelist.c
+++ b/ext/dom/nodelist.c
@@ -104,7 +104,7 @@ Since:
*/
PHP_FUNCTION(dom_nodelist_item)
{
- zval *id, *rv = NULL;
+ zval *id;
long index;
int ret;
dom_object *intern;
@@ -163,7 +163,7 @@ PHP_FUNCTION(dom_nodelist_item)
}
if (itemnode) {
- DOM_RET_OBJ(rv, itemnode, &ret, objmap->baseobj);
+ DOM_RET_OBJ(itemnode, &ret, objmap->baseobj);
return;
}
}
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index df413e9..ec7ec1e 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -303,7 +303,7 @@ static void dom_register_prop_handler(HashTable *prop_handler, char *name, dom_r
}
/* }}} */
-static zval **dom_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */
+static zval **dom_get_property_ptr_ptr(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */
{
dom_object *obj;
zval tmp_member;
@@ -326,7 +326,7 @@ static zval **dom_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /*
}
if (ret == FAILURE) {
std_hnd = zend_get_std_object_handlers();
- retval = std_hnd->get_property_ptr_ptr(object, member TSRMLS_CC);
+ retval = std_hnd->get_property_ptr_ptr(object, member, key TSRMLS_CC);
}
if (member == &tmp_member) {
@@ -337,7 +337,7 @@ static zval **dom_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /*
/* }}} */
/* {{{ dom_read_property */
-zval *dom_read_property(zval *object, zval *member, int type TSRMLS_DC)
+zval *dom_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC)
{
dom_object *obj;
zval tmp_member;
@@ -372,7 +372,7 @@ zval *dom_read_property(zval *object, zval *member, int type TSRMLS_DC)
}
} else {
std_hnd = zend_get_std_object_handlers();
- retval = std_hnd->read_property(object, member, type TSRMLS_CC);
+ retval = std_hnd->read_property(object, member, type, key TSRMLS_CC);
}
if (member == &tmp_member) {
@@ -383,7 +383,7 @@ zval *dom_read_property(zval *object, zval *member, int type TSRMLS_DC)
/* }}} */
/* {{{ dom_write_property */
-void dom_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
+void dom_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC)
{
dom_object *obj;
zval tmp_member;
@@ -408,7 +408,7 @@ void dom_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
hnd->write_func(obj, value TSRMLS_CC);
} else {
std_hnd = zend_get_std_object_handlers();
- std_hnd->write_property(object, member, value TSRMLS_CC);
+ std_hnd->write_property(object, member, value, key TSRMLS_CC);
}
if (member == &tmp_member) {
@@ -418,7 +418,7 @@ void dom_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
/* }}} */
/* {{{ dom_property_exists */
-static int dom_property_exists(zval *object, zval *member, int check_empty TSRMLS_DC)
+static int dom_property_exists(zval *object, zval *member, int check_empty, const zend_literal *key TSRMLS_DC)
{
dom_object *obj;
zval tmp_member;
@@ -456,7 +456,7 @@ static int dom_property_exists(zval *object, zval *member, int check_empty TSRML
}
} else {
std_hnd = zend_get_std_object_handlers();
- retval = std_hnd->has_property(object, member, check_empty TSRMLS_CC);
+ retval = std_hnd->has_property(object, member, check_empty, key TSRMLS_CC);
}
if (member == &tmp_member) {
@@ -565,7 +565,6 @@ void *php_dom_export_node(zval *object TSRMLS_DC) /* {{{ */
Get a simplexml_element object from dom to allow for processing */
PHP_FUNCTION(dom_import_simplexml)
{
- zval *rv = NULL;
zval *node;
xmlNodePtr nodep = NULL;
php_libxml_node_object *nodeobj;
@@ -579,7 +578,7 @@ PHP_FUNCTION(dom_import_simplexml)
nodep = php_libxml_import_node(node TSRMLS_CC);
if (nodep && nodeobj && (nodep->type == XML_ELEMENT_NODE || nodep->type == XML_ATTRIBUTE_NODE)) {
- DOM_RET_OBJ(rv, (xmlNodePtr) nodep, &ret, (dom_object *)nodeobj);
+ DOM_RET_OBJ((xmlNodePtr) nodep, &ret, (dom_object *)nodeobj);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Nodetype to import");
RETURN_NULL();
@@ -1135,7 +1134,6 @@ void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xml
static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool hash_copy TSRMLS_DC) /* {{{ */
{
zend_class_entry *base_class;
- zval *tmp;
dom_object *intern;
if (instanceof_function(class_type, dom_xpath_class_entry TSRMLS_CC)) {
@@ -1157,7 +1155,7 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
if (hash_copy) {
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
+ object_properties_init(&intern->std, class_type);
}
return intern;
@@ -1316,7 +1314,7 @@ void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC) /* {{{
/* }}} */
/* {{{ php_dom_create_object */
-PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wrapper_in, zval *return_value, dom_object *domobj TSRMLS_DC)
+PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *return_value, dom_object *domobj TSRMLS_DC)
{
zval *wrapper;
zend_class_entry *ce;
diff --git a/ext/dom/tests/DOMDocument_loadHTML_error1.phpt b/ext/dom/tests/DOMDocument_loadHTML_error1.phpt
index c7b5e61..de8d349 100644
--- a/ext/dom/tests/DOMDocument_loadHTML_error1.phpt
+++ b/ext/dom/tests/DOMDocument_loadHTML_error1.phpt
@@ -12,4 +12,4 @@ $doc = new DOMDocument();
$doc->loadHTML();
?>
--EXPECTF--
-Warning: DOMDocument::loadHTML() expects exactly 1 parameter, 0 given in %s on line %d
+Warning: DOMDocument::loadHTML() expects at least 1 parameter, 0 given in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt b/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt
new file mode 100644
index 0000000..54ccda1
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt
@@ -0,0 +1,26 @@
+--TEST--
+DOMDocument::saveHTML() vs DOMDocumet::saveXML()
+--SKIPIF--
+<?php
+require_once dirname(__FILE__) .'/skipif.inc';
+?>
+--FILE--
+<?php
+$d = new DOMDocument();
+$str = <<<EOD
+<html>
+<head>
+</head>
+<body>
+<p>Hi.<br/>there</p>
+</body>
+</html>
+EOD;
+$d->loadHTML($str);
+$e = $d->getElementsByTagName("p");
+$e = $e->item(0);
+echo $d->saveXml($e),"\n";
+echo $d->saveHtml($e),"\n";
+--EXPECTF--
+<p>Hi.<br/>there</p>
+<p>Hi.<br>there</p>
diff --git a/ext/dom/tests/bug47430.phpt b/ext/dom/tests/bug47430.phpt
index d3ca435..243fe84 100644
--- a/ext/dom/tests/bug47430.phpt
+++ b/ext/dom/tests/bug47430.phpt
@@ -21,9 +21,9 @@ print_r($arr);
?>
--EXPECTF--
-Strict Standards: Creating default object from empty value in %s on line %d
+Warning: Creating default object from empty value in %s on line %d
-Strict Standards: Creating default object from empty value in %s on line %d
+Warning: Creating default object from empty value in %s on line %d
Array
(
[0] => Value
diff --git a/ext/dom/text.c b/ext/dom/text.c
index 5ab716f..4c129bf 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.c
@@ -196,7 +196,7 @@ PHP_FUNCTION(dom_text_split_text)
nnode->type = XML_TEXT_NODE;
}
- return_value = php_dom_create_object(nnode, &ret, NULL, return_value, intern TSRMLS_CC);
+ return_value = php_dom_create_object(nnode, &ret, return_value, intern TSRMLS_CC);
}
/* }}} end dom_text_split_text */
diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h
index 40a72d8..ebe8a51 100644
--- a/ext/dom/xml_common.h
+++ b/ext/dom/xml_common.h
@@ -54,7 +54,7 @@ typedef struct _dom_object {
PHP_DOM_EXPORT extern zend_class_entry *dom_node_class_entry;
PHP_DOM_EXPORT dom_object *php_dom_object_get_data(xmlNodePtr obj);
-PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *in, zval* return_value, dom_object *domobj TSRMLS_DC);
+PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval* return_value, dom_object *domobj TSRMLS_DC);
PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj);
#define DOM_XMLNS_NAMESPACE \
@@ -78,14 +78,12 @@ PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj);
} \
}
-#define DOM_RET_OBJ_EX(obj, ret, domobject) \
- if (!php_dom_create_object(obj, ret, NULL, return_value, domobject TSRMLS_CC)) { \
+#define DOM_RET_OBJ(obj, ret, domobject) \
+ if (!php_dom_create_object(obj, ret, return_value, domobject TSRMLS_CC)) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object"); \
RETURN_FALSE; \
}
-#define DOM_RET_OBJ(zval, obj, ret, domobject) DOM_RET_OBJ_EX(obj, ret, domobject)
-
#define DOM_GET_THIS(zval) \
if (NULL == (zval = getThis())) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Underlying object missing"); \
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index de7b1fa..dd98511 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -164,7 +164,7 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
node->parent = nsparent;
node->ns = curns;
}
- child = php_dom_create_object(node, &ret, NULL, child, (dom_object *)intern TSRMLS_CC);
+ child = php_dom_create_object(node, &ret, child, (dom_object *)intern TSRMLS_CC);
add_next_index_zval(args[i], child);
}
}
@@ -329,7 +329,7 @@ int dom_xpath_document_read(dom_object *obj, zval **retval TSRMLS_DC)
}
ALLOC_ZVAL(*retval);
- if (NULL == (*retval = php_dom_create_object((xmlNodePtr) docp, &ret, NULL, *retval, obj TSRMLS_CC))) {
+ if (NULL == (*retval = php_dom_create_object((xmlNodePtr) docp, &ret, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
}
@@ -492,7 +492,7 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
node->parent = nsparent;
node->ns = curns;
}
- child = php_dom_create_object(node, &ret, NULL, child, (dom_object *)intern TSRMLS_CC);
+ child = php_dom_create_object(node, &ret, child, (dom_object *)intern TSRMLS_CC);
add_next_index_zval(retval, child);
}
}