summaryrefslogtreecommitdiff
path: root/ext/dom
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
committerSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
commitcd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f (patch)
tree1315c623bb7d9dfa8d366fa9cd2c6834ceeb5da5 /ext/dom
parent9ea47aab740772adf0c69d8c94b208a464e599ea (diff)
downloadphp-cd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f.tar.gz
Imported Upstream version 5.2.9.dfsg.1upstream/5.2.9.dfsg.1
Diffstat (limited to 'ext/dom')
-rw-r--r--ext/dom/attr.c4
-rw-r--r--ext/dom/cdatasection.c6
-rw-r--r--ext/dom/characterdata.c4
-rw-r--r--ext/dom/comment.c6
-rw-r--r--ext/dom/document.c8
-rw-r--r--ext/dom/documentfragment.c6
-rw-r--r--ext/dom/documenttype.c4
-rw-r--r--ext/dom/dom_ce.h4
-rw-r--r--ext/dom/dom_fe.h4
-rw-r--r--ext/dom/dom_iterators.c4
-rw-r--r--ext/dom/dom_properties.h4
-rw-r--r--ext/dom/domconfiguration.c8
-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/domimplementationlist.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.c12
-rw-r--r--ext/dom/entity.c4
-rw-r--r--ext/dom/entityreference.c4
-rw-r--r--ext/dom/namednodemap.c4
-rw-r--r--ext/dom/namelist.c4
-rw-r--r--ext/dom/node.c6
-rw-r--r--ext/dom/nodelist.c4
-rw-r--r--ext/dom/notation.c4
-rw-r--r--ext/dom/php_dom.c6
-rw-r--r--ext/dom/php_dom.h4
-rw-r--r--ext/dom/processinginstruction.c6
-rw-r--r--ext/dom/string_extend.c4
-rw-r--r--ext/dom/tests/DOMCharacterData_appendData_basic.phpt35
-rw-r--r--ext/dom/tests/DOMComment_appendData_basic.phpt21
-rw-r--r--ext/dom/tests/DOMComment_appendData_basic_Sullivan.phpt37
-rw-r--r--ext/dom/tests/DOMComment_insertData_basic.phpt21
-rw-r--r--ext/dom/tests/DOMComment_insertData_error1.phpt24
-rw-r--r--ext/dom/tests/DOMComment_insertData_error2.phpt24
-rw-r--r--ext/dom/tests/DOMComment_replaceData_basic.phpt29
-rw-r--r--ext/dom/tests/DOMComment_replaceData_error1.phpt24
-rw-r--r--ext/dom/tests/DOMComment_replaceData_error2.phpt24
-rw-r--r--ext/dom/tests/DOMDocumentFragment_appendXML_hasChildNodes_basic.phpt23
-rw-r--r--ext/dom/tests/DOMDocument_createAttribute_basic.phpt26
-rw-r--r--ext/dom/tests/DOMDocument_createAttribute_error.phpt27
-rw-r--r--ext/dom/tests/DOMDocument_createAttribute_error1.phpt29
-rw-r--r--ext/dom/tests/DOMDocument_createAttribute_variation.phpt14
-rw-r--r--ext/dom/tests/DOMDocument_createProcessingInstruction_basic.phpt30
-rw-r--r--ext/dom/tests/DOMDocument_createProcessingInstruction_error.phpt31
-rw-r--r--ext/dom/tests/DOMDocument_loadHTML_basic.phpt18
-rw-r--r--ext/dom/tests/DOMDocument_save_basic.phpt33
-rw-r--r--ext/dom/tests/DOMElement_hasAttributes_basic.phpt51
-rw-r--r--ext/dom/tests/DOMNode_cloneNode_basic.phpt111
-rw-r--r--ext/dom/tests/DOMNode_hasChildNodes_basic.phpt43
-rw-r--r--ext/dom/tests/DOMNode_issamenode_basic.phpt37
-rw-r--r--ext/dom/tests/DOMNode_normalize_basic.phpt64
-rw-r--r--ext/dom/tests/DOMNode_removeChild_basic.phpt113
-rw-r--r--ext/dom/tests/DOMNode_replaceChild_basic.phpt44
-rw-r--r--ext/dom/tests/DOMText_appendData_basic.phpt35
-rw-r--r--ext/dom/tests/bug34276.phpt2
-rw-r--r--ext/dom/tests/bug35342.phpt2
-rw-r--r--ext/dom/tests/bug42082.phpt4
-rw-r--r--ext/dom/tests/bug45251.phpt30
-rw-r--r--ext/dom/tests/bug46335.phpt35
-rw-r--r--ext/dom/tests/dom_comment_basic.phpt46
-rw-r--r--ext/dom/tests/dom_comment_variation.phpt33
-rw-r--r--ext/dom/text.c14
-rw-r--r--ext/dom/typeinfo.c4
-rw-r--r--ext/dom/userdatahandler.c4
-rw-r--r--ext/dom/xml_common.h4
-rw-r--r--ext/dom/xpath.c4
70 files changed, 1213 insertions, 93 deletions
diff --git a/ext/dom/attr.c b/ext/dom/attr.c
index a77c8e9ac..ea4538330 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: attr.c,v 1.18.2.2.2.4 2008/02/04 15:23:10 sebastian Exp $ */
+/* $Id: attr.c,v 1.18.2.2.2.5 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c
index d153026e3..0e1116994 100644
--- a/ext/dom/cdatasection.c
+++ b/ext/dom/cdatasection.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cdatasection.c,v 1.11.2.1.2.3 2008/02/04 15:23:10 sebastian Exp $ */
+/* $Id: cdatasection.c,v 1.11.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -73,7 +73,7 @@ PHP_METHOD(domcdatasection, __construct)
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
if (intern != NULL) {
- oldnode = (xmlNodePtr)intern->ptr;
+ oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode TSRMLS_CC);
}
diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c
index 20b5a3980..153533756 100644
--- a/ext/dom/characterdata.c
+++ b/ext/dom/characterdata.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: characterdata.c,v 1.15.2.1.2.4 2008/02/04 15:23:10 sebastian Exp $ */
+/* $Id: characterdata.c,v 1.15.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/comment.c b/ext/dom/comment.c
index 94d720352..2e7271ab0 100644
--- a/ext/dom/comment.c
+++ b/ext/dom/comment.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: comment.c,v 1.11.2.1.2.3 2008/02/04 15:23:10 sebastian Exp $ */
+/* $Id: comment.c,v 1.11.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -73,7 +73,7 @@ PHP_METHOD(domcomment, __construct)
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
if (intern != NULL) {
- oldnode = (xmlNodePtr)intern->ptr;
+ oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode TSRMLS_CC);
}
diff --git a/ext/dom/document.c b/ext/dom/document.c
index c5d504d2f..f699ac7f6 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: document.c,v 1.68.2.3.2.8 2008/02/04 15:23:10 sebastian Exp $ */
+/* $Id: document.c,v 1.68.2.3.2.11 2009/01/26 19:11:19 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -153,7 +153,7 @@ ZEND_END_ARG_INFO();
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savexml, 0, 0, 0)
- ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
+ ZEND_ARG_OBJ_INFO(0, node, DOMNode, 1)
ZEND_END_ARG_INFO();
static
@@ -1687,7 +1687,7 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int optio
EG(error_reporting) = old_error_reporting;
}
/* If loading from memory, set the base reference uri for the document */
- if (ret->URL == NULL && ctxt->directory != NULL) {
+ if (ret && ret->URL == NULL && ctxt->directory != NULL) {
ret->URL = xmlStrdup(ctxt->directory);
}
} else {
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c
index feaa8b52a..88b30e1c0 100644
--- a/ext/dom/documentfragment.c
+++ b/ext/dom/documentfragment.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: documentfragment.c,v 1.15.2.1.2.3 2008/02/04 15:23:10 sebastian Exp $ */
+/* $Id: documentfragment.c,v 1.15.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -76,7 +76,7 @@ PHP_METHOD(domdocumentfragment, __construct)
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
if (intern != NULL) {
- oldnode = (xmlNodePtr)intern->ptr;
+ oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode TSRMLS_CC);
}
diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
index db4fa4833..18365f1bc 100644
--- a/ext/dom/documenttype.c
+++ b/ext/dom/documenttype.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: documenttype.c,v 1.15.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
+/* $Id: documenttype.c,v 1.15.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/dom_ce.h b/ext/dom/dom_ce.h
index 14c832863..4d0c12d90 100644
--- a/ext/dom/dom_ce.h
+++ b/ext/dom/dom_ce.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_ce.h,v 1.8.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
+/* $Id: dom_ce.h,v 1.8.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
#ifndef DOM_CE_H
#define DOM_CE_H
diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h
index df791c8a5..f603bb39c 100644
--- a/ext/dom/dom_fe.h
+++ b/ext/dom/dom_fe.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_fe.h,v 1.14.2.1.2.5 2007/12/31 07:20:05 sebastian Exp $ */
+/* $Id: dom_fe.h,v 1.14.2.1.2.6 2008/12/31 11:17:37 sebastian Exp $ */
#ifndef DOM_FE_H
#define DOM_FE_H
diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c
index ef660cf4f..a56c83536 100644
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_iterators.c,v 1.9.2.3.2.6 2007/12/31 07:20:05 sebastian Exp $ */
+/* $Id: dom_iterators.c,v 1.9.2.3.2.7 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/dom_properties.h b/ext/dom/dom_properties.h
index 27ad5c1bd..6064bdc4b 100644
--- a/ext/dom/dom_properties.h
+++ b/ext/dom/dom_properties.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_properties.h,v 1.7.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
+/* $Id: dom_properties.h,v 1.7.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
#ifndef DOM_PROPERTIES_H
#define DOM_PROPERTIES_H
diff --git a/ext/dom/domconfiguration.c b/ext/dom/domconfiguration.c
index 21e14dd4b..98a81c762 100644
--- a/ext/dom/domconfiguration.c
+++ b/ext/dom/domconfiguration.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domconfiguration.c,v 1.5.2.1.2.3 2008/02/04 15:23:10 sebastian Exp $ */
+/* $Id: domconfiguration.c,v 1.5.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -32,7 +32,7 @@
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_set_parameter, 0, 0, 2)
ZEND_ARG_INFO(0, name)
- ZEND_ARG_OBJ_INFO(0, value, DOMUserData, 0)
+ ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
static
@@ -43,7 +43,7 @@ ZEND_END_ARG_INFO();
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_can_set_parameter, 0, 0, 0)
ZEND_ARG_INFO(0, name)
- ZEND_ARG_OBJ_INFO(0, value, DOMUserData, 0)
+ ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
/* }}} */
diff --git a/ext/dom/domerror.c b/ext/dom/domerror.c
index 4fae3eeb7..940c427e4 100644
--- a/ext/dom/domerror.c
+++ b/ext/dom/domerror.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domerror.c,v 1.6.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
+/* $Id: domerror.c,v 1.6.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/domerrorhandler.c b/ext/dom/domerrorhandler.c
index 493aa38f9..4da18ff2a 100644
--- a/ext/dom/domerrorhandler.c
+++ b/ext/dom/domerrorhandler.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domerrorhandler.c,v 1.5.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: domerrorhandler.c,v 1.5.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c
index 0bd87ece2..56ee632f2 100644
--- a/ext/dom/domexception.c
+++ b/ext/dom/domexception.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domexception.c,v 1.11.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
+/* $Id: domexception.c,v 1.11.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c
index 890a5abab..7a62b725e 100644
--- a/ext/dom/domimplementation.c
+++ b/ext/dom/domimplementation.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementation.c,v 1.15.2.2.2.4 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: domimplementation.c,v 1.15.2.2.2.5 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/domimplementationlist.c b/ext/dom/domimplementationlist.c
index d65e2beb6..d49298200 100644
--- a/ext/dom/domimplementationlist.c
+++ b/ext/dom/domimplementationlist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementationlist.c,v 1.6.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: domimplementationlist.c,v 1.6.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/domimplementationsource.c b/ext/dom/domimplementationsource.c
index 3bc4d2b9c..d9cba4a23 100644
--- a/ext/dom/domimplementationsource.c
+++ b/ext/dom/domimplementationsource.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementationsource.c,v 1.5.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: domimplementationsource.c,v 1.5.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/domlocator.c b/ext/dom/domlocator.c
index fd915a9d1..d80f13cbd 100644
--- a/ext/dom/domlocator.c
+++ b/ext/dom/domlocator.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domlocator.c,v 1.6.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
+/* $Id: domlocator.c,v 1.6.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/domstringlist.c b/ext/dom/domstringlist.c
index c902bbaf9..31810d962 100644
--- a/ext/dom/domstringlist.c
+++ b/ext/dom/domstringlist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domstringlist.c,v 1.6.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: domstringlist.c,v 1.6.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/element.c b/ext/dom/element.c
index 5f6614de7..8b754a4d4 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: element.c,v 1.36.2.4.2.10 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: element.c,v 1.36.2.4.2.12 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -585,6 +585,10 @@ PHP_FUNCTION(dom_element_set_attribute_node)
xmlUnlinkNode((xmlNodePtr) existattrp);
}
+ if (attrp->parent != NULL) {
+ xmlUnlinkNode((xmlNodePtr) attrp);
+ }
+
if (attrp->doc == NULL && nodep->doc != NULL) {
attrobj->document = intern->document;
php_libxml_increment_doc_ref((php_libxml_node_object *)attrobj, NULL TSRMLS_CC);
@@ -998,6 +1002,10 @@ PHP_FUNCTION(dom_element_set_attribute_node_ns)
xmlUnlinkNode((xmlNodePtr) existattrp);
}
+ if (attrp->parent != NULL) {
+ xmlUnlinkNode((xmlNodePtr) attrp);
+ }
+
if (attrp->doc == NULL && nodep->doc != NULL) {
attrobj->document = intern->document;
php_libxml_increment_doc_ref((php_libxml_node_object *)attrobj, NULL TSRMLS_CC);
diff --git a/ext/dom/entity.c b/ext/dom/entity.c
index 8781367ca..363d6d42a 100644
--- a/ext/dom/entity.c
+++ b/ext/dom/entity.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: entity.c,v 1.9.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
+/* $Id: entity.c,v 1.9.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c
index 740a29ebd..b01bcbf7a 100644
--- a/ext/dom/entityreference.c
+++ b/ext/dom/entityreference.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: entityreference.c,v 1.12.2.1.2.4 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: entityreference.c,v 1.12.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c
index 75885e101..2f83607a2 100644
--- a/ext/dom/namednodemap.c
+++ b/ext/dom/namednodemap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: namednodemap.c,v 1.15.2.2.2.3 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: namednodemap.c,v 1.15.2.2.2.4 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/namelist.c b/ext/dom/namelist.c
index 93b4778ec..c0c82b602 100644
--- a/ext/dom/namelist.c
+++ b/ext/dom/namelist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: namelist.c,v 1.7.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: namelist.c,v 1.7.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/node.c b/ext/dom/node.c
index d02f20a14..138c59dec 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: node.c,v 1.37.2.3.2.11 2008/01/30 06:48:20 sebastian Exp $ */
+/* $Id: node.c,v 1.37.2.3.2.13 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -112,7 +112,7 @@ ZEND_END_ARG_INFO();
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_set_user_data, 0, 0, 3)
ZEND_ARG_INFO(0, key)
- ZEND_ARG_OBJ_INFO(0, data, DOMUserData, 0)
+ ZEND_ARG_INFO(0, data)
ZEND_ARG_INFO(0, handler)
ZEND_END_ARG_INFO();
diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c
index fbd6bfd1c..ecea228dc 100644
--- a/ext/dom/nodelist.c
+++ b/ext/dom/nodelist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: nodelist.c,v 1.17.2.2.2.4 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: nodelist.c,v 1.17.2.2.2.5 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/notation.c b/ext/dom/notation.c
index 5009bfbe4..e30f5a875 100644
--- a/ext/dom/notation.c
+++ b/ext/dom/notation.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: notation.c,v 1.9.2.2.2.2 2007/12/31 07:20:06 sebastian Exp $ */
+/* $Id: notation.c,v 1.9.2.2.2.3 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index f994fc08f..37d4dc2a7 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.c,v 1.73.2.12.2.13 2007/12/31 07:20:06 sebastian Exp $ */
+/* $Id: php_dom.c,v 1.73.2.12.2.15 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -186,7 +186,7 @@ int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece,
if (ce) {
return zend_hash_update(doc_props->classmap, basece->name, basece->name_length + 1, &ce, sizeof(ce), NULL);
} else {
- return zend_hash_del(doc_props->classmap, basece->name, basece->name_length + 1);
+ zend_hash_del(doc_props->classmap, basece->name, basece->name_length + 1);
}
}
return SUCCESS;
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index 6f82067ad..61f11f3bb 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.h,v 1.28.2.1.2.5 2007/12/31 07:20:06 sebastian Exp $ */
+/* $Id: php_dom.h,v 1.28.2.1.2.6 2008/12/31 11:17:37 sebastian Exp $ */
#ifndef PHP_DOM_H
#define PHP_DOM_H
diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c
index cbfb29861..67354d829 100644
--- a/ext/dom/processinginstruction.c
+++ b/ext/dom/processinginstruction.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: processinginstruction.c,v 1.17.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: processinginstruction.c,v 1.17.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -81,7 +81,7 @@ PHP_METHOD(domprocessinginstruction, __construct)
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
if (intern != NULL) {
- oldnode = (xmlNodePtr)intern->ptr;
+ oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode TSRMLS_CC);
}
diff --git a/ext/dom/string_extend.c b/ext/dom/string_extend.c
index 60a522f1b..af0a1db27 100644
--- a/ext/dom/string_extend.c
+++ b/ext/dom/string_extend.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string_extend.c,v 1.5.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: string_extend.c,v 1.5.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/tests/DOMCharacterData_appendData_basic.phpt b/ext/dom/tests/DOMCharacterData_appendData_basic.phpt
new file mode 100644
index 000000000..ee590de80
--- /dev/null
+++ b/ext/dom/tests/DOMCharacterData_appendData_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+DOMCharacterData::appendData basic functionality test
+--CREDITS--
+Mike Sullivan <mike@regexia.com>
+#TestFest 2008 (London)
+--FILE--
+<?php
+
+$document = new DOMDocument;
+$root = $document->createElement('root');
+$document->appendChild($root);
+
+$cdata = $document->createElement('cdata');
+$root->appendChild($cdata);
+
+$cdatanode = $document->createCDATASection('');
+$cdata->appendChild($cdatanode);
+$cdatanode->appendData('data');
+echo "CDATA Length (one append): " . $cdatanode->length . "\n";
+
+$cdatanode->appendData('><&"');
+echo "CDATA Length (two appends): " . $cdatanode->length . "\n";
+
+echo "CDATA Content: " . $cdatanode->data . "\n";
+
+echo "\n" . $document->saveXML();
+
+?>
+--EXPECT--
+CDATA Length (one append): 4
+CDATA Length (two appends): 8
+CDATA Content: data><&"
+
+<?xml version="1.0"?>
+<root><cdata><![CDATA[data><&"]]></cdata></root> \ No newline at end of file
diff --git a/ext/dom/tests/DOMComment_appendData_basic.phpt b/ext/dom/tests/DOMComment_appendData_basic.phpt
new file mode 100644
index 000000000..c756f1665
--- /dev/null
+++ b/ext/dom/tests/DOMComment_appendData_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test adding data to a DOMComment
+--CREDITS--
+Andrew Larssen <al@larssen.org>
+London TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$dom = new DomDocument();
+$comment = $dom->createComment('test-comment');
+$comment->appendData('-more-data');
+$dom->appendChild($comment);
+$dom->saveXML();
+echo $dom->saveXML();
+
+?>
+--EXPECTF--
+<?xml version="1.0"?>
+<!--test-comment-more-data--> \ No newline at end of file
diff --git a/ext/dom/tests/DOMComment_appendData_basic_Sullivan.phpt b/ext/dom/tests/DOMComment_appendData_basic_Sullivan.phpt
new file mode 100644
index 000000000..ae06d8a87
--- /dev/null
+++ b/ext/dom/tests/DOMComment_appendData_basic_Sullivan.phpt
@@ -0,0 +1,37 @@
+--TEST--
+DOMComment::appendData basic functionality test
+--CREDITS--
+Mike Sullivan <mike@regexia.com>
+#TestFest 2008 (London)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$document = new DOMDocument;
+$root = $document->createElement('root');
+$document->appendChild($root);
+
+$comment = $document->createElement('comment');
+$root->appendChild($comment);
+
+$commentnode = $document->createComment('');
+$comment->appendChild($commentnode);
+$commentnode->appendData('data');
+echo "Comment Length (one append): " . $commentnode->length . "\n";
+
+$commentnode->appendData('><&"');
+echo "Comment Length (two appends): " . $commentnode->length . "\n";
+
+echo "Comment Content: " . $commentnode->data . "\n";
+
+echo "\n" . $document->saveXML();
+
+?>
+--EXPECT--
+Comment Length (one append): 4
+Comment Length (two appends): 8
+Comment Content: data><&"
+
+<?xml version="1.0"?>
+<root><comment><!--data><&"--></comment></root> \ No newline at end of file
diff --git a/ext/dom/tests/DOMComment_insertData_basic.phpt b/ext/dom/tests/DOMComment_insertData_basic.phpt
new file mode 100644
index 000000000..5a4857d67
--- /dev/null
+++ b/ext/dom/tests/DOMComment_insertData_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test inserting data into a DOMComment basic test
+--CREDITS--
+Andrew Larssen <al@larssen.org>
+London TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+//correct offset
+$dom = new DomDocument();
+$comment = $dom->createComment('test-comment');
+$comment->insertData(4,'-inserted');
+$dom->appendChild($comment);
+echo $dom->saveXML();
+
+?>
+--EXPECTF--
+<?xml version="1.0"?>
+<!--test-inserted-comment-->
diff --git a/ext/dom/tests/DOMComment_insertData_error1.phpt b/ext/dom/tests/DOMComment_insertData_error1.phpt
new file mode 100644
index 000000000..56922ac51
--- /dev/null
+++ b/ext/dom/tests/DOMComment_insertData_error1.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test inserting data into a DOMComment basic test
+--CREDITS--
+Andrew Larssen <al@larssen.org>
+London TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+//Negative offset
+$dom = new DomDocument();
+$comment = $dom->createComment('test-comment');
+try {
+ $comment->insertData(-1,'-inserted');
+} catch (DOMException $e ) {
+ if ($e->getMessage() == 'Index Size Error'){
+ echo "Throws DOMException for -ve offset\n";
+ }
+}
+
+?>
+--EXPECTF--
+Throws DOMException for -ve offset
diff --git a/ext/dom/tests/DOMComment_insertData_error2.phpt b/ext/dom/tests/DOMComment_insertData_error2.phpt
new file mode 100644
index 000000000..d2affa89e
--- /dev/null
+++ b/ext/dom/tests/DOMComment_insertData_error2.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test inserting data into a DOMComment basic test
+--CREDITS--
+Andrew Larssen <al@larssen.org>
+London TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+//offset to large
+$dom = new DomDocument();
+$comment = $dom->createComment('test-comment');
+try {
+ $comment->insertData(999,'-inserted');
+} catch (DOMException $e ) {
+ if ($e->getMessage() == 'Index Size Error'){
+ echo "Throws DOMException for offset too large\n";
+ }
+}
+
+?>
+--EXPECTF--
+Throws DOMException for offset too large \ No newline at end of file
diff --git a/ext/dom/tests/DOMComment_replaceData_basic.phpt b/ext/dom/tests/DOMComment_replaceData_basic.phpt
new file mode 100644
index 000000000..2963cb1e0
--- /dev/null
+++ b/ext/dom/tests/DOMComment_replaceData_basic.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test replacing data into a DOMComment basic test
+--CREDITS--
+Andrew Larssen <al@larssen.org>
+London TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$dom = new DomDocument();
+$comment = $dom->createComment('test-comment');
+$comment->replaceData(4,1,'replaced');
+$dom->appendChild($comment);
+echo $dom->saveXML();
+
+// Replaces rest of string if count is greater than length of existing string
+$dom = new DomDocument();
+$comment = $dom->createComment('test-comment');
+$comment->replaceData(0,50,'replaced');
+$dom->appendChild($comment);
+echo $dom->saveXML();
+
+?>
+--EXPECTF--
+<?xml version="1.0"?>
+<!--testreplacedcomment-->
+<?xml version="1.0"?>
+<!--replaced-->
diff --git a/ext/dom/tests/DOMComment_replaceData_error1.phpt b/ext/dom/tests/DOMComment_replaceData_error1.phpt
new file mode 100644
index 000000000..4ae4cb61d
--- /dev/null
+++ b/ext/dom/tests/DOMComment_replaceData_error1.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test replacing data into a DOMComment basic test
+--CREDITS--
+Andrew Larssen <al@larssen.org>
+London TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+//Negative offset
+$dom = new DomDocument();
+$comment = $dom->createComment('test-comment');
+try {
+ $comment->replaceData(-1,4,'-inserted');
+} catch (DOMException $e ) {
+ if ($e->getMessage() == 'Index Size Error'){
+ echo "Throws DOMException for -ve offest\n";
+ }
+}
+
+?>
+--EXPECTF--
+Throws DOMException for -ve offest
diff --git a/ext/dom/tests/DOMComment_replaceData_error2.phpt b/ext/dom/tests/DOMComment_replaceData_error2.phpt
new file mode 100644
index 000000000..89614f975
--- /dev/null
+++ b/ext/dom/tests/DOMComment_replaceData_error2.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test replacing data into a DOMComment basic test
+--CREDITS--
+Andrew Larssen <al@larssen.org>
+London TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+//offset to large
+$dom = new DomDocument();
+$comment = $dom->createComment('test-comment');
+try {
+ $comment->replaceData(999,4,'-inserted');
+} catch (DOMException $e ) {
+ if ($e->getMessage() == 'Index Size Error'){
+ echo "Throws DOMException for offest too large\n";
+ }
+}
+
+?>
+--EXPECTF--
+Throws DOMException for offest too large \ No newline at end of file
diff --git a/ext/dom/tests/DOMDocumentFragment_appendXML_hasChildNodes_basic.phpt b/ext/dom/tests/DOMDocumentFragment_appendXML_hasChildNodes_basic.phpt
new file mode 100644
index 000000000..c82a73b52
--- /dev/null
+++ b/ext/dom/tests/DOMDocumentFragment_appendXML_hasChildNodes_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Testing DOMDocumentFragment::appendXML and DOMDocumentFragment::hasChildNodes
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$doc = new DOMDocument();
+
+$fragment = $doc->createDocumentFragment();
+if ($fragment->hasChildNodes()) {
+ echo "has child nodes\n";
+} else {
+ echo "has no child nodes\n";
+}
+$fragment->appendXML('<foo>bar</foo>');
+if ($fragment->hasChildNodes()) {
+ echo "has child nodes\n";
+} else {
+ echo "has no child nodes\n";
+}
+--EXPECT--
+has no child nodes
+has child nodes
diff --git a/ext/dom/tests/DOMDocument_createAttribute_basic.phpt b/ext/dom/tests/DOMDocument_createAttribute_basic.phpt
new file mode 100644
index 000000000..4dd181b3f
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_createAttribute_basic.phpt
@@ -0,0 +1,26 @@
+--TEST--
+DomDocument::createAttribute() - basic test for DomDocument::createAttribute()
+--CREDITS--
+Muhammad Khalid Adnan
+# TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$doc = new DOMDocument;
+
+$node = $doc->createElement("para");
+$newnode = $doc->appendChild($node);
+
+// A pass case.
+$test_attribute = $doc->createAttribute("hahaha");
+$node->appendChild($test_attribute);
+
+echo $doc->saveXML();
+
+?>
+--EXPECT--
+<?xml version="1.0"?>
+<para hahaha=""/>
+
diff --git a/ext/dom/tests/DOMDocument_createAttribute_error.phpt b/ext/dom/tests/DOMDocument_createAttribute_error.phpt
new file mode 100644
index 000000000..bf71d554a
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_createAttribute_error.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test DOMDocument::createAttribute() for expected expection thrown when wrong parameter passed
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$dom = new DOMDocument();
+
+try {
+ $attr = $dom->createAttribute(0);
+}
+catch(DOMException $e) {
+ $code = $e->getCode();
+ if(DOM_INVALID_CHARACTER_ERR === $code) {
+ echo "PASS";
+ }
+ else {
+ echo 'Wrong exception code';
+ }
+}
+catch(Exception $e) {
+ echo 'Wrong exception thrown';
+}
+
+?>
+--EXPECTF--
+PASS
diff --git a/ext/dom/tests/DOMDocument_createAttribute_error1.phpt b/ext/dom/tests/DOMDocument_createAttribute_error1.phpt
new file mode 100644
index 000000000..745873aca
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_createAttribute_error1.phpt
@@ -0,0 +1,29 @@
+--TEST--
+DomDocument::createAttribute() - error test for DomDocument::createAttribute()
+--CREDITS--
+Muhammad Khalid Adnan
+# TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$doc = new DOMDocument;
+
+$node = $doc->createElement("para");
+$newnode = $doc->appendChild($node);
+
+try {
+ $failed_test_attribute = $doc->createAttribute("ha haha");
+ $node->appendChild($failed_test_attribute);
+
+ echo $doc->saveXML();
+}
+catch (DOMException $e) {
+ echo 'Test failed!', PHP_EOL;
+}
+
+?>
+--EXPECT--
+Test failed!
+
diff --git a/ext/dom/tests/DOMDocument_createAttribute_variation.phpt b/ext/dom/tests/DOMDocument_createAttribute_variation.phpt
new file mode 100644
index 000000000..ff81343cc
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_createAttribute_variation.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test DOMDocument::createAttribute() for expected return value
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$dom = new DOMDocument();
+
+$attr = $dom->createAttribute('string');
+echo get_class($attr);
+
+?>
+--EXPECTF--
+DOMAttr
diff --git a/ext/dom/tests/DOMDocument_createProcessingInstruction_basic.phpt b/ext/dom/tests/DOMDocument_createProcessingInstruction_basic.phpt
new file mode 100644
index 000000000..9f45f125d
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_createProcessingInstruction_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+DomDocument::createProcessingInstruction() - basic test for DomDocument::createProcessingInstruction()
+--CREDITS--
+Muhammad Khalid Adnan
+# TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$doc = new DOMDocument;
+
+$node = $doc->createElement("para");
+$newnode = $doc->appendChild($node);
+
+$test_proc_inst0 =
+ $doc->createProcessingInstruction( "blablabla" );
+$node->appendChild($test_proc_inst0);
+
+$test_proc_inst1 =
+ $doc->createProcessingInstruction( "blablabla", "datadata" );
+$node->appendChild($test_proc_inst1);
+
+echo $doc->saveXML();
+
+?>
+--EXPECT--
+<?xml version="1.0"?>
+<para><?blablabla?><?blablabla datadata?></para>
+
diff --git a/ext/dom/tests/DOMDocument_createProcessingInstruction_error.phpt b/ext/dom/tests/DOMDocument_createProcessingInstruction_error.phpt
new file mode 100644
index 000000000..a0c12b1fe
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_createProcessingInstruction_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DomDocument::createProcessingInstruction() - error test for DomDocument::createProcessingInstruction()
+--CREDITS--
+Muhammad Khalid Adnan
+# TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$doc = new DOMDocument;
+
+$node = $doc->createElement("para");
+$newnode = $doc->appendChild($node);
+
+try {
+ $test_proc_inst =
+ $doc->createProcessingInstruction( "bla bla bla" );
+ $node->appendChild($test_proc_inst);
+
+ echo $doc->saveXML();
+}
+catch (DOMException $e)
+{
+ echo 'Test failed!', PHP_EOL;
+}
+
+?>
+--EXPECT--
+Test failed!
+
diff --git a/ext/dom/tests/DOMDocument_loadHTML_basic.phpt b/ext/dom/tests/DOMDocument_loadHTML_basic.phpt
new file mode 100644
index 000000000..616d1d837
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_loadHTML_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+DOMDocument::loadHTML
+--CREDITS--
+Frank Cassedanne franck@ouarz.net
+#London TestFest 2008
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$doc = new DOMDocument();
+$doc->loadHTML("<html><body><p>Test<br></p></body></html>");
+echo $doc->saveHTML();
+?>
+--EXPECTF--
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html><body><p>Test<br></p></body></html>
diff --git a/ext/dom/tests/DOMDocument_save_basic.phpt b/ext/dom/tests/DOMDocument_save_basic.phpt
new file mode 100644
index 000000000..c7d1ead24
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_save_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DOMDocument::save Test basic function of save method
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$doc = new DOMDocument('1.0');
+$doc->formatOutput = true;
+
+$root = $doc->createElement('book');
+
+$root = $doc->appendChild($root);
+
+$title = $doc->createElement('title');
+$title = $root->appendChild($title);
+
+$text = $doc->createTextNode('This is the title');
+$text = $title->appendChild($text);
+
+$temp_filename = dirname(__FILE__)."/DomDocument_save_basic.tmp";
+
+echo 'Wrote: ' . $doc->save($temp_filename) . ' bytes'; // Wrote: 72 bytes
+?>
+--CLEAN--
+<?php
+ $temp_filename = dirname(__FILE__)."/DomDocument_save_basic.tmp";
+ unlink($temp_filename);
+?>
+--EXPECTF--
+Wrote: 72 bytes
+
diff --git a/ext/dom/tests/DOMElement_hasAttributes_basic.phpt b/ext/dom/tests/DOMElement_hasAttributes_basic.phpt
new file mode 100644
index 000000000..36c4f5873
--- /dev/null
+++ b/ext/dom/tests/DOMElement_hasAttributes_basic.phpt
@@ -0,0 +1,51 @@
+--TEST--
+DOMNode: hasAttributes()
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--CREDITS--
+James Lewis <james@s-1.com>
+#TestFest 2008
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML($xmlstr);
+if(!$dom) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+
+$element = $dom->documentElement;
+
+echo "Verify that we have a DOMElement object:\n";
+var_dump($element);
+
+echo "\nElement should have attributes:\n";
+var_dump($element->hasAttributes());
+
+$nodelist=$dom->getElementsByTagName('tbody') ;
+$element = $nodelist->item(0);
+
+echo "\nVerify that we have a DOMElement object:\n";
+var_dump($element);
+
+echo "\nElement should have no attributes:\n";
+var_dump($element->hasAttributes())
+
+
+?>
+--EXPECTF--
+Verify that we have a DOMElement object:
+object(DOMElement)#%d (0) {
+}
+
+Element should have attributes:
+bool(true)
+
+Verify that we have a DOMElement object:
+object(DOMElement)#%d (0) {
+}
+
+Element should have no attributes:
+bool(false)
diff --git a/ext/dom/tests/DOMNode_cloneNode_basic.phpt b/ext/dom/tests/DOMNode_cloneNode_basic.phpt
new file mode 100644
index 000000000..16b8533f7
--- /dev/null
+++ b/ext/dom/tests/DOMNode_cloneNode_basic.phpt
@@ -0,0 +1,111 @@
+--TEST--
+DOM cloneNode : Basic Functionality
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--CREDITS--
+Simon Hughes <odbc3@hotmail.com>
+--FILE--
+<?php
+
+$xml = <<< EOXML
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<courses>
+ <course title="one">
+ <notes>
+ <note>c1n1</note>
+ <note>c1n2</note>
+ </notes>
+ </course>
+ <course title="two">
+ <notes>
+ <note>c2n1</note>
+ <note>c2n2</note>
+ </notes>
+ </course>
+</courses>
+EOXML;
+
+function dumpcourse($current) {
+ $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title";
+ echo "Course: $title:";var_dump($current);
+ echo "~";var_dump($current->textContent);
+}
+
+$dom = new DOMDocument();
+$dom->loadXML($xml);
+$root = $dom->documentElement;
+
+// strip all text nodes from this tree
+$children = $root->childNodes;
+$len = $children->length;
+for ($index = $children->length - 1; $index >=0; $index--) {
+ $current = $children->item($index);
+ if ($current->nodeType == XML_TEXT_NODE) {
+ $noderemoved = $root->removeChild($current);
+ }
+}
+
+echo "Start cloneNode test\n";
+$first_course = $children->item(0);
+$cloned_first_course_default = $first_course->cloneNode();
+$first_course->setAttribute('title', 'new title1');
+
+$cloned_first_course_true = $first_course->cloneNode(true);
+$first_course->setAttribute('title', 'new title2');
+
+$cloned_first_course_false = $first_course->cloneNode(false);
+$first_course->setAttribute('title', 'new title3');
+
+$cloned_first_course_default->setAttribute('title', 'new title default');
+$cloned_first_course_true->setAttribute('title', 'new title true');
+$cloned_first_course_false->setAttribute('title', 'new title false');
+
+$root->appendChild($cloned_first_course_default);
+$root->appendChild($cloned_first_course_true);
+$root->appendChild($cloned_first_course_false);
+
+$children = $root->childNodes;
+for ($index = 0; $index < $children->length; $index++) {
+ echo "node $index\n";
+ dumpcourse($children->item($index));
+}
+
+--EXPECTF--
+Start cloneNode test
+node 0
+Course: new title3:object(DOMElement)#6 (0) {
+}
+~string(24) "
+
+ c1n1
+ c1n2
+
+ "
+node 1
+Course: two:object(DOMElement)#3 (0) {
+}
+~string(24) "
+
+ c2n1
+ c2n2
+
+ "
+node 2
+Course: new title default:object(DOMElement)#4 (0) {
+}
+~string(0) ""
+node 3
+Course: new title true:object(DOMElement)#7 (0) {
+}
+~string(24) "
+
+ c1n1
+ c1n2
+
+ "
+node 4
+Course: new title false:object(DOMElement)#8 (0) {
+}
+~string(0) "" \ No newline at end of file
diff --git a/ext/dom/tests/DOMNode_hasChildNodes_basic.phpt b/ext/dom/tests/DOMNode_hasChildNodes_basic.phpt
new file mode 100644
index 000000000..3a6f6b421
--- /dev/null
+++ b/ext/dom/tests/DOMNode_hasChildNodes_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test whether a node has child nodes: hasChildNodes()
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+
+/* Create an XML document
+ * with strcuture
+ * <book>
+ * <title>This is the title</title>
+ * </book>
+ * Check for child nodes of the <book>, <title> and This is the title
+ *
+*/
+
+$doc = new DOMDocument();
+
+$root = $doc->createElement('book');
+$doc->appendChild($root);
+
+$title = $doc->createElement('title');
+$root->appendChild($title);
+
+$text = $doc->createTextNode('This is the title');
+$title->appendChild($text);
+
+echo "Root has child nodes: ";
+var_dump($root->hasChildNodes());
+
+echo "Title has child nodes: ";
+var_dump($title->hasChildNodes());
+
+echo "Text has child nodes: ";
+var_dump($text->hasChildNodes());
+
+?>
+--EXPECTF--
+Root has child nodes: bool(true)
+Title has child nodes: bool(true)
+Text has child nodes: bool(false) \ No newline at end of file
diff --git a/ext/dom/tests/DOMNode_issamenode_basic.phpt b/ext/dom/tests/DOMNode_issamenode_basic.phpt
new file mode 100644
index 000000000..e008340ea
--- /dev/null
+++ b/ext/dom/tests/DOMNode_issamenode_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+DOMNode: isSameNode()
+--CREDITS--
+James Lewis <james@s-1.com>
+#TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument;
+$dom->loadXML($xmlstr);
+if(!$dom) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+
+$node = $dom->documentElement;
+if($node->isSameNode($node))
+ echo "EXPECTING SAME NODE, PASSED\n" ;
+else
+ echo "EXPECTING SAME NODE, FAILED\n" ;
+
+$nodelist=$dom->getElementsByTagName('tbody') ;
+
+if($nodelist->item(0)->isSameNode($node))
+ echo "EXPECTING NOT SAME NODE, FAILED\n" ;
+else
+ echo "EXPECTING NOT SAME NODE, PASSED\n" ;
+
+?>
+===DONE===
+--EXPECT--
+EXPECTING SAME NODE, PASSED
+EXPECTING NOT SAME NODE, PASSED
+===DONE===
diff --git a/ext/dom/tests/DOMNode_normalize_basic.phpt b/ext/dom/tests/DOMNode_normalize_basic.phpt
new file mode 100644
index 000000000..e413fb033
--- /dev/null
+++ b/ext/dom/tests/DOMNode_normalize_basic.phpt
@@ -0,0 +1,64 @@
+--TEST--
+DOMNode::normalize()
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+
+/* Create an XML document
+ * with structure
+ * <book>
+ * <author></author>
+ * <title>This is the title</title>
+ * </book>
+ * Calculate the number of title text nodes (1).
+ * Add another text node to title. Calculate the number of title text nodes (2).
+ * Normalize author. Calculate the number of title text nodes (2).
+ * Normalize title. Calculate the number of title text nodes (1).
+*/
+
+$doc = new DOMDocument();
+
+$root = $doc->createElement('book');
+$doc->appendChild($root);
+
+$title = $doc->createElement('title');
+$root->appendChild($title);
+
+$author = $doc->createElement('author');
+$root->appendChild($author);
+
+$text = $doc->createTextNode('This is the first title');
+$title->appendChild($text);
+
+echo "Number of child nodes of title = ";
+var_dump($title->childNodes->length);
+
+// add a second text node to title
+$text = $doc->createTextNode('This is the second title');
+$title->appendChild($text);
+
+echo "Number of child nodes of title after adding second title = ";
+var_dump($title->childNodes->length);
+
+// should do nothing
+$author->normalize();
+
+echo "Number of child nodes of title after normalizing author = ";
+var_dump($title->childNodes->length);
+
+
+// should concatenate first and second title text nodes
+$title->normalize();
+
+echo "Number of child nodes of title after normalizing title = ";
+var_dump($title->childNodes->length);
+
+?>
+--EXPECTF--
+Number of child nodes of title = int(1)
+Number of child nodes of title after adding second title = int(2)
+Number of child nodes of title after normalizing author = int(2)
+Number of child nodes of title after normalizing title = int(1) \ No newline at end of file
diff --git a/ext/dom/tests/DOMNode_removeChild_basic.phpt b/ext/dom/tests/DOMNode_removeChild_basic.phpt
new file mode 100644
index 000000000..8609e58be
--- /dev/null
+++ b/ext/dom/tests/DOMNode_removeChild_basic.phpt
@@ -0,0 +1,113 @@
+--TEST--
+DOM removeChild : Basic Functionality
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--CREDITS--
+Simon Hughes <odbc3@hotmail.com>
+--FILE--
+<?php
+
+$xml = <<< EOXML
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<courses>
+ <course title="one">
+ <notes>
+ <note>c1n1</note>
+ <note>c1n2</note>
+ </notes>
+ </course>
+ <course title="two">
+ <notes>
+ <note>c2n1</note>
+ <note>c2n2</note>
+ </notes>
+ </course>
+</courses>
+EOXML;
+
+function dumpcourse($current) {
+ $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title";
+ echo "Course: $title:";var_dump($current);
+ echo "~";var_dump($current->textContent);
+}
+
+$dom = new DOMDocument();
+$dom->loadXML($xml);
+$root = $dom->documentElement;
+
+$children = $root->childNodes;
+$len = $children->length;
+echo "orignal has $len nodes\n";
+for ($index = $children->length - 1; $index >=0; $index--) {
+ echo "node $index\n";
+ $current = $children->item($index);
+ dumpcourse($current);
+ if ($current->nodeType == XML_TEXT_NODE) {
+ $noderemoved = $root->removeChild($current);
+ }
+}
+$children = $root->childNodes;
+$len = $children->length;
+echo "after text removed it now has $len nodes\n";
+for ($index = 0; $index < $children->length; $index++) {
+ echo "node $index\n";
+ $current = $children->item($index);
+ dumpcourse($current);
+}
+
+--EXPECTF--
+orignal has 5 nodes
+node 4
+Course: no title:object(DOMText)#4 (0) {
+}
+~string(1) "
+"
+node 3
+Course: two:object(DOMElement)#5 (0) {
+}
+~string(24) "
+
+ c2n1
+ c2n2
+
+ "
+node 2
+Course: no title:object(DOMText)#6 (0) {
+}
+~string(2) "
+ "
+node 1
+Course: one:object(DOMElement)#4 (0) {
+}
+~string(24) "
+
+ c1n1
+ c1n2
+
+ "
+node 0
+Course: no title:object(DOMText)#5 (0) {
+}
+~string(2) "
+ "
+after text removed it now has 2 nodes
+node 0
+Course: one:object(DOMElement)#3 (0) {
+}
+~string(24) "
+
+ c1n1
+ c1n2
+
+ "
+node 1
+Course: two:object(DOMElement)#4 (0) {
+}
+~string(24) "
+
+ c2n1
+ c2n2
+
+ " \ No newline at end of file
diff --git a/ext/dom/tests/DOMNode_replaceChild_basic.phpt b/ext/dom/tests/DOMNode_replaceChild_basic.phpt
new file mode 100644
index 000000000..49fc05501
--- /dev/null
+++ b/ext/dom/tests/DOMNode_replaceChild_basic.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Replacing a child node
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--CREDITS--
+Matt Raines <matt@raines.me.uk>
+#London TestFest 2008
+--FILE--
+<?php
+$document = new DOMDocument();
+$document->loadXML('<?xml version="1.0" encoding="utf-8"?>
+<root><foo><bar/><baz/></foo><spam><eggs/><eggs/></spam></root>');
+
+// Replaces the child node oldChild with newChild in the list of children, and
+// returns the oldChild node.
+$parent = $document->getElementsByTagName('foo')->item(0);
+$new_child = $document->createElement('qux');
+$old_child = $parent->replaceChild($new_child, $parent->firstChild);
+echo "New child replaces old child:\n" . $document->saveXML();
+echo "Old child is returned:\n" . $old_child->tagName . "\n";
+
+// If the newChild is already in the tree, it is first removed.
+$parent = $document->getElementsByTagName('spam')->item(0);
+$parent->replaceChild($new_child, $parent->firstChild);
+echo "Existing child is removed from tree:\n" . $document->saveXML();
+
+// Children are inserted in the correct order.
+$new_child = $document->getElementsByTagName('spam')->item(0);
+$parent = $document->getElementsByTagName('foo')->item(0);
+$parent->replaceChild($new_child, $parent->firstChild);
+echo "Children are inserted in order:\n" . $document->saveXML();
+?>
+--EXPECT--
+New child replaces old child:
+<?xml version="1.0" encoding="utf-8"?>
+<root><foo><qux/><baz/></foo><spam><eggs/><eggs/></spam></root>
+Old child is returned:
+bar
+Existing child is removed from tree:
+<?xml version="1.0" encoding="utf-8"?>
+<root><foo><baz/></foo><spam><qux/><eggs/></spam></root>
+Children are inserted in order:
+<?xml version="1.0" encoding="utf-8"?>
+<root><foo><spam><qux/><eggs/></spam></foo></root>
diff --git a/ext/dom/tests/DOMText_appendData_basic.phpt b/ext/dom/tests/DOMText_appendData_basic.phpt
new file mode 100644
index 000000000..6a28a9ae4
--- /dev/null
+++ b/ext/dom/tests/DOMText_appendData_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+DOMText::appendData basic functionality test
+--CREDITS--
+Mike Sullivan <mike@regexia.com>
+#TestFest 2008 (London)
+--FILE--
+<?php
+
+$document = new DOMDocument;
+$root = $document->createElement('root');
+$document->appendChild($root);
+
+$text = $document->createElement('text');
+$root->appendChild($text);
+
+$textnode = $document->createTextNode('');
+$text->appendChild($textnode);
+$textnode->appendData('data');
+echo "Text Length (one append): " . $textnode->length . "\n";
+
+$textnode->appendData('><&"');
+echo "Text Length (two appends): " . $textnode->length . "\n";
+
+echo "Text Content: " . $textnode->data . "\n";
+
+echo "\n" . $document->saveXML();
+
+?>
+--EXPECT--
+Text Length (one append): 4
+Text Length (two appends): 8
+Text Content: data><&"
+
+<?xml version="1.0"?>
+<root><text>data&gt;&lt;&amp;"</text></root> \ No newline at end of file
diff --git a/ext/dom/tests/bug34276.phpt b/ext/dom/tests/bug34276.phpt
index fd265e58e..6959d90a9 100644
--- a/ext/dom/tests/bug34276.phpt
+++ b/ext/dom/tests/bug34276.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #34276 setAttributeNS and default namespace
+Bug #34276 (setAttributeNS and default namespace)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/dom/tests/bug35342.phpt b/ext/dom/tests/bug35342.phpt
index 3248c7339..f93c06233 100644
--- a/ext/dom/tests/bug35342.phpt
+++ b/ext/dom/tests/bug35342.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #35342 isset(DOMNodeList->length) returns false
+Bug #35342 (isset(DOMNodeList->length) returns false)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/dom/tests/bug42082.phpt b/ext/dom/tests/bug42082.phpt
index 3e20a6b13..86f32dd8d 100644
--- a/ext/dom/tests/bug42082.phpt
+++ b/ext/dom/tests/bug42082.phpt
@@ -8,7 +8,7 @@ $nodes = $xpath->query('*');
var_dump($nodes);
var_dump($nodes->length);
$length = $nodes->length;
-var_dump(empty($nodes->length), empty($lenght));
+var_dump(empty($nodes->length), empty($length));
$doc->loadXML("<element></element>");
var_dump($doc->firstChild->nodeValue, empty($doc->firstChild->nodeValue), isset($doc->firstChild->nodeValue));
@@ -24,4 +24,4 @@ string(0) ""
bool(true)
bool(true)
bool(false)
-bool(false)
+bool(false) \ No newline at end of file
diff --git a/ext/dom/tests/bug45251.phpt b/ext/dom/tests/bug45251.phpt
new file mode 100644
index 000000000..652e3b253
--- /dev/null
+++ b/ext/dom/tests/bug45251.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #45251 (double free or corruption with setAttributeNode())
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$doc = new DOMDocument;
+$doc->loadXml(<<<EOF
+<?xml version="1.0" encoding="utf-8" ?>
+<aaa>
+ <bbb foo="bar"/>
+</aaa>
+EOF
+);
+
+$xpath = new DOMXPath($doc);
+
+$bbb = $xpath->query('bbb', $doc->documentElement)->item(0);
+
+$ccc = $doc->createElement('ccc');
+foreach ($bbb->attributes as $attr)
+{
+ $ccc->setAttributeNode($attr);
+}
+
+echo $attr->parentNode->localName;
+
+?>
+--EXPECT--
+ccc
diff --git a/ext/dom/tests/bug46335.phpt b/ext/dom/tests/bug46335.phpt
new file mode 100644
index 000000000..bea4ae9e7
--- /dev/null
+++ b/ext/dom/tests/bug46335.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #46335 (DOMText::splitText doesn't handle multibyte characters).
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$textascii = 'This is an "example" of using DOM splitText';
+$text = 'This is an ‘example’ of using DOM splitText';
+$start = 30;
+$length = 3;
+
+$dom = new DOMDocument('1.0', 'UTF-8');
+$node = $dom->createTextNode($textascii);
+$dom->appendChild($node);
+
+print "Text: $node->textContent\n";
+
+$matched = $node->splitText($start);
+$matched->splitText($length);
+print "splitText (ASCII): $matched->textContent\n";
+
+$node = $dom->createTextNode($text);
+$dom->appendChild($node);
+
+print "Text: $node->textContent\n";
+
+$matched = $node->splitText($start);
+$matched->splitText($length);
+print "splitText (UTF-8): $matched->textContent\n";
+?>
+--EXPECT--
+Text: This is an "example" of using DOM splitText
+splitText (ASCII): DOM
+Text: This is an ‘example’ of using DOM splitText
+splitText (UTF-8): DOM
diff --git a/ext/dom/tests/dom_comment_basic.phpt b/ext/dom/tests/dom_comment_basic.phpt
new file mode 100644
index 000000000..cb029ed04
--- /dev/null
+++ b/ext/dom/tests/dom_comment_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+DOM Comment : Basic Functionality
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+$xml = <<< EOXML
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<courses>
+ <!-- Hello World! -->
+</courses>
+EOXML;
+
+$dom = new DOMDocument();
+$dom->loadXML($xml);
+$root = $dom->documentElement;
+var_dump($root->hasChildNodes());
+$children = $root->childNodes;
+
+for ($index = 0; $index < $children->length; $index++) {
+ echo "--- child $index ---\n";
+ $current = $children->item($index);
+ var_dump($current);
+ var_dump($current->textContent);
+}
+
+--EXPECTF--
+bool(true)
+--- child 0 ---
+object(DOMText)#%d (0) {
+}
+string(2) "
+ "
+--- child 1 ---
+object(DOMComment)#%d (0) {
+}
+string(14) " Hello World! "
+--- child 2 ---
+object(DOMText)#%d (0) {
+}
+string(1) "
+"
+
diff --git a/ext/dom/tests/dom_comment_variation.phpt b/ext/dom/tests/dom_comment_variation.phpt
new file mode 100644
index 000000000..bef0ef1b1
--- /dev/null
+++ b/ext/dom/tests/dom_comment_variation.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DOM Comment : Variation
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+$xml = <<< EOXML
+<?xml version="1.0" encoding="ISO-8859-1"?><courses><!-- Hello World! --></courses>
+EOXML;
+
+$dom = new DOMDocument();
+$dom->loadXML($xml);
+$root = $dom->documentElement;
+var_dump($root->hasChildNodes());
+$children = $root->childNodes;
+
+for ($index = 0; $index < $children->length; $index++) {
+ echo "--- child $index ---\n";
+ $current = $children->item($index);
+ var_dump($current);
+ var_dump($current->textContent);
+}
+
+--EXPECTF--
+bool(true)
+--- child 0 ---
+object(DOMComment)#%d (0) {
+}
+string(14) " Hello World! "
+
diff --git a/ext/dom/text.c b/ext/dom/text.c
index 82f871d4e..b0acfa014 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: text.c,v 1.23.2.1.2.6 2008/02/04 15:23:11 sebastian Exp $ */
+/* $Id: text.c,v 1.23.2.1.2.9 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -91,7 +91,7 @@ PHP_METHOD(domtext, __construct)
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
if (intern != NULL) {
- oldnode = (xmlNodePtr)intern->ptr;
+ oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode TSRMLS_CC);
}
@@ -172,19 +172,19 @@ PHP_FUNCTION(dom_text_split_text)
if (cur == NULL) {
RETURN_FALSE;
}
- length = xmlStrlen(cur);
+ length = xmlUTF8Strlen(cur);
if (offset > length || offset < 0) {
xmlFree(cur);
RETURN_FALSE;
}
- first = xmlStrndup(cur, offset);
- second = xmlStrdup(cur + offset);
+ first = xmlUTF8Strndup(cur, offset);
+ second = xmlUTF8Strsub(cur, offset, length - offset);
xmlFree(cur);
- xmlNodeSetContentLen(node, first, offset);
+ xmlNodeSetContent(node, first);
nnode = xmlNewDocText(node->doc, second);
xmlFree(first);
diff --git a/ext/dom/typeinfo.c b/ext/dom/typeinfo.c
index 0dd169329..8753be925 100644
--- a/ext/dom/typeinfo.c
+++ b/ext/dom/typeinfo.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: typeinfo.c,v 1.6.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
+/* $Id: typeinfo.c,v 1.6.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/userdatahandler.c b/ext/dom/userdatahandler.c
index 3a43fd6cb..a2655c743 100644
--- a/ext/dom/userdatahandler.c
+++ b/ext/dom/userdatahandler.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: userdatahandler.c,v 1.6.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
+/* $Id: userdatahandler.c,v 1.6.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h
index a96861697..3578763a8 100644
--- a/ext/dom/xml_common.h
+++ b/ext/dom/xml_common.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xml_common.h,v 1.23.2.1.2.3 2007/12/31 07:20:06 sebastian Exp $ */
+/* $Id: xml_common.h,v 1.23.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
#ifndef PHP_XML_COMMON_H
#define PHP_XML_COMMON_H
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index 9910e4e25..76561fef6 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xpath.c,v 1.26.2.1.2.3 2008/01/29 15:55:29 sebastian Exp $ */
+/* $Id: xpath.c,v 1.26.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"