summaryrefslogtreecommitdiff
path: root/ext/dom
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-08-19 10:22:38 +0200
committerOndřej Surý <ondrej@sury.org>2011-08-19 10:22:38 +0200
commitf452a2b3e4e4279b27594a8ddb66525442d59227 (patch)
treed05cb62c5515ada33076d3cc3e49b664733a478c /ext/dom
parent038ba12e8724d537040e88ec794354b0c063f0a6 (diff)
downloadphp-upstream/5.3.7.tar.gz
Imported Upstream version 5.3.7upstream/5.3.7
Diffstat (limited to 'ext/dom')
-rw-r--r--ext/dom/attr.c4
-rw-r--r--ext/dom/cdatasection.c4
-rw-r--r--ext/dom/characterdata.c4
-rw-r--r--ext/dom/document.c4
-rw-r--r--ext/dom/documentfragment.c4
-rw-r--r--ext/dom/documenttype.c4
-rw-r--r--ext/dom/domconfiguration.c4
-rw-r--r--ext/dom/domerror.c4
-rw-r--r--ext/dom/domerrorhandler.c4
-rw-r--r--ext/dom/domexception.c4
-rw-r--r--ext/dom/domimplementation.c4
-rw-r--r--ext/dom/domimplementationsource.c4
-rw-r--r--ext/dom/domlocator.c4
-rw-r--r--ext/dom/domstringlist.c4
-rw-r--r--ext/dom/element.c4
-rw-r--r--ext/dom/entity.c4
-rw-r--r--ext/dom/entityreference.c4
-rw-r--r--ext/dom/examples/note.dtd4
-rw-r--r--ext/dom/namednodemap.c4
-rw-r--r--ext/dom/namelist.c4
-rw-r--r--ext/dom/node.c29
-rw-r--r--ext/dom/nodelist.c4
-rw-r--r--ext/dom/notation.c4
-rw-r--r--ext/dom/php_dom.c8
-rw-r--r--ext/dom/processinginstruction.c4
-rw-r--r--ext/dom/string_extend.c4
-rw-r--r--ext/dom/tests/DOMDocument_loadHTML_error1.phpt15
-rw-r--r--ext/dom/tests/DOMDocument_loadHTML_error2.phpt15
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt39
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt41
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt39
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt24
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidate_basic.rng11
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt26
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt25
-rw-r--r--ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt11
-rw-r--r--ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt18
-rw-r--r--ext/dom/tests/DOMImplementation_createDocument_basic.phpt14
-rw-r--r--ext/dom/tests/DOMImplementation_hasFeature_basic.phpt15
-rw-r--r--ext/dom/tests/DOMNode_C14NFile_basic.phpt38
-rw-r--r--ext/dom/tests/DOMNode_C14N_basic.phpt29
-rw-r--r--ext/dom/tests/DOMNode_getLineNo_basic.phpt19
-rw-r--r--ext/dom/tests/DOMNode_getNodePath_basic.phpt19
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error1.phpt24
-rw-r--r--ext/dom/tests/bug54601.phpt30
-rw-r--r--ext/dom/tests/dom004.phpt2
-rw-r--r--ext/dom/tests/dom005.phpt7
-rw-r--r--ext/dom/tests/dom_xinclude.phpt2
-rw-r--r--ext/dom/text.c4
-rw-r--r--ext/dom/typeinfo.c4
-rw-r--r--ext/dom/userdatahandler.c4
-rw-r--r--ext/dom/xml_common.h8
-rw-r--r--ext/dom/xpath.c4
53 files changed, 526 insertions, 94 deletions
diff --git a/ext/dom/attr.c b/ext/dom/attr.c
index 0ac622346..ddec8f967 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: attr.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: attr.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -49,7 +49,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_attr_class_functions[] = {
PHP_FALIAS(isId, dom_attr_is_id, arginfo_dom_attr_is_id)
PHP_ME(domattr, __construct, arginfo_dom_attr_construct, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ proto void DOMAttr::__construct(string name, [string value]); */
diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c
index 33967fe33..c21fa3396 100644
--- a/ext/dom/cdatasection.c
+++ b/ext/dom/cdatasection.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cdatasection.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: cdatasection.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -43,7 +43,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_cdatasection_class_functions[] = {
PHP_ME(domcdatasection, __construct, arginfo_dom_cdatasection_construct, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ proto void DOMCdataSection::__construct(string value); */
diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c
index 4b10b4b5e..6a6109462 100644
--- a/ext/dom/characterdata.c
+++ b/ext/dom/characterdata.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: characterdata.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: characterdata.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -68,7 +68,7 @@ const zend_function_entry php_dom_characterdata_class_functions[] = {
PHP_FALIAS(insertData, dom_characterdata_insert_data, arginfo_dom_characterdata_insert_data)
PHP_FALIAS(deleteData, dom_characterdata_delete_data, arginfo_dom_characterdata_delete_data)
PHP_FALIAS(replaceData, dom_characterdata_replace_data, arginfo_dom_characterdata_replace_data)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ data string
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 961c5969a..b06b38910 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: document.c 307571 2011-01-19 00:22:06Z cataphract $ */
+/* $Id: document.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -229,7 +229,7 @@ const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
PHP_FALIAS(relaxNGValidateSource, dom_document_relaxNG_validate_xml, arginfo_dom_document_relaxNG_validate_xml)
#endif
PHP_ME(domdocument, registerNodeClass, arginfo_dom_document_registernodeclass, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* }}} */
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c
index f56dd37a9..42dde4108 100644
--- a/ext/dom/documentfragment.c
+++ b/ext/dom/documentfragment.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: documentfragment.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: documentfragment.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -46,7 +46,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_documentfragment_class_functions[] = {
PHP_ME(domdocumentfragment, __construct, arginfo_dom_documentfragement_construct, ZEND_ACC_PUBLIC)
PHP_ME(domdocumentfragment, appendXML, arginfo_dom_documentfragement_appendXML, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ proto void DOMDocumentFragment::__construct(); */
diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
index ea9a5d327..0fa76efec 100644
--- a/ext/dom/documenttype.c
+++ b/ext/dom/documenttype.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: documenttype.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: documenttype.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -35,7 +35,7 @@
*/
const zend_function_entry php_dom_documenttype_class_functions[] = {
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ name string
diff --git a/ext/dom/domconfiguration.c b/ext/dom/domconfiguration.c
index 0f3f4b0c5..de3de6adc 100644
--- a/ext/dom/domconfiguration.c
+++ b/ext/dom/domconfiguration.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domconfiguration.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: domconfiguration.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -54,7 +54,7 @@ const zend_function_entry php_dom_domconfiguration_class_functions[] = {
PHP_FALIAS(setParameter, dom_domconfiguration_set_parameter, arginfo_dom_configuration_set_parameter)
PHP_FALIAS(getParameter, dom_domconfiguration_get_parameter, arginfo_dom_configuration_get_parameter)
PHP_FALIAS(canSetParameter, dom_domconfiguration_can_set_parameter, arginfo_dom_configuration_can_set_parameter)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ attribute protos, not implemented yet */
diff --git a/ext/dom/domerror.c b/ext/dom/domerror.c
index 8ca8ac5af..481cce916 100644
--- a/ext/dom/domerror.c
+++ b/ext/dom/domerror.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domerror.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: domerror.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -36,7 +36,7 @@
*/
const zend_function_entry php_dom_domerror_class_functions[] = {
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ attribute protos, not implemented yet */
diff --git a/ext/dom/domerrorhandler.c b/ext/dom/domerrorhandler.c
index 1683c563b..73a8ef50d 100644
--- a/ext/dom/domerrorhandler.c
+++ b/ext/dom/domerrorhandler.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domerrorhandler.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: domerrorhandler.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -42,7 +42,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_domerrorhandler_class_functions[] = {
PHP_FALIAS(handleError, dom_domerrorhandler_handle_error, arginfo_dom_domerrorhandler_handle_error)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ attribute protos, not implemented yet */
diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c
index f66abf8e6..18ac78b39 100644
--- a/ext/dom/domexception.c
+++ b/ext/dom/domexception.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domexception.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: domexception.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -37,7 +37,7 @@
extern zend_class_entry *dom_domexception_class_entry;
const zend_function_entry php_dom_domexception_class_functions[] = {
- {NULL, NULL, NULL}
+ PHP_FE_END
};
void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC) /* {{{ */
diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c
index b553fca60..28bd39c21 100644
--- a/ext/dom/domimplementation.c
+++ b/ext/dom/domimplementation.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementation.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: domimplementation.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -61,7 +61,7 @@ const zend_function_entry php_dom_domimplementation_class_functions[] = {
PHP_ME(domimplementation, hasFeature, arginfo_dom_implementation_has_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
PHP_ME(domimplementation, createDocumentType, arginfo_dom_implementation_create_documenttype, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
PHP_ME(domimplementation, createDocument, arginfo_dom_implementation_create_document, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ proto boolean dom_domimplementation_has_feature(string feature, string version);
diff --git a/ext/dom/domimplementationsource.c b/ext/dom/domimplementationsource.c
index eab3428f0..b23185c37 100644
--- a/ext/dom/domimplementationsource.c
+++ b/ext/dom/domimplementationsource.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementationsource.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: domimplementationsource.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -48,7 +48,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_domimplementationsource_class_functions[] = {
PHP_FALIAS(getDomimplementation, dom_domimplementationsource_get_domimplementation, arginfo_dom_implementationsource_getdomimplementation)
PHP_FALIAS(getDomimplementations, dom_domimplementationsource_get_domimplementations, arginfo_dom_implementationsource_getdomimplementations)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ attribute protos, not implemented yet */
diff --git a/ext/dom/domlocator.c b/ext/dom/domlocator.c
index 38c64d579..b240c41af 100644
--- a/ext/dom/domlocator.c
+++ b/ext/dom/domlocator.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domlocator.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: domlocator.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -36,7 +36,7 @@
*/
const zend_function_entry php_dom_domlocator_class_functions[] = {
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ attribute protos, not implemented yet */
diff --git a/ext/dom/domstringlist.c b/ext/dom/domstringlist.c
index 96bb5b12b..b2639ab6c 100644
--- a/ext/dom/domstringlist.c
+++ b/ext/dom/domstringlist.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domstringlist.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: domstringlist.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -42,7 +42,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_domstringlist_class_functions[] = {
PHP_FALIAS(item, dom_domstringlist_item, arginfo_dom_stringlist_item)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ attribute protos, not implemented yet */
diff --git a/ext/dom/element.c b/ext/dom/element.c
index 993123f40..512e37a54 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: element.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: element.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -146,7 +146,7 @@ const zend_function_entry php_dom_element_class_functions[] = { /* {{{ */
PHP_FALIAS(setIdAttributeNS, dom_element_set_id_attribute_ns, arginfo_dom_element_set_id_attribute_ns)
PHP_FALIAS(setIdAttributeNode, dom_element_set_id_attribute_node, arginfo_dom_element_set_id_attribute_node)
PHP_ME(domelement, __construct, arginfo_dom_element_construct, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* }}} */
diff --git a/ext/dom/entity.c b/ext/dom/entity.c
index 6e526a95a..48abaeb9c 100644
--- a/ext/dom/entity.c
+++ b/ext/dom/entity.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: entity.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: entity.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -36,7 +36,7 @@
*/
const zend_function_entry php_dom_entity_class_functions[] = {
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ publicId string
diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c
index 4ad19177d..2e8c4b538 100644
--- a/ext/dom/entityreference.c
+++ b/ext/dom/entityreference.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: entityreference.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: entityreference.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -42,7 +42,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_entityreference_class_functions[] = {
PHP_ME(domentityreference, __construct, arginfo_dom_entityreference_construct, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ proto void DOMEntityReference::__construct(string name); */
diff --git a/ext/dom/examples/note.dtd b/ext/dom/examples/note.dtd
index 4016eb581..c2d558eee 100644
--- a/ext/dom/examples/note.dtd
+++ b/ext/dom/examples/note.dtd
@@ -1,6 +1,6 @@
-<?xml version="1.0" ?>
+<?xml version="1.0" encoding="utf-8" ?>
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
-<!ELEMENT body (#PCDATA)> \ No newline at end of file
+<!ELEMENT body (#PCDATA)>
diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c
index b60c7ca1e..30dff986c 100644
--- a/ext/dom/namednodemap.c
+++ b/ext/dom/namednodemap.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: namednodemap.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: namednodemap.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -74,7 +74,7 @@ const zend_function_entry php_dom_namednodemap_class_functions[] = { /* {{{ */
PHP_FALIAS(getNamedItemNS, dom_namednodemap_get_named_item_ns, arginfo_dom_namednodemap_get_named_item_ns)
PHP_FALIAS(setNamedItemNS, dom_namednodemap_set_named_item_ns, arginfo_dom_namednodemap_set_named_item_ns)
PHP_FALIAS(removeNamedItemNS, dom_namednodemap_remove_named_item_ns, arginfo_dom_namednodemap_remove_named_item_ns)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* }}} */
diff --git a/ext/dom/namelist.c b/ext/dom/namelist.c
index 85a43bfed..b731ae99a 100644
--- a/ext/dom/namelist.c
+++ b/ext/dom/namelist.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: namelist.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: namelist.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -47,7 +47,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_namelist_class_functions[] = {
PHP_FALIAS(getName, dom_namelist_get_name, arginfo_dom_namelist_get_name)
PHP_FALIAS(getNamespaceURI, dom_namelist_get_namespace_uri, arginfo_dom_namelist_get_namespace_uri)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ length int
diff --git a/ext/dom/node.c b/ext/dom/node.c
index c93373a40..a2c9c280a 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: node.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: node.c 314493 2011-08-08 12:29:32Z iliaa $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -155,7 +155,7 @@ const zend_function_entry php_dom_node_class_functions[] = { /* {{{ */
PHP_ME(domnode, getLineNo, arginfo_dom_node_getLineNo, ZEND_ACC_PUBLIC)
PHP_ME(domnode, C14N, arginfo_dom_node_C14N, ZEND_ACC_PUBLIC)
PHP_ME(domnode, C14NFile, arginfo_dom_node_C14NFile, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* }}} */
@@ -998,7 +998,7 @@ Since:
*/
PHP_FUNCTION(dom_node_insert_before)
{
- zval *id, *node, *ref = NULL, *rv = NULL;
+ zval *id, *node, *ref = NULL;
xmlNodePtr child, new_child, parentp, refp;
dom_object *intern, *childobj, *refpobj;
int ret, stricterror;
@@ -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(rv, child, &ret, intern);
+ DOM_RET_OBJ_EX(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(rv, child, &ret, intern);
+ DOM_RET_OBJ_EX(child, &ret, intern);
return;
}
}
@@ -1148,7 +1148,7 @@ PHP_FUNCTION(dom_node_insert_before)
dom_reconcile_ns(parentp->doc, new_child);
- DOM_RET_OBJ(rv, new_child, &ret, intern);
+ DOM_RET_OBJ_EX(new_child, &ret, intern);
}
/* }}} end dom_node_insert_before */
@@ -1212,9 +1212,6 @@ PHP_FUNCTION(dom_node_replace_child)
}
if (foundoldchild) {
- xmlNodePtr node;
- zval *rv = NULL;
-
if (newchild->type == XML_DOCUMENT_FRAG_NODE) {
xmlNodePtr prevsib, nextsib;
prevsib = oldchild->prev;
@@ -1232,10 +1229,10 @@ PHP_FUNCTION(dom_node_replace_child)
newchildobj->document = intern->document;
php_libxml_increment_doc_ref((php_libxml_node_object *)newchildobj, NULL TSRMLS_CC);
}
- node = xmlReplaceNode(oldchild, newchild);
+ xmlReplaceNode(oldchild, newchild);
dom_reconcile_ns(nodep->doc, newchild);
}
- DOM_RET_OBJ(rv, oldchild, &ret, intern);
+ DOM_RET_OBJ_EX(oldchild, &ret, intern);
return;
} else {
php_dom_throw_error(NOT_FOUND_ERR, dom_get_strict_error(intern->document) TSRMLS_CC);
@@ -1283,9 +1280,8 @@ PHP_FUNCTION(dom_node_remove_child)
while (children) {
if (children == child) {
- zval *rv = NULL;
xmlUnlinkNode(child);
- DOM_RET_OBJ(rv, child, &ret, intern);
+ DOM_RET_OBJ_EX(child, &ret, intern);
return;
}
children = children->next;
@@ -1302,7 +1298,7 @@ Since:
*/
PHP_FUNCTION(dom_node_append_child)
{
- zval *id, *node, *rv = NULL;
+ zval *id, *node;
xmlNodePtr child, nodep, new_child = NULL;
dom_object *intern, *childobj;
int ret, stricterror;
@@ -1393,7 +1389,7 @@ PHP_FUNCTION(dom_node_append_child)
dom_reconcile_ns(nodep->doc, new_child);
- DOM_RET_OBJ(rv, new_child, &ret, intern);
+ DOM_RET_OBJ_EX(new_child, &ret, intern);
}
/* }}} end dom_node_append_child */
@@ -1431,7 +1427,6 @@ Since:
*/
PHP_FUNCTION(dom_node_clone_node)
{
- zval *rv = NULL;
zval *id;
xmlNode *n, *node;
int ret;
@@ -1483,7 +1478,7 @@ PHP_FUNCTION(dom_node_clone_node)
intern = NULL;
}
- DOM_RET_OBJ(rv, node, &ret, intern);
+ DOM_RET_OBJ_EX(node, &ret, intern);
}
/* }}} end dom_node_clone_node */
diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c
index 2427498e9..a31b32aa5 100644
--- a/ext/dom/nodelist.c
+++ b/ext/dom/nodelist.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: nodelist.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: nodelist.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -43,7 +43,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_nodelist_class_functions[] = {
PHP_FALIAS(item, dom_nodelist_item, arginfo_dom_nodelist_item)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ length int
diff --git a/ext/dom/notation.c b/ext/dom/notation.c
index 16cc3759f..6951cc443 100644
--- a/ext/dom/notation.c
+++ b/ext/dom/notation.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: notation.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: notation.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -35,7 +35,7 @@
*/
const zend_function_entry php_dom_notation_class_functions[] = {
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ attribute protos, not implemented yet */
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 5f9480b1d..4e921de0e 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: php_dom.c 314493 2011-08-08 12:29:32Z iliaa $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -212,7 +212,7 @@ int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece,
zend_hash_init(doc_props->classmap, 0, NULL, NULL, 0);
}
if (ce) {
- return zend_hash_update(doc_props->classmap, basece->name, basece->name_length + 1, &ce, sizeof(ce), NULL);
+ return zend_hash_update(doc_props->classmap, basece->name, basece->name_length + 1, &ce, sizeof(zend_class_entry *), NULL);
} else {
zend_hash_del(doc_props->classmap, basece->name, basece->name_length + 1);
}
@@ -543,7 +543,7 @@ ZEND_END_ARG_INFO()
static const zend_function_entry dom_functions[] = {
PHP_FE(dom_import_simplexml, arginfo_dom_import_simplexml)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
static zend_object_handlers* dom_get_obj_handlers(TSRMLS_D) {
@@ -553,7 +553,7 @@ static zend_object_handlers* dom_get_obj_handlers(TSRMLS_D) {
static const zend_module_dep dom_deps[] = {
ZEND_MOD_REQUIRED("libxml")
ZEND_MOD_CONFLICTS("domxml")
- {NULL, NULL, NULL}
+ ZEND_MOD_END
};
zend_module_entry dom_module_entry = { /* {{{ */
diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c
index f4eb481fe..955f59fc3 100644
--- a/ext/dom/processinginstruction.c
+++ b/ext/dom/processinginstruction.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: processinginstruction.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: processinginstruction.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -44,7 +44,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_processinginstruction_class_functions[] = {
PHP_ME(domprocessinginstruction, __construct, arginfo_dom_processinginstruction_construct, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ proto void DOMProcessingInstruction::__construct(string name, [string value]); */
diff --git a/ext/dom/string_extend.c b/ext/dom/string_extend.c
index 752864ebd..9b8de142c 100644
--- a/ext/dom/string_extend.c
+++ b/ext/dom/string_extend.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string_extend.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: string_extend.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -47,7 +47,7 @@ ZEND_END_ARG_INFO();
const zend_function_entry php_dom_string_extend_class_functions[] = {
PHP_FALIAS(findOffset16, dom_string_extend_find_offset16, arginfo_dom_string_extend_find_offset16)
PHP_FALIAS(findOffset32, dom_string_extend_find_offset32, arginfo_dom_string_extend_find_offset32)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ attribute protos, not implemented yet */
diff --git a/ext/dom/tests/DOMDocument_loadHTML_error1.phpt b/ext/dom/tests/DOMDocument_loadHTML_error1.phpt
new file mode 100644
index 000000000..c7b5e614d
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_loadHTML_error1.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DOMDocument::loadHTML() should fail if no parameter is given
+--CREDITS--
+Knut Urdalen <knut@php.net>
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$doc = new DOMDocument();
+$doc->loadHTML();
+?>
+--EXPECTF--
+Warning: DOMDocument::loadHTML() expects exactly 1 parameter, 0 given in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_loadHTML_error2.phpt b/ext/dom/tests/DOMDocument_loadHTML_error2.phpt
new file mode 100644
index 000000000..3167c0189
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_loadHTML_error2.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DOMDocument::loadHTML() should fail if empty string provided as input
+--CREDITS--
+Knut Urdalen <knut@php.net>
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$doc = new DOMDocument();
+$doc->loadHTML('');
+?>
+--EXPECTF--
+Warning: DOMDocument::loadHTML(): Empty string supplied as input in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt
new file mode 100644
index 000000000..93b9cf717
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+DOMDocument::relaxNGValidateSource()
+--CREDITS--
+Knut Urdalen <knut@php.net>
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$rng = <<< RNG
+<?xml version="1.0" encoding="UTF-8"?>
+<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <start>
+ <element name="apple">
+ <element name="pear">
+ <data type="NCName"/>
+ </element>
+ </element>
+ </start>
+</grammar>
+RNG;
+
+$good_xml = <<< GOOD_XML
+<?xml version="1.0"?>
+<apple>
+ <pear>Pear</pear>
+</apple>
+GOOD_XML;
+
+$doc = new DOMDocument();
+$doc->loadXML($good_xml);
+$result = $doc->relaxNGValidateSource($rng);
+var_dump($result);
+
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt
new file mode 100644
index 000000000..7da71a57a
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+DOMDocument::relaxNGValidateSource() should fail if document doesn't validate
+--CREDITS--
+Knut Urdalen <knut@php.net>
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$rng = <<< RNG
+<?xml version="1.0" encoding="UTF-8"?>
+<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <start>
+ <element name="apple">
+ <element name="pear">
+ <data type="NCName"/>
+ </element>
+ </element>
+ </start>
+</grammar>
+RNG;
+
+$bad_xml = <<< BAD_XML
+<?xml version="1.0"?>
+<apple>
+ <pear>Pear</pear>
+ <pear>Pear</pear>
+</apple>
+BAD_XML;
+
+$doc = new DOMDocument();
+$doc->loadXML($bad_xml);
+$result = $doc->relaxNGValidateSource($rng);
+var_dump($result);
+
+?>
+--EXPECTF--
+Warning: DOMDocument::relaxNGValidateSource(): Did not expect element pear there in %s on line %d
+bool(false)
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt
new file mode 100644
index 000000000..d689934f4
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt
@@ -0,0 +1,39 @@
+--TEST--
+DOMDocument::relaxNGValidateSource() should fail on invalid RNG schema
+--CREDITS--
+Knut Urdalen <knut@php.net>
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$rng = <<< RNG
+<?xml version="1.0" encoding="UTF-8"?>
+<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <start>
+ <element name="apple">
+ </element>
+ </start>
+</grammar>
+RNG;
+
+$xml = <<< XML
+<?xml version="1.0"?>
+<apple>
+ <pear>Pear</pear>
+</apple>
+XML;
+
+$doc = new DOMDocument();
+$doc->loadXML($xml);
+$result = $doc->relaxNGValidateSource($rng);
+var_dump($result);
+
+?>
+--EXPECTF--
+Warning: DOMDocument::relaxNGValidateSource(): xmlRelaxNGParseElement: element has no content in %s on line %d
+
+Warning: DOMDocument::relaxNGValidateSource(): Invalid RelaxNG in %s on line %d
+bool(false)
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt
new file mode 100644
index 000000000..76a64425c
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+DOMDocument::relaxNGValidate()
+--CREDITS--
+Knut Urdalen <knut@php.net>
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$rng = dirname(__FILE__).'/DOMDocument_relaxNGValidate_basic.rng';
+$xml = <<< XML
+<?xml version="1.0"?>
+<apple>
+ <pear>Pear</pear>
+</apple>
+XML;
+$doc = new DOMDocument();
+$doc->loadXML($xml);
+$result = $doc->relaxNGValidate($rng);
+var_dump($result);
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_basic.rng b/ext/dom/tests/DOMDocument_relaxNGValidate_basic.rng
new file mode 100644
index 000000000..35e351844
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_basic.rng
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <start>
+ <element name="apple">
+ <element name="pear">
+ <data type="NCName"/>
+ </element>
+ </element>
+ </start>
+</grammar>
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt
new file mode 100644
index 000000000..82957c35b
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt
@@ -0,0 +1,26 @@
+--TEST--
+DOMDocument::relaxNGValidate() should fail if document doesn't validate
+--CREDITS--
+Knut Urdalen <knut@php.net>
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$rng = dirname(__FILE__).'/DOMDocument_relaxNGValidate_basic.rng';
+$xml = <<< XML
+<?xml version="1.0"?>
+<apple>
+ <pear>Pear</pear>
+ <pear>Pear</pear>
+</apple>
+XML;
+$doc = new DOMDocument();
+$doc->loadXML($xml);
+$result = $doc->relaxNGValidate($rng);
+var_dump($result);
+?>
+--EXPECTF--
+Warning: DOMDocument::relaxNGValidate(): Did not expect element pear there in %s on line %d
+bool(false)
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
new file mode 100644
index 000000000..85749210b
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
@@ -0,0 +1,25 @@
+--TEST--
+DOMDocument::relaxNGValidate() should fail on invalid RelaxNG file source
+--CREDITS--
+Knut Urdalen <knut@php.net>
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$rng = dirname(__FILE__).'/foo.rng';
+$xml = <<< XML
+<?xml version="1.0"?>
+<apple>
+ <pear>Pear</pear>
+ <pear>Pear</pear>
+</apple>
+XML;
+$doc = new DOMDocument();
+$doc->loadXML($xml);
+$result = $doc->relaxNGValidate($rng);
+var_dump($result);
+?>
+--EXPECTF--
+
diff --git a/ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt b/ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt
index 6aa390ca9..403e01aa7 100644
--- a/ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt
+++ b/ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt
@@ -6,17 +6,14 @@ Hans Zaunere
--SKIPIF--
<?php
require_once('skipif.inc');
-
-// need external DTD/XML docs
-if( @file_get_contents('http://www.php.net/') === FALSE )
- exit('skip network not available');
?>
--FILE--
<?php
require_once('dom_test.inc');
-$XMLStringGood = file_get_contents('http://www.php.net/');
+chdir(__DIR__ . "/../examples");
+$XMLStringGood = file_get_contents('note.xml');
$dom = new DOMDocument;
$dom->resolveExternals = TRUE;
@@ -27,7 +24,7 @@ $dom->loadXML($XMLStringGood);
echo "No Error Report Above\n";
$BogusElement = $dom->createElement('NYPHP','DOMinatrix');
-$Body = $dom->getElementsByTagName('body')->item(0);
+$Body = $dom->getElementsByTagName('from')->item(0);
$Body->appendChild($BogusElement);
$XMLStringBad = $dom->saveXML();
@@ -44,6 +41,6 @@ validateOnParse set to TRUE:
Warning: DOMDocument::loadXML(): No declaration for element NYPHP in Entity, line: %d in %s on line %d
-Warning: DOMDocument::loadXML(): Element body content does not follow the DTD, expecting (p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | pre | hr | blockquote | address | fieldset | table | form | noscript | ins | del | script)*, got (div div div div div NYPHP) in Entity, line: %d in %s on line %d
+Warning: DOMDocument::loadXML(): Element from was declared #PCDATA but contains non text nodes in Entity, line: %d in %s on line %d
Error Report Above
diff --git a/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt b/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt
new file mode 100644
index 000000000..3b19ea461
--- /dev/null
+++ b/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+DOMImplementation::createDocumentType()
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+$imp = new DOMImplementation();
+$doctype = $imp->createDocumentType("html",
+ "-//W3C//DTD XHTML 1.0 Strict//EN",
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
+$doc = $imp->createDocument(null, 'html', $doctype);
+echo $doc->saveHTML();
+?>
+--EXPECTF--
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html></html>
diff --git a/ext/dom/tests/DOMImplementation_createDocument_basic.phpt b/ext/dom/tests/DOMImplementation_createDocument_basic.phpt
new file mode 100644
index 000000000..78d20aeee
--- /dev/null
+++ b/ext/dom/tests/DOMImplementation_createDocument_basic.phpt
@@ -0,0 +1,14 @@
+--TEST--
+DOMImplementation::createDocument()
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+$x = new DOMImplementation();
+$doc = $x->createDocument(null, 'html');
+echo $doc->saveHTML();
+?>
+--EXPECTF--
+<html></html>
diff --git a/ext/dom/tests/DOMImplementation_hasFeature_basic.phpt b/ext/dom/tests/DOMImplementation_hasFeature_basic.phpt
new file mode 100644
index 000000000..b53e912b7
--- /dev/null
+++ b/ext/dom/tests/DOMImplementation_hasFeature_basic.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DOMImplementation::hasFeature()
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+$imp = new DOMImplementation();
+var_dump($imp->hasFeature('Core', '1.0'));
+var_dump($imp->hasFeature('XML', '2.0'));
+?>
+--EXPECTF--
+bool(true)
+bool(true)
diff --git a/ext/dom/tests/DOMNode_C14NFile_basic.phpt b/ext/dom/tests/DOMNode_C14NFile_basic.phpt
new file mode 100644
index 000000000..6af6e3ecb
--- /dev/null
+++ b/ext/dom/tests/DOMNode_C14NFile_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+DOMNode::C14NFile()
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+$xml = <<< XML
+<?xml version="1.0" ?>
+<books>
+ <book>
+ <title>The Grapes of Wrath</title>
+ <author>John Steinbeck</author>
+ </book>
+ <book>
+ <title>The Pearl</title>
+ <author>John Steinbeck</author>
+ </book>
+</books>
+XML;
+
+$output = dirname(__FILE__).'/DOMNode_C14NFile_basic.tmp';
+$doc = new DOMDocument();
+$doc->loadXML($xml);
+$node = $doc->getElementsByTagName('title')->item(0);
+var_dump($node->C14NFile($output));
+$content = file_get_contents($output);
+var_dump($content);
+?>
+--CLEAN--
+<?php
+$output = dirname(__FILE__).'/DOMNode_C14NFile_basic.tmp';
+unlink($output);
+?>
+--EXPECTF--
+int(34)
+string(34) "<title>The Grapes of Wrath</title>"
diff --git a/ext/dom/tests/DOMNode_C14N_basic.phpt b/ext/dom/tests/DOMNode_C14N_basic.phpt
new file mode 100644
index 000000000..52a47a15d
--- /dev/null
+++ b/ext/dom/tests/DOMNode_C14N_basic.phpt
@@ -0,0 +1,29 @@
+--TEST--
+DOMNode::C14N()
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+$xml = <<< XML
+<?xml version="1.0" ?>
+<books>
+ <book>
+ <title>The Grapes of Wrath</title>
+ <author>John Steinbeck</author>
+ </book>
+ <book>
+ <title>The Pearl</title>
+ <author>John Steinbeck</author>
+ </book>
+</books>
+XML;
+
+$doc = new DOMDocument();
+$doc->loadXML($xml);
+$node = $doc->getElementsByTagName('title')->item(0);
+var_dump($node->C14N());
+?>
+--EXPECTF--
+string(34) "<title>The Grapes of Wrath</title>"
diff --git a/ext/dom/tests/DOMNode_getLineNo_basic.phpt b/ext/dom/tests/DOMNode_getLineNo_basic.phpt
new file mode 100644
index 000000000..3f57681c3
--- /dev/null
+++ b/ext/dom/tests/DOMNode_getLineNo_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+DOMNode::getLineNo()
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+$file = dirname(__FILE__).'/book.xml';
+$doc = new DOMDocument();
+$doc->load($file);
+$nodes = $doc->getElementsByTagName('title');
+foreach($nodes as $node) {
+ var_dump($node->getLineNo());
+}
+?>
+--EXPECTF--
+int(4)
+int(8)
diff --git a/ext/dom/tests/DOMNode_getNodePath_basic.phpt b/ext/dom/tests/DOMNode_getNodePath_basic.phpt
new file mode 100644
index 000000000..7c14ffab9
--- /dev/null
+++ b/ext/dom/tests/DOMNode_getNodePath_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+DOMNode::getNodePath()
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+$file = dirname(__FILE__).'/book.xml';
+$doc = new DOMDocument();
+$doc->load($file);
+$nodes = $doc->getElementsByTagName('title');
+foreach($nodes as $node) {
+ var_dump($node->getNodePath());
+}
+?>
+--EXPECTF--
+string(20) "/books/book[1]/title"
+string(20) "/books/book[2]/title"
diff --git a/ext/dom/tests/DOMNode_insertBefore_error1.phpt b/ext/dom/tests/DOMNode_insertBefore_error1.phpt
new file mode 100644
index 000000000..d655479d0
--- /dev/null
+++ b/ext/dom/tests/DOMNode_insertBefore_error1.phpt
@@ -0,0 +1,24 @@
+--TEST--
+DOMNode::insertBefore() should fail if node belongs to another document
+--CREDITS--
+Knut Urdalen <knut@php.net>
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$doc1 = new DOMDocument();
+$doc2 = new DOMDocument();
+
+$node_in_doc1 = $doc1->createElement("foo");
+$node_in_doc2 = $doc2->createElement("bar");
+
+try {
+ $node_in_doc2->insertBefore($node_in_doc1);
+} catch(DOMException $e) {
+ echo $e->getMessage();
+}
+
+?>
+--EXPECTF--
+Wrong Document Error
diff --git a/ext/dom/tests/bug54601.phpt b/ext/dom/tests/bug54601.phpt
new file mode 100644
index 000000000..8a2da2dee
--- /dev/null
+++ b/ext/dom/tests/bug54601.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Segfault when removing the Doctype node
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$xml = <<< XML
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE set PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN" "http://www.docbook.org/xml/5.0/dtd/docbook.dtd" [
+<!ENTITY foo '<foo>footext</foo>'>
+<!ENTITY bar '<bar>bartext</bar>'>
+]>
+<set>&foo;&bar;</set>
+XML;
+
+$doc = new DOMDocument();
+$doc->loadXML($xml, LIBXML_NOENT);
+$n = $doc->doctype;
+$doc->removeChild($n);
+var_dump($n);
+print $doc->saveXML();
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+object(DOMDocumentType)#%d (0) {
+}
+<?xml version="1.0" encoding="utf-8"?>
+<set><foo>footext</foo><bar>bartext</bar></set>
+===DONE===
diff --git a/ext/dom/tests/dom004.phpt b/ext/dom/tests/dom004.phpt
index 82b7915f6..5b65f24ba 100644
--- a/ext/dom/tests/dom004.phpt
+++ b/ext/dom/tests/dom004.phpt
@@ -3,7 +3,7 @@ Test 4: Streams Test
--SKIPIF--
<?php
require_once('skipif.inc');
-array_search('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrapper is not available');
+in_array('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrapper is not available');
?>
--FILE--
<?php
diff --git a/ext/dom/tests/dom005.phpt b/ext/dom/tests/dom005.phpt
index 249869eff..715aec402 100644
--- a/ext/dom/tests/dom005.phpt
+++ b/ext/dom/tests/dom005.phpt
@@ -27,10 +27,7 @@ html files with undeclared entities&#xA0;
</body></html>
--- save as HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
-<html>
-<head><title>Hello world</title></head>
-<body>
+<html><head><title>Hello world</title></head><body>
This is a not well-formed<br>
html files with undeclared entities&nbsp;
-</body>
-</html>
+</body></html>
diff --git a/ext/dom/tests/dom_xinclude.phpt b/ext/dom/tests/dom_xinclude.phpt
index bf335d032..686a9e81a 100644
--- a/ext/dom/tests/dom_xinclude.phpt
+++ b/ext/dom/tests/dom_xinclude.phpt
@@ -3,7 +3,7 @@ Test: Xinclude and Streams
--SKIPIF--
<?php
require_once('skipif.inc');
-array_search('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrapper is not available');
+in_array('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrapper is not available');
?>
--FILE--
<?php
diff --git a/ext/dom/text.c b/ext/dom/text.c
index f6058d9f4..4e761dc36 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: text.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: text.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -58,7 +58,7 @@ const zend_function_entry php_dom_text_class_functions[] = {
PHP_FALIAS(isElementContentWhitespace, dom_text_is_whitespace_in_element_content, arginfo_dom_text_is_whitespace_in_element_content)
PHP_FALIAS(replaceWholeText, dom_text_replace_whole_text, arginfo_dom_text_replace_whole_text)
PHP_ME(domtext, __construct, arginfo_dom_text_construct, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ proto void DOMText::__construct([string value]); */
diff --git a/ext/dom/typeinfo.c b/ext/dom/typeinfo.c
index 6554fdfdc..839e7ecd5 100644
--- a/ext/dom/typeinfo.c
+++ b/ext/dom/typeinfo.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: typeinfo.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: typeinfo.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -36,7 +36,7 @@
*/
const zend_function_entry php_dom_typeinfo_class_functions[] = {
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ attribute protos, not implemented yet */
diff --git a/ext/dom/userdatahandler.c b/ext/dom/userdatahandler.c
index 1ccac1eb9..0f1b82f4d 100644
--- a/ext/dom/userdatahandler.c
+++ b/ext/dom/userdatahandler.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: userdatahandler.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: userdatahandler.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -37,7 +37,7 @@
const zend_function_entry php_dom_userdatahandler_class_functions[] = {
PHP_FALIAS(handle, dom_userdatahandler_handle, NULL)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ attribute protos, not implemented yet */
diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h
index b6998afd2..8f93ed7ec 100644
--- a/ext/dom/xml_common.h
+++ b/ext/dom/xml_common.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xml_common.h 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: xml_common.h 314493 2011-08-08 12:29:32Z iliaa $ */
#ifndef PHP_XML_COMMON_H
#define PHP_XML_COMMON_H
@@ -78,12 +78,14 @@ PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj);
} \
}
-#define DOM_RET_OBJ(zval, obj, ret, domobject) \
- if (NULL == (zval = php_dom_create_object(obj, ret, zval, return_value, domobject TSRMLS_CC))) { \
+#define DOM_RET_OBJ_EX(obj, ret, domobject) \
+ if (!php_dom_create_object(obj, ret, NULL, 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 e9bd75340..6b650577b 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xpath.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: xpath.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -68,7 +68,7 @@ const zend_function_entry php_dom_xpath_class_functions[] = {
PHP_FALIAS(query, dom_xpath_query, arginfo_dom_xpath_query)
PHP_FALIAS(evaluate, dom_xpath_evaluate, arginfo_dom_xpath_evaluate)
PHP_FALIAS(registerPhpFunctions, dom_xpath_register_php_functions, arginfo_dom_xpath_register_php_functions)
- {NULL, NULL, NULL}
+ PHP_FE_END
};