summaryrefslogtreecommitdiff
path: root/ext/dom
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 19:39:21 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 19:39:21 -0400
commit6821b67124604da690c5e9276d5370d679c63ac8 (patch)
treebefb4ca2520eb577950cef6cb76d10b914cbf67a /ext/dom
parentcd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f (diff)
downloadphp-6821b67124604da690c5e9276d5370d679c63ac8.tar.gz
Imported Upstream version 5.3.0RC1upstream/5.3.0_RC1upstream/5.3.0RC1
Diffstat (limited to 'ext/dom')
-rw-r--r--ext/dom/attr.c43
-rw-r--r--ext/dom/cdatasection.c21
-rw-r--r--ext/dom/characterdata.c26
-rw-r--r--ext/dom/comment.c22
-rw-r--r--ext/dom/config.w3236
-rw-r--r--ext/dom/document.c153
-rw-r--r--ext/dom/documentfragment.c28
-rw-r--r--ext/dom/documenttype.c23
-rw-r--r--ext/dom/dom_ce.h11
-rw-r--r--ext/dom/dom_fe.h73
-rw-r--r--ext/dom/dom_iterators.c50
-rw-r--r--ext/dom/dom_properties.h11
-rw-r--r--ext/dom/domconfiguration.c23
-rw-r--r--ext/dom/domerror.c25
-rw-r--r--ext/dom/domerrorhandler.c19
-rw-r--r--ext/dom/domexception.c18
-rw-r--r--ext/dom/domimplementation.c25
-rw-r--r--ext/dom/domimplementationlist.c21
-rw-r--r--ext/dom/domimplementationsource.c20
-rw-r--r--ext/dom/domlocator.c22
-rw-r--r--ext/dom/domstringlist.c21
-rw-r--r--ext/dom/element.c147
-rw-r--r--ext/dom/entity.c23
-rw-r--r--ext/dom/entityreference.c24
-rw-r--r--ext/dom/namednodemap.c32
-rw-r--r--ext/dom/namelist.c21
-rw-r--r--ext/dom/node.c184
-rw-r--r--ext/dom/nodelist.c16
-rw-r--r--ext/dom/notation.c18
-rw-r--r--ext/dom/php_dom.c168
-rw-r--r--ext/dom/php_dom.h25
-rw-r--r--ext/dom/processinginstruction.c25
-rw-r--r--ext/dom/string_extend.c21
-rw-r--r--ext/dom/tests/DOMCharacterData_appendData_basic.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_savexml_basic.phpt39
-rw-r--r--ext/dom/tests/DOMElement_hasAttributes_basic.phpt4
-rw-r--r--ext/dom/tests/DOMNode_hasChildNodes.phpt49
-rw-r--r--ext/dom/tests/DOMNode_insertBefore.phpt34
-rw-r--r--ext/dom/tests/bug38474.phpt2
-rw-r--r--ext/dom/tests/bug43364.phpt2
-rw-r--r--ext/dom/tests/bug44648.phpt45
-rw-r--r--ext/dom/tests/bug46185.phpt23
-rw-r--r--ext/dom/tests/bug46849.phpt16
-rw-r--r--ext/dom/tests/bug47430.phpt30
-rw-r--r--ext/dom/tests/dom003.phpt14
-rw-r--r--ext/dom/tests/dom_set_attr_node.phpt14
-rw-r--r--ext/dom/tests/dom_xinclude.phpt4
-rw-r--r--ext/dom/tests/domxpath.phpt58
-rw-r--r--ext/dom/text.c28
-rw-r--r--ext/dom/typeinfo.c17
-rw-r--r--ext/dom/userdatahandler.c17
-rw-r--r--ext/dom/xml_common.h32
-rw-r--r--ext/dom/xpath.c310
53 files changed, 1446 insertions, 689 deletions
diff --git a/ext/dom/attr.c b/ext/dom/attr.c
index ea4538330..a3133ff7b 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: attr.c,v 1.18.2.2.2.5 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: attr.c,v 1.18.2.2.2.2.2.12 2009/03/13 13:43:29 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,13 +29,10 @@
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_attr_is_id, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_attr_construct, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, value)
@@ -49,7 +46,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_attr_class_functions[] = {
+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}
@@ -65,14 +62,15 @@ PHP_METHOD(domattr, __construct)
dom_object *intern;
char *name, *value = NULL;
int name_len, value_len, name_valid;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_attr_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
name_valid = xmlValidateName((xmlChar *) name, 0);
@@ -99,7 +97,6 @@ PHP_METHOD(domattr, __construct)
/* }}} end DOMAttr::__construct */
-
/* {{{ name string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-1112119403
@@ -124,8 +121,6 @@ int dom_attr_name_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ specified boolean
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-862529273
@@ -141,8 +136,6 @@ int dom_attr_specified_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ value string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-221662474
@@ -191,7 +184,7 @@ int dom_attr_value_write(dom_object *obj, zval *newval TSRMLS_DC)
}
if (newval->type != IS_STRING) {
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -210,8 +203,6 @@ int dom_attr_value_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
-
-
/* {{{ ownerElement DOMElement
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-ownerElement
@@ -229,13 +220,14 @@ int dom_attr_owner_element_read(dom_object *obj, zval **retval TSRMLS_DC)
return FAILURE;
}
+ ALLOC_ZVAL(*retval);
+
nodeparent = nodep->parent;
if (!nodeparent) {
- return FAILURE;
+ ZVAL_NULL(*retval);
+ return SUCCESS;
}
- ALLOC_ZVAL(*retval);
-
if (NULL == (*retval = php_dom_create_object(nodeparent, &ret, NULL, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
@@ -246,8 +238,6 @@ int dom_attr_owner_element_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ schemaTypeInfo DOMTypeInfo
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-schemaTypeInfo
@@ -263,8 +253,6 @@ int dom_attr_schema_type_info_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ proto boolean dom_attr_is_id();
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-isId
Since: DOM Level 3
@@ -290,3 +278,12 @@ PHP_FUNCTION(dom_attr_is_id)
/* }}} end dom_attr_is_id */
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c
index 0e1116994..ae98fa9d8 100644
--- a/ext/dom/cdatasection.c
+++ b/ext/dom/cdatasection.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cdatasection.c,v 1.11.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: cdatasection.c,v 1.11.2.1.2.1.2.11 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,7 +29,6 @@
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_cdatasection_construct, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
@@ -42,7 +41,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_cdatasection_class_functions[] = {
+const zend_function_entry php_dom_cdatasection_class_functions[] = {
PHP_ME(domcdatasection, __construct, arginfo_dom_cdatasection_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
@@ -56,14 +55,15 @@ PHP_METHOD(domcdatasection, __construct)
dom_object *intern;
char *value = NULL;
int value_len;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_cdatasection_class_entry, &value, &value_len) == FAILURE) {
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
nodep = xmlNewCDataBlock(NULL, (xmlChar *) value, value_len);
if (!nodep) {
@@ -83,3 +83,12 @@ PHP_METHOD(domcdatasection, __construct)
/* }}} end DOMCdataSection::__construct */
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c
index 153533756..c0b660ff1 100644
--- a/ext/dom/characterdata.c
+++ b/ext/dom/characterdata.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: characterdata.c,v 1.15.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: characterdata.c,v 1.15.2.1.2.2.2.9 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,30 +29,25 @@
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_substring_data, 0, 0, 2)
ZEND_ARG_INFO(0, offset)
ZEND_ARG_INFO(0, count)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_append_data, 0, 0, 1)
ZEND_ARG_INFO(0, arg)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_insert_data, 0, 0, 2)
ZEND_ARG_INFO(0, offset)
ZEND_ARG_INFO(0, arg)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_delete_data, 0, 0, 2)
ZEND_ARG_INFO(0, offset)
ZEND_ARG_INFO(0, count)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_replace_data, 0, 0, 3)
ZEND_ARG_INFO(0, offset)
ZEND_ARG_INFO(0, count)
@@ -67,7 +62,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_characterdata_class_functions[] = {
+const zend_function_entry php_dom_characterdata_class_functions[] = {
PHP_FALIAS(substringData, dom_characterdata_substring_data, arginfo_dom_characterdata_substring_data)
PHP_FALIAS(appendData, dom_characterdata_append_data, arginfo_dom_characterdata_append_data)
PHP_FALIAS(insertData, dom_characterdata_insert_data, arginfo_dom_characterdata_insert_data)
@@ -118,7 +113,7 @@ int dom_characterdata_data_write(dom_object *obj, zval *newval TSRMLS_DC)
}
if (newval->type != IS_STRING) {
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -171,7 +166,6 @@ int dom_characterdata_length_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
/* {{{ proto string dom_characterdata_substring_data(int offset, int count);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6531BCCF
Since:
@@ -221,7 +215,6 @@ PHP_FUNCTION(dom_characterdata_substring_data)
}
/* }}} end dom_characterdata_substring_data */
-
/* {{{ proto void dom_characterdata_append_data(string arg);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-32791A2F
Since:
@@ -256,7 +249,6 @@ PHP_FUNCTION(dom_characterdata_append_data)
}
/* }}} end dom_characterdata_append_data */
-
/* {{{ proto void dom_characterdata_insert_data(int offset, string arg);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3EDB695F
Since:
@@ -305,7 +297,6 @@ PHP_FUNCTION(dom_characterdata_insert_data)
}
/* }}} end dom_characterdata_insert_data */
-
/* {{{ proto void dom_characterdata_delete_data(int offset, int count);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-7C603781
Since:
@@ -361,7 +352,6 @@ PHP_FUNCTION(dom_characterdata_delete_data)
}
/* }}} end dom_characterdata_delete_data */
-
/* {{{ proto void dom_characterdata_replace_data(int offset, int count, string arg);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-E5CBA7FB
Since:
@@ -423,4 +413,14 @@ PHP_FUNCTION(dom_characterdata_replace_data)
RETURN_TRUE;
}
/* }}} end dom_characterdata_replace_data */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/comment.c b/ext/dom/comment.c
index 2e7271ab0..79127245b 100644
--- a/ext/dom/comment.c
+++ b/ext/dom/comment.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: comment.c,v 1.11.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: comment.c,v 1.11.2.1.2.1.2.11 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,7 +29,6 @@
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_comment_construct, 0, 0, 0)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
@@ -42,7 +41,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_comment_class_functions[] = {
+const zend_function_entry php_dom_comment_class_functions[] = {
PHP_ME(domcomment, __construct, arginfo_dom_comment_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
@@ -56,14 +55,15 @@ PHP_METHOD(domcomment, __construct)
dom_object *intern;
char *value = NULL;
int value_len;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, dom_comment_class_entry, &value, &value_len) == FAILURE) {
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
nodep = xmlNewComment((xmlChar *) value);
if (!nodep) {
@@ -81,4 +81,14 @@ PHP_METHOD(domcomment, __construct)
}
}
/* }}} end DOMComment::__construct */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/config.w32 b/ext/dom/config.w32
index 182467b47..bec3b81d3 100644
--- a/ext/dom/config.w32
+++ b/ext/dom/config.w32
@@ -1,22 +1,26 @@
-// $Id: config.w32,v 1.3 2003/12/22 13:16:39 wez Exp $
+// $Id: config.w32,v 1.3.8.1 2008/06/23 18:40:28 pajoye Exp $
// vim:ft=javascript
ARG_WITH("dom", "DOM support", "yes");
-if (PHP_DOM == "yes" && PHP_LIBXML == "yes") {
- EXTENSION("dom", "php_dom.c attr.c document.c domerrorhandler.c \
- domstringlist.c domexception.c namelist.c processinginstruction.c \
- cdatasection.c documentfragment.c domimplementation.c element.c \
- node.c string_extend.c characterdata.c documenttype.c \
- domimplementationlist.c entity.c nodelist.c text.c comment.c \
- domconfiguration.c domimplementationsource.c entityreference.c \
- notation.c xpath.c dom_iterators.c typeinfo.c domerror.c \
- domlocator.c namednodemap.c userdatahandler.c");
- AC_DEFINE("HAVE_DOM", 1, "DOM support");
- if (!PHP_DOM_SHARED) {
- ADD_FLAG("CFLAGS_DOM", "/D LIBXML_STATIC ");
- }
- ADD_EXTENSION_DEP('dom', 'libxml');
-}
+if (PHP_DOM == "yes") {
+ if (PHP_LIBXML == "yes" && ADD_EXTENSION_DEP('dom', 'libxml')) {
+ EXTENSION("dom", "php_dom.c attr.c document.c domerrorhandler.c \
+ domstringlist.c domexception.c namelist.c processinginstruction.c \
+ cdatasection.c documentfragment.c domimplementation.c element.c \
+ node.c string_extend.c characterdata.c documenttype.c \
+ domimplementationlist.c entity.c nodelist.c text.c comment.c \
+ domconfiguration.c domimplementationsource.c entityreference.c \
+ notation.c xpath.c dom_iterators.c typeinfo.c domerror.c \
+ domlocator.c namednodemap.c userdatahandler.c");
+ AC_DEFINE("HAVE_DOM", 1, "DOM support");
+ if (!PHP_DOM_SHARED) {
+ ADD_FLAG("CFLAGS_DOM", "/D LIBXML_STATIC ");
+ }
+ } else {
+ WARNING("dom support can't be enabled, libxml is not enabled")
+ PHP_DOM = "no"
+ }
+}
diff --git a/ext/dom/document.c b/ext/dom/document.c
index f699ac7f6..5cd0a7e82 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: document.c,v 1.68.2.3.2.11 2009/01/26 19:11:19 rrichards Exp $ */
+/* $Id: document.c,v 1.68.2.3.2.5.2.15 2009/03/13 13:43:29 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -42,175 +42,142 @@ struct _idsIterator {
#define DOM_LOAD_FILE 1
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_element, 0, 0, 1)
ZEND_ARG_INFO(0, tagName)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_document_fragment, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_text_node, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_comment, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_cdatasection, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_processing_instruction, 0, 0, 2)
ZEND_ARG_INFO(0, target)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_attribute, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_entity_reference, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_get_elements_by_tag_name, 0, 0, 1)
ZEND_ARG_INFO(0, tagName)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_import_node, 0, 0, 2)
ZEND_ARG_OBJ_INFO(0, importedNode, DOMNode, 0)
ZEND_ARG_INFO(0, deep)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_element_ns, 0, 0, 2)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, qualifiedName)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_attribute_ns, 0, 0, 2)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, qualifiedName)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_get_elements_by_tag_name_ns, 0, 0, 2)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, localName)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_get_element_by_id, 0, 0, 1)
ZEND_ARG_INFO(0, elementId)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_adopt_node, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, source, DOMNode, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_normalize_document, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_rename_node, 0, 0, 3)
ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, qualifiedName)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_load, 0, 0, 1)
ZEND_ARG_INFO(0, source)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_save, 0, 0, 1)
ZEND_ARG_INFO(0, file)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadxml, 0, 0, 1)
ZEND_ARG_INFO(0, source)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savexml, 0, 0, 0)
ZEND_ARG_OBJ_INFO(0, node, DOMNode, 1)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_construct, 0, 0, 0)
ZEND_ARG_INFO(0, version)
ZEND_ARG_INFO(0, encoding)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_validate, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_xinclude, 0, 0, 0)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtml, 0, 0, 1)
ZEND_ARG_INFO(0, source)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtmlfile, 0, 0, 1)
ZEND_ARG_INFO(0, source)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtml, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtmlfile, 0, 0, 1)
ZEND_ARG_INFO(0, file)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_schema_validate_file, 0, 0, 1)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_schema_validate_xml, 0, 0, 1)
ZEND_ARG_INFO(0, source)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_relaxNG_validate_file, 0, 0, 1)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_relaxNG_validate_xml, 0, 0, 1)
ZEND_ARG_INFO(0, source)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_registernodeclass, 0, 0, 2)
ZEND_ARG_INFO(0, baseClass)
ZEND_ARG_INFO(0, extendedClass)
@@ -224,7 +191,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_document_class_functions[] = {
+const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
PHP_FALIAS(createElement, dom_document_create_element, arginfo_dom_document_create_element)
PHP_FALIAS(createDocumentFragment, dom_document_create_document_fragment, arginfo_dom_document_create_document_fragment)
PHP_FALIAS(createTextNode, dom_document_create_text_node, arginfo_dom_document_create_text_node)
@@ -264,6 +231,7 @@ zend_function_entry php_dom_document_class_functions[] = {
PHP_ME(domdocument, registerNodeClass, arginfo_dom_document_registernodeclass, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
+/* }}} */
/* {{{ docType DOMDocumentType
readonly=yes
@@ -283,12 +251,14 @@ int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
return FAILURE;
}
+ ALLOC_ZVAL(*retval);
+
dtdptr = xmlGetIntSubset(docp);
if (!dtdptr) {
- return FAILURE;
+ ZVAL_NULL(*retval);
+ return SUCCESS;
}
- ALLOC_ZVAL(*retval);
if (NULL == (*retval = php_dom_create_object((xmlNodePtr) dtdptr, &ret, NULL, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
@@ -299,8 +269,6 @@ int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ implementation DOMImplementation
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1B793EBA
@@ -315,8 +283,6 @@ int dom_document_implementation_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ documentElement DOMElement
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-87CD092
@@ -335,12 +301,14 @@ int dom_document_document_element_read(dom_object *obj, zval **retval TSRMLS_DC)
return FAILURE;
}
+ ALLOC_ZVAL(*retval);
+
root = xmlDocGetRootElement(docp);
if (!root) {
- return FAILURE;
+ ZVAL_NULL(*retval);
+ return SUCCESS;
}
- ALLOC_ZVAL(*retval);
if (NULL == (*retval = php_dom_create_object(root, &ret, NULL, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
@@ -392,7 +360,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
}
if (newval->type != IS_STRING) {
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -421,8 +389,6 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
-
-
/* {{{ standalone boolean
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-standalone
@@ -460,7 +426,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
return FAILURE;
}
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -487,8 +453,6 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
-
-
/* {{{ version string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-version
@@ -535,7 +499,7 @@ int dom_document_version_write(dom_object *obj, zval *newval TSRMLS_DC)
}
if (newval->type != IS_STRING) {
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -578,7 +542,7 @@ int dom_document_strict_error_checking_write(dom_object *obj, zval *newval TSRML
zval value_copy;
dom_doc_propsptr doc_prop;
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -621,7 +585,7 @@ int dom_document_format_output_write(dom_object *obj, zval *newval TSRMLS_DC)
zval value_copy;
dom_doc_propsptr doc_prop;
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -663,7 +627,7 @@ int dom_document_validate_on_parse_write(dom_object *obj, zval *newval TSRMLS_DC
zval value_copy;
dom_doc_propsptr doc_prop;
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -683,7 +647,6 @@ int dom_document_validate_on_parse_write(dom_object *obj, zval *newval TSRMLS_DC
}
/* }}} */
-
/* {{{ resolveExternals boolean
readonly=no
*/
@@ -706,7 +669,7 @@ int dom_document_resolve_externals_write(dom_object *obj, zval *newval TSRMLS_DC
zval value_copy;
dom_doc_propsptr doc_prop;
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -726,7 +689,6 @@ int dom_document_resolve_externals_write(dom_object *obj, zval *newval TSRMLS_DC
}
/* }}} */
-
/* {{{ preserveWhiteSpace boolean
readonly=no
*/
@@ -749,7 +711,7 @@ int dom_document_preserve_whitespace_write(dom_object *obj, zval *newval TSRMLS_
zval value_copy;
dom_doc_propsptr doc_prop;
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -791,7 +753,7 @@ int dom_document_recover_write(dom_object *obj, zval *newval TSRMLS_DC)
zval value_copy;
dom_doc_propsptr doc_prop;
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -811,7 +773,6 @@ int dom_document_recover_write(dom_object *obj, zval *newval TSRMLS_DC)
}
/* }}} */
-
/* {{{ substituteEntities boolean
readonly=no
*/
@@ -834,7 +795,7 @@ int dom_document_substitue_entities_write(dom_object *obj, zval *newval TSRMLS_D
zval value_copy;
dom_doc_propsptr doc_prop;
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -854,7 +815,6 @@ int dom_document_substitue_entities_write(dom_object *obj, zval *newval TSRMLS_D
}
/* }}} */
-
/* {{{ documentURI string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-documentURI
@@ -900,7 +860,7 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC)
}
if (newval->type != IS_STRING) {
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -919,8 +879,6 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
-
-
/* {{{ config DOMConfiguration
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-config
@@ -935,8 +893,6 @@ int dom_document_config_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ proto DOMElement dom_document_create_element(string tagName [, string value]);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547
Since:
@@ -970,7 +926,6 @@ PHP_FUNCTION(dom_document_create_element)
}
/* }}} end dom_document_create_element */
-
/* {{{ proto DOMDocumentFragment dom_document_create_document_fragment();
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5
Since:
@@ -998,7 +953,6 @@ PHP_FUNCTION(dom_document_create_document_fragment)
}
/* }}} end dom_document_create_document_fragment */
-
/* {{{ proto DOMText dom_document_create_text_node(string data);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127
Since:
@@ -1027,7 +981,6 @@ PHP_FUNCTION(dom_document_create_text_node)
}
/* }}} end dom_document_create_text_node */
-
/* {{{ proto DOMComment dom_document_create_comment(string data);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328
Since:
@@ -1056,7 +1009,6 @@ PHP_FUNCTION(dom_document_create_comment)
}
/* }}} end dom_document_create_comment */
-
/* {{{ proto DOMCdataSection dom_document_create_cdatasection(string data);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8
Since:
@@ -1085,7 +1037,6 @@ PHP_FUNCTION(dom_document_create_cdatasection)
}
/* }}} end dom_document_create_cdatasection */
-
/* {{{ proto DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439
Since:
@@ -1121,7 +1072,6 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
}
/* }}} end dom_document_create_processing_instruction */
-
/* {{{ proto DOMAttr dom_document_create_attribute(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198
Since:
@@ -1156,7 +1106,6 @@ PHP_FUNCTION(dom_document_create_attribute)
}
/* }}} end dom_document_create_attribute */
-
/* {{{ proto DOMEntityReference dom_document_create_entity_reference(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE
Since:
@@ -1190,7 +1139,6 @@ PHP_FUNCTION(dom_document_create_entity_reference)
}
/* }}} end dom_document_create_entity_reference */
-
/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name(string tagname);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094
Since:
@@ -1217,7 +1165,6 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name)
}
/* }}} end dom_document_get_elements_by_tag_name */
-
/* {{{ proto DOMNode dom_document_import_node(DOMNode importedNode, boolean deep);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Core-Document-importNode
Since: DOM Level 2
@@ -1260,7 +1207,6 @@ PHP_FUNCTION(dom_document_import_node)
}
/* }}} end dom_document_import_node */
-
/* {{{ proto DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value]);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS
Since: DOM Level 2
@@ -1324,7 +1270,6 @@ PHP_FUNCTION(dom_document_create_element_ns)
}
/* }}} end dom_document_create_element_ns */
-
/* {{{ proto DOMAttr dom_document_create_attribute_ns(string namespaceURI, string qualifiedName);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrAttrNS
Since: DOM Level 2
@@ -1390,7 +1335,6 @@ PHP_FUNCTION(dom_document_create_attribute_ns)
}
/* }}} end dom_document_create_attribute_ns */
-
/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name_ns(string namespaceURI, string localName);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBTNNS
Since: DOM Level 2
@@ -1418,7 +1362,6 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns)
}
/* }}} end dom_document_get_elements_by_tag_name_ns */
-
/* {{{ proto DOMElement dom_document_get_element_by_id(string elementId);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBId
Since: DOM Level 2
@@ -1449,7 +1392,6 @@ PHP_FUNCTION(dom_document_get_element_by_id)
}
/* }}} end dom_document_get_element_by_id */
-
/* {{{ proto DOMNode dom_document_adopt_node(DOMNode source);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-adoptNode
Since: DOM Level 3
@@ -1460,7 +1402,6 @@ PHP_FUNCTION(dom_document_adopt_node)
}
/* }}} end dom_document_adopt_node */
-
/* {{{ proto void dom_document_normalize_document();
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-normalizeDocument
Since: DOM Level 3
@@ -1481,7 +1422,6 @@ PHP_FUNCTION(dom_document_normalize_document)
}
/* }}} end dom_document_normalize_document */
-
/* {{{ proto DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-renameNode
Since: DOM Level 3
@@ -1501,14 +1441,15 @@ PHP_METHOD(domdocument, __construct)
dom_object *intern;
char *encoding, *version = NULL;
int encoding_len = 0, version_len = 0, refcount;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ss", &id, dom_document_class_entry, &version, &version_len, &encoding, &encoding_len) == FAILURE) {
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
docp = xmlNewDoc(version);
if (!docp) {
@@ -1539,7 +1480,8 @@ PHP_METHOD(domdocument, __construct)
}
/* }}} end DOMDocument::__construct */
-char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_path_len TSRMLS_DC) {
+char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_path_len TSRMLS_DC) /* {{{ */
+{
xmlURI *uri;
xmlChar *escsource;
char *file_dest;
@@ -1584,10 +1526,10 @@ char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_p
return file_dest;
}
+/* }}} */
-
-/* {{{ */
-static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int options TSRMLS_DC) {
+static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int options TSRMLS_DC) /* {{{ */
+{
xmlDocPtr ret;
xmlParserCtxtPtr ctxt = NULL;
dom_doc_propsptr doc_props;
@@ -1895,7 +1837,8 @@ PHP_FUNCTION(dom_document_savexml)
}
/* }}} end dom_document_savexml */
-static xmlNodePtr php_dom_free_xinclude_node(xmlNodePtr cur TSRMLS_DC) {
+static xmlNodePtr php_dom_free_xinclude_node(xmlNodePtr cur TSRMLS_DC) /* {{{ */
+{
xmlNodePtr xincnode;
xincnode = cur;
@@ -1905,8 +1848,10 @@ static xmlNodePtr php_dom_free_xinclude_node(xmlNodePtr cur TSRMLS_DC) {
return cur;
}
+/* }}} */
-static void php_dom_remove_xinclude_nodes(xmlNodePtr cur TSRMLS_DC) {
+static void php_dom_remove_xinclude_nodes(xmlNodePtr cur TSRMLS_DC) /* {{{ */
+{
while(cur) {
if (cur->type == XML_XINCLUDE_START) {
cur = php_dom_free_xinclude_node(cur TSRMLS_CC);
@@ -1931,6 +1876,7 @@ static void php_dom_remove_xinclude_nodes(xmlNodePtr cur TSRMLS_DC) {
}
}
}
+/* }}} */
/* {{{ proto int dom_document_xinclude([int options])
Substitutues xincludes in a DomDocument */
@@ -1970,7 +1916,7 @@ PHP_FUNCTION(dom_document_xinclude)
}
}
-
+/* }}} */
/* {{{ proto boolean dom_document_validate();
Since: DOM extended
@@ -2007,11 +1953,10 @@ PHP_FUNCTION(dom_document_validate)
xmlFreeValidCtxt(cvp);
}
-
+/* }}} */
#if defined(LIBXML_SCHEMAS_ENABLED)
-static void
-_dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type)
+static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
{
zval *id;
xmlDoc *docp;
@@ -2084,6 +2029,7 @@ _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type)
RETURN_FALSE;
}
}
+/* }}} */
/* {{{ proto boolean dom_document_schema_validate_file(string filename); */
PHP_FUNCTION(dom_document_schema_validate_file)
@@ -2099,9 +2045,7 @@ PHP_FUNCTION(dom_document_schema_validate_xml)
}
/* }}} end dom_document_schema_validate */
-
-static void
-_dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int type)
+static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
{
zval *id;
xmlDoc *docp;
@@ -2174,6 +2118,7 @@ _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int type)
RETURN_FALSE;
}
}
+/* }}} */
/* {{{ proto boolean dom_document_relaxNG_validate_file(string filename); */
PHP_FUNCTION(dom_document_relaxNG_validate_file)
@@ -2193,7 +2138,7 @@ PHP_FUNCTION(dom_document_relaxNG_validate_xml)
#if defined(LIBXML_HTML_ENABLED)
-static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode)
+static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
{
zval *id, *rv = NULL;
xmlDoc *docp = NULL, *newdoc;
@@ -2266,6 +2211,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode)
DOM_RET_OBJ(rv, (xmlNodePtr) newdoc, &ret, NULL);
}
}
+/* }}} */
/* {{{ proto DOMNode dom_document_load_html_file(string source);
Since: DOM extended
@@ -2405,3 +2351,12 @@ PHP_METHOD(domdocument, registerNodeClass)
/* }}} */
#endif /* HAVE_LIBXML && HAVE_DOM */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c
index 88b30e1c0..4bd53104d 100644
--- a/ext/dom/documentfragment.c
+++ b/ext/dom/documentfragment.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: documentfragment.c,v 1.15.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: documentfragment.c,v 1.15.2.1.2.1.2.11 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,13 +27,10 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_documentfragement_construct, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_documentfragement_appendXML, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO();
@@ -46,7 +43,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_documentfragment_class_functions[] = {
+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}
@@ -59,14 +56,15 @@ PHP_METHOD(domdocumentfragment, __construct)
zval *id;
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_documentfragment_class_entry) == FAILURE) {
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
nodep = xmlNewDocFragment(NULL);
if (!nodep) {
@@ -88,7 +86,8 @@ PHP_METHOD(domdocumentfragment, __construct)
/* php_dom_xmlSetTreeDoc is a custom implementation of xmlSetTreeDoc
needed for hack in appendXML due to libxml bug - no need to share this function */
-static void php_dom_xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
+static void php_dom_xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) /* {{{ */
+{
xmlAttrPtr prop;
xmlNodePtr cur;
@@ -117,6 +116,7 @@ static void php_dom_xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
tree->doc = doc;
}
}
+/* }}} */
/* {{{ proto void DOMDocumentFragment::appendXML(string data); */
PHP_METHOD(domdocumentfragment, appendXML) {
@@ -154,5 +154,15 @@ PHP_METHOD(domdocumentfragment, appendXML) {
RETURN_TRUE;
}
+/* }}} */
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
index 18365f1bc..20cfdea6e 100644
--- a/ext/dom/documenttype.c
+++ b/ext/dom/documenttype.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: documenttype.c,v 1.15.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: documenttype.c,v 1.15.2.1.2.1.2.4 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -34,7 +34,7 @@
* Since:
*/
-zend_function_entry php_dom_documenttype_class_functions[] = {
+const zend_function_entry php_dom_documenttype_class_functions[] = {
{NULL, NULL, NULL}
};
@@ -62,8 +62,6 @@ int dom_documenttype_name_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ entities DOMNamedNodeMap
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1788794630
@@ -95,8 +93,6 @@ int dom_documenttype_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ notations DOMNamedNodeMap
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D46829EF
@@ -128,8 +124,6 @@ int dom_documenttype_notations_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ publicId string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-publicId
@@ -158,8 +152,6 @@ int dom_documenttype_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ systemId string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-systemId
@@ -187,8 +179,6 @@ int dom_documenttype_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ internalSubset string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-internalSubset
@@ -232,3 +222,12 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_
/* }}} */
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/dom_ce.h b/ext/dom/dom_ce.h
index 4d0c12d90..13a408d55 100644
--- a/ext/dom/dom_ce.h
+++ b/ext/dom/dom_ce.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_ce.h,v 1.8.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: dom_ce.h,v 1.8.2.1.2.1.2.3 2008/12/31 11:15:36 sebastian Exp $ */
#ifndef DOM_CE_H
#define DOM_CE_H
@@ -55,3 +55,12 @@ extern zend_class_entry *dom_xpath_class_entry;
extern zend_class_entry *dom_namespace_node_class_entry;
#endif /* DOM_CE_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h
index f603bb39c..1c53d3297 100644
--- a/ext/dom/dom_fe.h
+++ b/ext/dom/dom_fe.h
@@ -17,40 +17,40 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_fe.h,v 1.14.2.1.2.6 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: dom_fe.h,v 1.14.2.1.2.4.2.6 2009/01/13 18:06:48 rrichards Exp $ */
#ifndef DOM_FE_H
#define DOM_FE_H
-extern zend_function_entry php_dom_domexception_class_functions[];
-extern zend_function_entry php_dom_domstringlist_class_functions[];
-extern zend_function_entry php_dom_namelist_class_functions[];
-extern zend_function_entry php_dom_domimplementationlist_class_functions[];
-extern zend_function_entry php_dom_domimplementationsource_class_functions[];
-extern zend_function_entry php_dom_domimplementation_class_functions[];
-extern zend_function_entry php_dom_documentfragment_class_functions[];
-extern zend_function_entry php_dom_document_class_functions[];
-extern zend_function_entry php_dom_node_class_functions[];
-extern zend_function_entry php_dom_nodelist_class_functions[];
-extern zend_function_entry php_dom_namednodemap_class_functions[];
-extern zend_function_entry php_dom_characterdata_class_functions[];
-extern zend_function_entry php_dom_attr_class_functions[];
-extern zend_function_entry php_dom_element_class_functions[];
-extern zend_function_entry php_dom_text_class_functions[];
-extern zend_function_entry php_dom_comment_class_functions[];
-extern zend_function_entry php_dom_typeinfo_class_functions[];
-extern zend_function_entry php_dom_userdatahandler_class_functions[];
-extern zend_function_entry php_dom_domerror_class_functions[];
-extern zend_function_entry php_dom_domerrorhandler_class_functions[];
-extern zend_function_entry php_dom_domlocator_class_functions[];
-extern zend_function_entry php_dom_domconfiguration_class_functions[];
-extern zend_function_entry php_dom_cdatasection_class_functions[];
-extern zend_function_entry php_dom_documenttype_class_functions[];
-extern zend_function_entry php_dom_notation_class_functions[];
-extern zend_function_entry php_dom_entity_class_functions[];
-extern zend_function_entry php_dom_entityreference_class_functions[];
-extern zend_function_entry php_dom_processinginstruction_class_functions[];
-extern zend_function_entry php_dom_string_extend_class_functions[];
-extern zend_function_entry php_dom_xpath_class_functions[];
+extern const zend_function_entry php_dom_domexception_class_functions[];
+extern const zend_function_entry php_dom_domstringlist_class_functions[];
+extern const zend_function_entry php_dom_namelist_class_functions[];
+extern const zend_function_entry php_dom_domimplementationlist_class_functions[];
+extern const zend_function_entry php_dom_domimplementationsource_class_functions[];
+extern const zend_function_entry php_dom_domimplementation_class_functions[];
+extern const zend_function_entry php_dom_documentfragment_class_functions[];
+extern const zend_function_entry php_dom_document_class_functions[];
+extern const zend_function_entry php_dom_node_class_functions[];
+extern const zend_function_entry php_dom_nodelist_class_functions[];
+extern const zend_function_entry php_dom_namednodemap_class_functions[];
+extern const zend_function_entry php_dom_characterdata_class_functions[];
+extern const zend_function_entry php_dom_attr_class_functions[];
+extern const zend_function_entry php_dom_element_class_functions[];
+extern const zend_function_entry php_dom_text_class_functions[];
+extern const zend_function_entry php_dom_comment_class_functions[];
+extern const zend_function_entry php_dom_typeinfo_class_functions[];
+extern const zend_function_entry php_dom_userdatahandler_class_functions[];
+extern const zend_function_entry php_dom_domerror_class_functions[];
+extern const zend_function_entry php_dom_domerrorhandler_class_functions[];
+extern const zend_function_entry php_dom_domlocator_class_functions[];
+extern const zend_function_entry php_dom_domconfiguration_class_functions[];
+extern const zend_function_entry php_dom_cdatasection_class_functions[];
+extern const zend_function_entry php_dom_documenttype_class_functions[];
+extern const zend_function_entry php_dom_notation_class_functions[];
+extern const zend_function_entry php_dom_entity_class_functions[];
+extern const zend_function_entry php_dom_entityreference_class_functions[];
+extern const zend_function_entry php_dom_processinginstruction_class_functions[];
+extern const zend_function_entry php_dom_string_extend_class_functions[];
+extern const zend_function_entry php_dom_xpath_class_functions[];
/* domexception errors */
typedef enum {
@@ -168,6 +168,7 @@ PHP_FUNCTION(dom_node_get_user_data);
PHP_METHOD(domnode, C14N);
PHP_METHOD(domnode, C14NFile);
PHP_METHOD(domnode, getNodePath);
+PHP_METHOD(domnode, getLineNo);
/* domnodelist methods */
PHP_FUNCTION(dom_nodelist_item);
@@ -264,6 +265,16 @@ PHP_METHOD(domxpath, __construct);
PHP_FUNCTION(dom_xpath_register_ns);
PHP_FUNCTION(dom_xpath_query);
PHP_FUNCTION(dom_xpath_evaluate);
+PHP_FUNCTION(dom_xpath_register_php_functions);
#endif
#endif /* DOM_FE_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c
index a56c83536..1527a7303 100644
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_iterators.c,v 1.9.2.3.2.7 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: dom_iterators.c,v 1.9.2.3.2.5.2.4 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -42,7 +42,8 @@ struct _notationIterator {
xmlNotation *notation;
};
-static void itemHashScanner (void *payload, void *data, xmlChar *name) {
+static void itemHashScanner (void *payload, void *data, xmlChar *name) /* {{{ */
+{
nodeIterator *priv = (nodeIterator *)data;
if(priv->cur < priv->index) {
@@ -53,9 +54,10 @@ static void itemHashScanner (void *payload, void *data, xmlChar *name) {
}
}
}
+/* }}} */
-xmlNodePtr create_notation(const xmlChar *name,
- const xmlChar *ExternalID, const xmlChar *SystemID) {
+xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID) /* {{{ */
+{
xmlEntityPtr ret;
ret = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity));
@@ -76,8 +78,9 @@ xmlNodePtr create_notation(const xmlChar *name,
ret->prev = NULL;
return((xmlNodePtr) ret);
}
+/* }}} */
-xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index)
+xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index) /* {{{ */
{
xmlNode *nodep = NULL;
nodeIterator *iter;
@@ -96,8 +99,9 @@ xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index)
return NULL;
}
}
+/* }}} */
-xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index)
+xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index) /* {{{ */
{
notationIterator *iter;
xmlNotation *notep = NULL;
@@ -116,8 +120,9 @@ xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index)
return NULL;
}
}
+/* }}} */
-static void php_dom_iterator_dtor(zend_object_iterator *iter TSRMLS_DC)
+static void php_dom_iterator_dtor(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
{
php_dom_iterator *iterator = (php_dom_iterator *)iter;
@@ -129,8 +134,9 @@ static void php_dom_iterator_dtor(zend_object_iterator *iter TSRMLS_DC)
efree(iterator);
}
+/* }}} */
-static int php_dom_iterator_valid(zend_object_iterator *iter TSRMLS_DC)
+static int php_dom_iterator_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
{
php_dom_iterator *iterator = (php_dom_iterator *)iter;
@@ -141,15 +147,17 @@ static int php_dom_iterator_valid(zend_object_iterator *iter TSRMLS_DC)
return FAILURE;
}
}
+/* }}} */
-static void php_dom_iterator_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
+static void php_dom_iterator_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC) /* {{{ */
{
php_dom_iterator *iterator = (php_dom_iterator *)iter;
*data = &iterator->curobj;
}
+/* }}} */
-static int php_dom_iterator_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
+static int php_dom_iterator_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */
{
zval *curobj;
xmlNodePtr curnode = NULL;
@@ -180,8 +188,9 @@ static int php_dom_iterator_current_key(zend_object_iterator *iter, char **str_k
return HASH_KEY_IS_STRING;
}
}
+/* }}} */
-static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
+static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
{
zval *curobj, *curattr = NULL;
zval *object;
@@ -209,7 +218,7 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
zend_hash_move_forward(nodeht);
if (zend_hash_get_current_data(nodeht, (void **) &entry)==SUCCESS) {
curattr = *entry;
- curattr->refcount++;
+ Z_ADDREF_P(curattr);
}
} else {
curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->ptr)->node;
@@ -247,6 +256,7 @@ err:
iterator->curobj = curattr;
}
+/* }}} */
zend_object_iterator_funcs php_dom_iterator_funcs = {
php_dom_iterator_dtor,
@@ -257,7 +267,7 @@ zend_object_iterator_funcs php_dom_iterator_funcs = {
NULL
};
-zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
+zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */
{
dom_object *intern;
dom_nnodemap_object *objmap;
@@ -273,7 +283,7 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
}
iterator = emalloc(sizeof(php_dom_iterator));
- object->refcount++;
+ Z_ADDREF_P(object);
iterator->intern.data = (void*)object;
iterator->intern.funcs = &php_dom_iterator_funcs;
@@ -287,7 +297,7 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
zend_hash_internal_pointer_reset(nodeht);
if (zend_hash_get_current_data(nodeht, (void **) &entry)==SUCCESS) {
curattr = *entry;
- curattr->refcount++;
+ Z_ADDREF_P(curattr);
}
} else {
nodep = (xmlNode *)dom_object_get_node(objmap->baseobj);
@@ -327,5 +337,15 @@ err:
return (zend_object_iterator*)iterator;
}
+/* }}} */
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/dom_properties.h b/ext/dom/dom_properties.h
index 6064bdc4b..b4232fd7f 100644
--- a/ext/dom/dom_properties.h
+++ b/ext/dom/dom_properties.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_properties.h,v 1.7.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: dom_properties.h,v 1.7.2.1.2.1.2.3 2008/12/31 11:15:36 sebastian Exp $ */
#ifndef DOM_PROPERTIES_H
#define DOM_PROPERTIES_H
@@ -160,3 +160,12 @@ int dom_xpath_document_read(dom_object *obj, zval **retval TSRMLS_DC);
#endif
#endif /* DOM_PROPERTIERS_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/domconfiguration.c b/ext/dom/domconfiguration.c
index 98a81c762..5e75ea944 100644
--- a/ext/dom/domconfiguration.c
+++ b/ext/dom/domconfiguration.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domconfiguration.c,v 1.5.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: domconfiguration.c,v 1.5.2.1.2.1.2.9 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,20 +27,16 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_set_parameter, 0, 0, 2)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_get_parameter, 0, 0, 0)
ZEND_ARG_INFO(0, name)
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_INFO(0, value)
@@ -54,7 +50,7 @@ ZEND_END_ARG_INFO();
* Since: DOM Level 3
*/
-zend_function_entry php_dom_domconfiguration_class_functions[] = {
+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)
@@ -63,7 +59,6 @@ zend_function_entry php_dom_domconfiguration_class_functions[] = {
/* {{{ attribute protos, not implemented yet */
-
/* {{{ proto dom_void dom_domconfiguration_set_parameter(string name, domuserdata value);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-property
Since:
@@ -74,7 +69,6 @@ PHP_FUNCTION(dom_domconfiguration_set_parameter)
}
/* }}} end dom_domconfiguration_set_parameter */
-
/* {{{ proto domdomuserdata dom_domconfiguration_get_parameter(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-getParameter
Since:
@@ -85,7 +79,6 @@ PHP_FUNCTION(dom_domconfiguration_get_parameter)
}
/* }}} end dom_domconfiguration_get_parameter */
-
/* {{{ proto boolean dom_domconfiguration_can_set_parameter(string name, domuserdata value);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-canSetParameter
Since:
@@ -95,4 +88,16 @@ PHP_FUNCTION(dom_domconfiguration_can_set_parameter)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_domconfiguration_can_set_parameter */
+
+/* }}} */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/domerror.c b/ext/dom/domerror.c
index 940c427e4..d5e7e7813 100644
--- a/ext/dom/domerror.c
+++ b/ext/dom/domerror.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domerror.c,v 1.6.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: domerror.c,v 1.6.2.1.2.1.2.4 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -35,7 +35,7 @@
* Since: DOM Level 3
*/
-zend_function_entry php_dom_domerror_class_functions[] = {
+const zend_function_entry php_dom_domerror_class_functions[] = {
{NULL, NULL, NULL}
};
@@ -55,8 +55,6 @@ int dom_domerror_severity_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ message string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-message
@@ -71,8 +69,6 @@ int dom_domerror_message_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ type string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-type
@@ -87,8 +83,6 @@ int dom_domerror_type_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ relatedException object
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-relatedException
@@ -103,8 +97,6 @@ int dom_domerror_related_exception_read(dom_object *obj, zval **retval TSRMLS_DC
/* }}} */
-
-
/* {{{ relatedData domobject
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-relatedData
@@ -119,8 +111,6 @@ int dom_domerror_related_data_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ location domlocator
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-location
@@ -135,4 +125,15 @@ int dom_domerror_location_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
+/* }}} */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/domerrorhandler.c b/ext/dom/domerrorhandler.c
index 4da18ff2a..3696b66b8 100644
--- a/ext/dom/domerrorhandler.c
+++ b/ext/dom/domerrorhandler.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domerrorhandler.c,v 1.5.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: domerrorhandler.c,v 1.5.2.1.2.1.2.8 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,9 +27,7 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_domerrorhandler_handle_error, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, error, DOMError, 0)
ZEND_END_ARG_INFO();
@@ -42,14 +40,13 @@ ZEND_END_ARG_INFO();
* Since: DOM Level 3
*/
-zend_function_entry php_dom_domerrorhandler_class_functions[] = {
+const zend_function_entry php_dom_domerrorhandler_class_functions[] = {
PHP_FALIAS(handleError, dom_domerrorhandler_handle_error, arginfo_dom_domerrorhandler_handle_error)
{NULL, NULL, NULL}
};
/* {{{ attribute protos, not implemented yet */
-
/* {{{ proto dom_boolean dom_domerrorhandler_handle_error(domerror error);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-ERRORS-DOMErrorHandler-handleError
Since:
@@ -59,4 +56,16 @@ PHP_FUNCTION(dom_domerrorhandler_handle_error)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_domerrorhandler_handle_error */
+
+/* }}} */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c
index 56ee632f2..cf94be365 100644
--- a/ext/dom/domexception.c
+++ b/ext/dom/domexception.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domexception.c,v 1.11.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: domexception.c,v 1.11.2.1.2.1.2.4 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,7 +27,6 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/*
* class DOMException
*
@@ -37,12 +36,11 @@
extern zend_class_entry *dom_domexception_class_entry;
-zend_function_entry php_dom_domexception_class_functions[] = {
+const zend_function_entry php_dom_domexception_class_functions[] = {
{NULL, NULL, NULL}
};
-/* {{{ php_dom_throw_error_with_message */
-void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC)
+void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC) /* {{{ */
{
if (strict_error == 1) {
zend_throw_exception(dom_domexception_class_entry, error_message, error_code TSRMLS_CC);
@@ -50,6 +48,7 @@ void php_dom_throw_error_with_message(int error_code, char *error_message, int s
php_libxml_issue_error(E_WARNING, error_message TSRMLS_CC);
}
}
+/* }}} */
/* {{{ php_dom_throw_error */
void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC)
@@ -115,3 +114,12 @@ void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC)
/* }}} end php_dom_throw_error */
#endif /* HAVE_LIBXML && HAVE_DOM */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c
index 7a62b725e..772218c40 100644
--- a/ext/dom/domimplementation.c
+++ b/ext/dom/domimplementation.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementation.c,v 1.15.2.2.2.5 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: domimplementation.c,v 1.15.2.2.2.2.2.9 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,24 +28,20 @@
#include "php_dom.h"
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_get_feature, 0, 0, 2)
ZEND_ARG_INFO(0, feature)
ZEND_ARG_INFO(0, version)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_has_feature, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_create_documenttype, 0, 0, 3)
ZEND_ARG_INFO(0, qualifiedName)
ZEND_ARG_INFO(0, publicId)
ZEND_ARG_INFO(0, systemId)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_create_document, 0, 0, 3)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, qualifiedName)
@@ -60,7 +56,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_domimplementation_class_functions[] = {
+const zend_function_entry php_dom_domimplementation_class_functions[] = {
PHP_ME(domimplementation, getFeature, arginfo_dom_implementation_get_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
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)
@@ -89,7 +85,6 @@ PHP_METHOD(domimplementation, hasFeature)
}
/* }}} end dom_domimplementation_has_feature */
-
/* {{{ proto DOMDocumentType dom_domimplementation_create_document_type(string qualifiedName, string publicId, string systemId);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocType
Since: DOM Level 2
@@ -99,7 +94,7 @@ PHP_METHOD(domimplementation, createDocumentType)
zval *rv = NULL;
xmlDtd *doctype;
int ret, name_len = 0, publicid_len = 0, systemid_len = 0;
- char *name, *publicid, *systemid;
+ char *name = NULL, *publicid = NULL, *systemid = NULL;
xmlChar *pch1 = NULL, *pch2 = NULL, *localname = NULL;
xmlURIPtr uri;
@@ -150,7 +145,6 @@ PHP_METHOD(domimplementation, createDocumentType)
}
/* }}} end dom_domimplementation_create_document_type */
-
/* {{{ proto DOMDocument dom_domimplementation_create_document(string namespaceURI, string qualifiedName, DOMDocumentType doctype);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocument
Since: DOM Level 2
@@ -163,7 +157,7 @@ PHP_METHOD(domimplementation, createDocument)
xmlDtdPtr doctype = NULL;
xmlNsPtr nsptr = NULL;
int ret, uri_len = 0, name_len = 0, errorcode = 0;
- char *uri, *name;
+ char *uri = NULL, *name = NULL;
char *prefix = NULL, *localname = NULL;
dom_object *doctobj;
@@ -253,7 +247,6 @@ PHP_METHOD(domimplementation, createDocument)
}
/* }}} end dom_domimplementation_create_document */
-
/* {{{ proto DOMNode dom_domimplementation_get_feature(string feature, string version);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementation3-getFeature
Since: DOM Level 3
@@ -263,4 +256,14 @@ PHP_METHOD(domimplementation, getFeature)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_domimplementation_get_feature */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/domimplementationlist.c b/ext/dom/domimplementationlist.c
index d49298200..99c5c1cee 100644
--- a/ext/dom/domimplementationlist.c
+++ b/ext/dom/domimplementationlist.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementationlist.c,v 1.6.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: domimplementationlist.c,v 1.6.2.1.2.1.2.8 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,9 +27,7 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationlist_item, 0, 0, 1)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO();
@@ -42,7 +40,7 @@ ZEND_END_ARG_INFO();
* Since: DOM Level 3
*/
-zend_function_entry php_dom_domimplementationlist_class_functions[] = {
+const zend_function_entry php_dom_domimplementationlist_class_functions[] = {
PHP_FALIAS(item, dom_domimplementationlist_item, arginfo_dom_implementationlist_item)
{NULL, NULL, NULL}
};
@@ -63,9 +61,6 @@ int dom_domimplementationlist_length_read(dom_object *obj, zval **retval TSRMLS_
/* }}} */
-
-
-
/* {{{ proto domdomimplementation dom_domimplementationlist_item(int index);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-item
Since:
@@ -75,4 +70,16 @@ PHP_FUNCTION(dom_domimplementationlist_item)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_domimplementationlist_item */
+
+/* }}} */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/domimplementationsource.c b/ext/dom/domimplementationsource.c
index d9cba4a23..e376738d2 100644
--- a/ext/dom/domimplementationsource.c
+++ b/ext/dom/domimplementationsource.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementationsource.c,v 1.5.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: domimplementationsource.c,v 1.5.2.1.2.1.2.8 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,12 +29,10 @@
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationsource_getdomimplementation, 0, 0, 1)
ZEND_ARG_INFO(0, features)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationsource_getdomimplementations, 0, 0, 1)
ZEND_ARG_INFO(0, features)
ZEND_END_ARG_INFO();
@@ -47,7 +45,7 @@ ZEND_END_ARG_INFO();
* Since: DOM Level 3
*/
-zend_function_entry php_dom_domimplementationsource_class_functions[] = {
+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}
@@ -55,7 +53,6 @@ zend_function_entry php_dom_domimplementationsource_class_functions[] = {
/* {{{ attribute protos, not implemented yet */
-
/* {{{ proto domdomimplementation dom_domimplementationsource_get_domimplementation(string features);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpl
Since:
@@ -66,7 +63,6 @@ PHP_FUNCTION(dom_domimplementationsource_get_domimplementation)
}
/* }}} end dom_domimplementationsource_get_domimplementation */
-
/* {{{ proto domimplementationlist dom_domimplementationsource_get_domimplementations(string features);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpls
Since:
@@ -76,4 +72,16 @@ PHP_FUNCTION(dom_domimplementationsource_get_domimplementations)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_domimplementationsource_get_domimplementations */
+
+/* }}} */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/domlocator.c b/ext/dom/domlocator.c
index d80f13cbd..6c8baeb67 100644
--- a/ext/dom/domlocator.c
+++ b/ext/dom/domlocator.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domlocator.c,v 1.6.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: domlocator.c,v 1.6.2.1.2.1.2.4 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -35,7 +35,7 @@
* Since: DOM Level 3
*/
-zend_function_entry php_dom_domlocator_class_functions[] = {
+const zend_function_entry php_dom_domlocator_class_functions[] = {
{NULL, NULL, NULL}
};
@@ -55,8 +55,6 @@ int dom_domlocator_line_number_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ column_number long
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-column-number
@@ -71,8 +69,6 @@ int dom_domlocator_column_number_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ offset long
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-offset
@@ -87,8 +83,6 @@ int dom_domlocator_offset_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ related_node node
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-node
@@ -103,8 +97,6 @@ int dom_domlocator_related_node_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ uri string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-uri
@@ -119,5 +111,15 @@ int dom_domlocator_uri_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
+/* }}} */
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/domstringlist.c b/ext/dom/domstringlist.c
index 31810d962..c6d4ff4cb 100644
--- a/ext/dom/domstringlist.c
+++ b/ext/dom/domstringlist.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domstringlist.c,v 1.6.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: domstringlist.c,v 1.6.2.1.2.1.2.8 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,9 +27,7 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_stringlist_item, 0, 0, 1)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO();
@@ -42,7 +40,7 @@ ZEND_END_ARG_INFO();
* Since: DOM Level 3
*/
-zend_function_entry php_dom_domstringlist_class_functions[] = {
+const zend_function_entry php_dom_domstringlist_class_functions[] = {
PHP_FALIAS(item, dom_domstringlist_item, arginfo_dom_stringlist_item)
{NULL, NULL, NULL}
};
@@ -63,9 +61,6 @@ int dom_domstringlist_length_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
-
/* {{{ proto domstring dom_domstringlist_item(int index);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-item
Since:
@@ -75,4 +70,16 @@ PHP_FUNCTION(dom_domstringlist_item)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_domstringlist_item */
+
+/* }}} */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/element.c b/ext/dom/element.c
index 8b754a4d4..b2b7b7d32 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: element.c,v 1.36.2.4.2.12 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: element.c,v 1.36.2.4.2.8.2.12 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,111 +27,91 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute, 0, 0, 2)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_remove_attribute, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute_node, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute_node, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, newAttr, DOMAttr, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_remove_attribute_node, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, oldAttr, DOMAttr, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_elements_by_tag_name, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute_ns, 0, 0, 2)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, localName)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute_ns, 0, 0, 3)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, qualifiedName)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_remove_attribute_ns, 0, 0, 2)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, localName)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute_node_ns, 0, 0, 2)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, localName)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute_node_ns, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, newAttr, DOMAttr, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_elements_by_tag_name_ns, 0, 0, 2)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, localName)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_has_attribute, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_has_attribute_ns, 0, 0, 2)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, localName)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_id_attribute, 0, 0, 2)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, isId)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_id_attribute_ns, 0, 0, 3)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, localName)
ZEND_ARG_INFO(0, isId)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_id_attribute_node, 0, 0, 2)
ZEND_ARG_OBJ_INFO(0, attr, DOMAttr, 0)
ZEND_ARG_INFO(0, isId)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_construct, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, value)
@@ -146,7 +126,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_element_class_functions[] = {
+const zend_function_entry php_dom_element_class_functions[] = { /* {{{ */
PHP_FALIAS(getAttribute, dom_element_get_attribute, arginfo_dom_element_get_attribute)
PHP_FALIAS(setAttribute, dom_element_set_attribute, arginfo_dom_element_set_attribute)
PHP_FALIAS(removeAttribute, dom_element_remove_attribute, arginfo_dom_element_remove_attribute)
@@ -168,6 +148,7 @@ zend_function_entry php_dom_element_class_functions[] = {
PHP_ME(domelement, __construct, arginfo_dom_element_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
+/* }}} */
/* {{{ proto void DOMElement::__construct(string name, [string value], [string uri]); */
PHP_METHOD(domelement, __construct)
@@ -181,14 +162,15 @@ PHP_METHOD(domelement, __construct)
int errorcode = 0, uri_len = 0;
int name_len, value_len = 0, name_valid;
xmlNsPtr nsptr = NULL;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s!s", &id, dom_element_class_entry, &name, &name_len, &value, &value_len, &uri, &uri_len) == FAILURE) {
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
- php_std_error_handling();
name_valid = xmlValidateName((xmlChar *) name, 0);
if (name_valid != 0) {
php_dom_throw_error(INVALID_CHARACTER_ERR, 1 TSRMLS_CC);
@@ -270,7 +252,7 @@ int dom_element_tag_name_read(dom_object *obj, zval **retval TSRMLS_DC)
ns = nodep->ns;
if (ns != NULL && ns->prefix) {
qname = xmlStrdup(ns->prefix);
- qname = xmlStrcat(qname, ":");
+ qname = xmlStrcat(qname, (xmlChar *)":");
qname = xmlStrcat(qname, nodep->name);
ZVAL_STRING(*retval, (char *)qname, 1);
xmlFree(qname);
@@ -283,8 +265,6 @@ int dom_element_tag_name_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ schemaTypeInfo typeinfo
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Element-schemaTypeInfo
@@ -299,7 +279,8 @@ int dom_element_schema_type_info_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-static xmlNodePtr dom_get_dom1_attribute(xmlNodePtr elem, xmlChar *name) {
+static xmlNodePtr dom_get_dom1_attribute(xmlNodePtr elem, xmlChar *name) /* {{{ */
+{
int len;
const xmlChar *nqname;
@@ -307,7 +288,7 @@ static xmlNodePtr dom_get_dom1_attribute(xmlNodePtr elem, xmlChar *name) {
if (nqname != NULL) {
xmlNsPtr ns;
xmlChar *prefix = xmlStrndup(name, len);
- if (prefix && xmlStrEqual(prefix, "xmlns")) {
+ if (prefix && xmlStrEqual(prefix, (xmlChar *)"xmlns")) {
ns = elem->nsDef;
while (ns) {
if (xmlStrEqual(ns->prefix, nqname)) {
@@ -326,7 +307,7 @@ static xmlNodePtr dom_get_dom1_attribute(xmlNodePtr elem, xmlChar *name) {
return (xmlNodePtr)xmlHasNsProp(elem, nqname, ns->href);
}
} else {
- if (xmlStrEqual(name, "xmlns")) {
+ if (xmlStrEqual(name, (xmlChar *)"xmlns")) {
xmlNsPtr nsPtr = elem->nsDef;
while (nsPtr) {
if (nsPtr->prefix == NULL) {
@@ -339,6 +320,7 @@ static xmlNodePtr dom_get_dom1_attribute(xmlNodePtr elem, xmlChar *name) {
}
return (xmlNodePtr)xmlHasNsProp(elem, name, NULL);
}
+/* }}} */
/* {{{ proto string dom_element_get_attribute(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-666EE0F9
@@ -348,7 +330,8 @@ PHP_FUNCTION(dom_element_get_attribute)
{
zval *id;
xmlNode *nodep;
- char *name, *value = NULL;
+ char *name;
+ xmlChar *value = NULL;
dom_object *intern;
xmlNodePtr attr;
int name_len;
@@ -363,26 +346,25 @@ PHP_FUNCTION(dom_element_get_attribute)
if (attr) {
switch (attr->type) {
case XML_ATTRIBUTE_NODE:
- value = xmlNodeListGetString(attr->doc, attr->children, 1);
+ value = xmlNodeListGetString(attr->doc, attr->children, 1);
break;
case XML_NAMESPACE_DECL:
value = xmlStrdup(((xmlNsPtr)attr)->href);
break;
default:
- value = xmlStrdup(((xmlAttributePtr)attr)->defaultValue);
+ value = xmlStrdup(((xmlAttributePtr)attr)->defaultValue);
}
}
if (value == NULL) {
RETURN_EMPTY_STRING();
} else {
- RETVAL_STRING(value, 1);
+ RETVAL_STRING((char *)value, 1);
xmlFree(value);
}
}
/* }}} end dom_element_get_attribute */
-
/* {{{ proto void dom_element_set_attribute(string name, string value);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-F68F082
Since:
@@ -392,7 +374,7 @@ PHP_FUNCTION(dom_element_set_attribute)
zval *id, *rv = NULL;
xmlNode *nodep;
xmlNodePtr attr = NULL;
- int ret, name_len, value_len;
+ int ret, name_len, value_len, name_valid;
dom_object *intern;
char *name, *value;
@@ -405,6 +387,12 @@ PHP_FUNCTION(dom_element_set_attribute)
RETURN_FALSE;
}
+ name_valid = xmlValidateName((xmlChar *) name, 0);
+ if (name_valid != 0) {
+ php_dom_throw_error(INVALID_CHARACTER_ERR, 1 TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
if (dom_node_is_read_only(nodep) == SUCCESS) {
@@ -416,7 +404,7 @@ PHP_FUNCTION(dom_element_set_attribute)
if (attr != NULL) {
switch (attr->type) {
case XML_ATTRIBUTE_NODE:
- node_list_unlink(attr->children TSRMLS_CC);
+ node_list_unlink(attr->children TSRMLS_CC);
break;
case XML_NAMESPACE_DECL:
RETURN_FALSE;
@@ -426,12 +414,12 @@ PHP_FUNCTION(dom_element_set_attribute)
}
- if (xmlStrEqual((xmlChar *)name, "xmlns")) {
+ if (xmlStrEqual((xmlChar *)name, (xmlChar *)"xmlns")) {
if (xmlNewNs(nodep, (xmlChar *)value, NULL)) {
RETURN_TRUE;
}
} else {
- attr = (xmlNodePtr)xmlSetProp(nodep, (xmlChar *) name, value);
+ attr = (xmlNodePtr)xmlSetProp(nodep, (xmlChar *) name, (xmlChar *)value);
}
if (!attr) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such attribute '%s'", name);
@@ -443,7 +431,6 @@ PHP_FUNCTION(dom_element_set_attribute)
}
/* }}} end dom_element_set_attribute */
-
/* {{{ proto void dom_element_remove_attribute(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6D6AC0F9
Since:
@@ -492,7 +479,6 @@ PHP_FUNCTION(dom_element_remove_attribute)
}
/* }}} end dom_element_remove_attribute */
-
/* {{{ proto DOMAttr dom_element_get_attribute_node(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-217A91B8
Since:
@@ -528,7 +514,7 @@ PHP_FUNCTION(dom_element_get_attribute_node)
if (attrp->children) {
attrp = xmlNewDocNode(nodep->doc, NULL, (xmlChar *) attrp->children, attrp->name);
} else {
- attrp = xmlNewDocNode(nodep->doc, NULL, "xmlns", attrp->name);
+ attrp = xmlNewDocNode(nodep->doc, NULL, (xmlChar *)"xmlns", attrp->name);
}
attrp->type = XML_NAMESPACE_DECL;
attrp->parent = nsparent;
@@ -539,7 +525,6 @@ PHP_FUNCTION(dom_element_get_attribute_node)
}
/* }}} end dom_element_get_attribute_node */
-
/* {{{ proto DOMAttr dom_element_set_attribute_node(DOMAttr newAttr);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-887236154
Since:
@@ -606,7 +591,6 @@ PHP_FUNCTION(dom_element_set_attribute_node)
}
/* }}} end dom_element_set_attribute_node */
-
/* {{{ proto DOMAttr dom_element_remove_attribute_node(DOMAttr oldAttr);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D589198
Since:
@@ -644,7 +628,6 @@ PHP_FUNCTION(dom_element_remove_attribute_node)
}
/* }}} end dom_element_remove_attribute_node */
-
/* {{{ proto DOMNodeList dom_element_get_elements_by_tag_name(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1938918D
Since:
@@ -671,7 +654,6 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name)
}
/* }}} end dom_element_get_elements_by_tag_name */
-
/* {{{ proto string dom_element_get_attribute_ns(string namespaceURI, string localName);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAttrNS
Since: DOM Level 2
@@ -683,7 +665,8 @@ PHP_FUNCTION(dom_element_get_attribute_ns)
xmlNsPtr nsptr;
dom_object *intern;
int uri_len = 0, name_len = 0;
- char *uri, *name, *strattr;
+ char *uri, *name;
+ xmlChar *strattr;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
return;
@@ -694,11 +677,11 @@ PHP_FUNCTION(dom_element_get_attribute_ns)
strattr = xmlGetNsProp(elemp, (xmlChar *) name, (xmlChar *) uri);
if (strattr != NULL) {
- RETVAL_STRING(strattr, 1);
+ RETVAL_STRING((char *)strattr, 1);
xmlFree(strattr);
} else {
- if (xmlStrEqual((xmlChar *) uri, DOM_XMLNS_NAMESPACE)) {
- nsptr = dom_get_nsdecl(elemp, name);
+ if (xmlStrEqual((xmlChar *) uri, (xmlChar *)DOM_XMLNS_NAMESPACE)) {
+ nsptr = dom_get_nsdecl(elemp, (xmlChar *)name);
if (nsptr != NULL) {
RETVAL_STRING((char *) nsptr->href, 1);
} else {
@@ -712,7 +695,8 @@ PHP_FUNCTION(dom_element_get_attribute_ns)
}
/* }}} end dom_element_get_attribute_ns */
-static xmlNsPtr _dom_new_reconNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
+static xmlNsPtr _dom_new_reconNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) /* {{{ */
+{
xmlNsPtr def;
xmlChar prefix[50];
int counter = 1;
@@ -748,6 +732,7 @@ static xmlNsPtr _dom_new_reconNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
def = xmlNewNs(tree, ns->href, prefix);
return(def);
}
+/* }}} */
/* {{{ proto void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAttrNS
@@ -763,7 +748,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
char *uri, *name, *value;
char *localname = NULL, *prefix = NULL;
dom_object *intern;
- int errorcode = 0, stricterror, is_xmlns = 0;
+ int errorcode = 0, stricterror, is_xmlns = 0, name_valid;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!ss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
return;
@@ -792,11 +777,11 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
node_list_unlink(nodep->children TSRMLS_CC);
}
- if (xmlStrEqual((xmlChar *) prefix,"xmlns") && xmlStrEqual((xmlChar *) uri, DOM_XMLNS_NAMESPACE)) {
+ if (xmlStrEqual((xmlChar *) prefix, (xmlChar *)"xmlns") && xmlStrEqual((xmlChar *) uri, (xmlChar *)DOM_XMLNS_NAMESPACE)) {
is_xmlns = 1;
- nsptr = dom_get_nsdecl(elemp, localname);
+ nsptr = dom_get_nsdecl(elemp, (xmlChar *)localname);
} else {
- nsptr = xmlSearchNsByHref(elemp->doc, elemp, uri);
+ nsptr = xmlSearchNsByHref(elemp->doc, elemp, (xmlChar *)uri);
if (nsptr && nsptr->prefix == NULL) {
xmlNsPtr tmpnsptr;
@@ -820,7 +805,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
errorcode = NAMESPACE_ERR;
} else {
if (is_xmlns == 1) {
- xmlNewNs(elemp, value, localname);
+ xmlNewNs(elemp, (xmlChar *)value, (xmlChar *)localname);
} else {
nsptr = dom_get_ns(elemp, uri, &errorcode, prefix);
}
@@ -831,19 +816,25 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
if (nsptr->href) {
xmlFree((xmlChar *) nsptr->href);
}
- nsptr->href = xmlStrdup(value);
+ nsptr->href = xmlStrdup((xmlChar *)value);
}
}
if (errorcode == 0 && is_xmlns == 0) {
- attr = xmlSetNsProp(elemp, nsptr, localname, value);
+ attr = xmlSetNsProp(elemp, nsptr, (xmlChar *)localname, (xmlChar *)value);
}
} else {
- attr = xmlHasProp(elemp, localname);
- if (attr != NULL && attr->type != XML_ATTRIBUTE_DECL) {
- node_list_unlink(attr->children TSRMLS_CC);
+ name_valid = xmlValidateName((xmlChar *) localname, 0);
+ if (name_valid != 0) {
+ errorcode = INVALID_CHARACTER_ERR;
+ stricterror = 1;
+ } else {
+ attr = xmlHasProp(elemp, (xmlChar *)localname);
+ if (attr != NULL && attr->type != XML_ATTRIBUTE_DECL) {
+ node_list_unlink(attr->children TSRMLS_CC);
+ }
+ attr = xmlSetProp(elemp, (xmlChar *)localname, (xmlChar *)value);
}
- attr = xmlSetProp(elemp, localname, value);
}
}
@@ -860,7 +851,6 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
}
/* }}} end dom_element_set_attribute_ns */
-
/* {{{ proto void dom_element_remove_attribute_ns(string namespaceURI, string localName);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElRemAtNS
Since: DOM Level 2
@@ -918,7 +908,6 @@ PHP_FUNCTION(dom_element_remove_attribute_ns)
}
/* }}} end dom_element_remove_attribute_ns */
-
/* {{{ proto DOMAttr dom_element_get_attribute_node_ns(string namespaceURI, string localName);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAtNodeNS
Since: DOM Level 2
@@ -938,7 +927,7 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns)
DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
- attrp = xmlHasNsProp(elemp, name, uri);
+ attrp = xmlHasNsProp(elemp, (xmlChar *)name, (xmlChar *)uri);
if (attrp == NULL) {
RETURN_NULL();
@@ -949,7 +938,6 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns)
}
/* }}} end dom_element_get_attribute_node_ns */
-
/* {{{ proto DOMAttr dom_element_set_attribute_node_ns(DOMAttr newAttr);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAtNodeNS
Since: DOM Level 2
@@ -1023,8 +1011,6 @@ PHP_FUNCTION(dom_element_set_attribute_node_ns)
}
/* }}} end dom_element_set_attribute_node_ns */
-
-
/* {{{ proto DOMNodeList dom_element_get_elements_by_tag_name_ns(string namespaceURI, string localName);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C90942
Since: DOM Level 2
@@ -1053,7 +1039,6 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns)
}
/* }}} end dom_element_get_elements_by_tag_name_ns */
-
/* {{{ proto boolean dom_element_has_attribute(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttr
Since: DOM Level 2
@@ -1082,7 +1067,6 @@ PHP_FUNCTION(dom_element_has_attribute)
}
/* }}} end dom_element_has_attribute */
-
/* {{{ proto boolean dom_element_has_attribute_ns(string namespaceURI, string localName);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttrNS
Since: DOM Level 2
@@ -1109,8 +1093,8 @@ PHP_FUNCTION(dom_element_has_attribute_ns)
xmlFree(value);
RETURN_TRUE;
} else {
- if (xmlStrEqual(uri, DOM_XMLNS_NAMESPACE)) {
- nsp = dom_get_nsdecl(elemp, name);
+ if (xmlStrEqual((xmlChar *)uri, (xmlChar *)DOM_XMLNS_NAMESPACE)) {
+ nsp = dom_get_nsdecl(elemp, (xmlChar *)name);
if (nsp != NULL) {
RETURN_TRUE;
}
@@ -1121,8 +1105,7 @@ PHP_FUNCTION(dom_element_has_attribute_ns)
}
/* }}} end dom_element_has_attribute_ns */
-
-static void php_set_attribute_id(xmlAttrPtr attrp, zend_bool is_id)
+static void php_set_attribute_id(xmlAttrPtr attrp, zend_bool is_id) /* {{{ */
{
if (is_id == 1 && attrp->atype != XML_ATTRIBUTE_ID) {
xmlChar *id_val;
@@ -1139,6 +1122,7 @@ static void php_set_attribute_id(xmlAttrPtr attrp, zend_bool is_id)
}
}
}
+/* }}} */
/* {{{ proto void dom_element_set_id_attribute(string name, boolean isId);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttr
@@ -1165,7 +1149,7 @@ PHP_FUNCTION(dom_element_set_id_attribute)
RETURN_NULL();
}
- attrp = xmlHasNsProp(nodep, name, NULL);
+ attrp = xmlHasNsProp(nodep, (xmlChar *)name, NULL);
if (attrp == NULL || attrp->type == XML_ATTRIBUTE_DECL) {
php_dom_throw_error(NOT_FOUND_ERR, dom_get_strict_error(intern->document) TSRMLS_CC);
} else {
@@ -1176,7 +1160,6 @@ PHP_FUNCTION(dom_element_set_id_attribute)
}
/* }}} end dom_element_set_id_attribute */
-
/* {{{ proto void dom_element_set_id_attribute_ns(string namespaceURI, string localName, boolean isId);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNS
Since: DOM Level 3
@@ -1213,7 +1196,6 @@ PHP_FUNCTION(dom_element_set_id_attribute_ns)
}
/* }}} end dom_element_set_id_attribute_ns */
-
/* {{{ proto void dom_element_set_id_attribute_node(attr idAttr, boolean isId);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNode
Since: DOM Level 3
@@ -1250,3 +1232,12 @@ PHP_FUNCTION(dom_element_set_id_attribute_node)
/* }}} end dom_element_set_id_attribute_node */
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/entity.c b/ext/dom/entity.c
index 363d6d42a..1e53ebdcb 100644
--- a/ext/dom/entity.c
+++ b/ext/dom/entity.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: entity.c,v 1.9.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: entity.c,v 1.9.2.1.2.1.2.4 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -35,7 +35,7 @@
* Since:
*/
-zend_function_entry php_dom_entity_class_functions[] = {
+const zend_function_entry php_dom_entity_class_functions[] = {
{NULL, NULL, NULL}
};
@@ -67,8 +67,6 @@ int dom_entity_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ systemId string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-D7C29F3E
@@ -97,8 +95,6 @@ int dom_entity_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ notationName string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-6ABAEB38
@@ -130,8 +126,6 @@ int dom_entity_notation_name_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ actualEncoding string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-actualEncoding
@@ -151,8 +145,6 @@ int dom_entity_actual_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
-
-
/* {{{ encoding string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-encoding
@@ -172,8 +164,6 @@ int dom_entity_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
-
-
/* {{{ version string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Entity3-version
@@ -194,3 +184,12 @@ int dom_entity_version_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c
index b01bcbf7a..6d8d7f560 100644
--- a/ext/dom/entityreference.c
+++ b/ext/dom/entityreference.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: entityreference.c,v 1.12.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: entityreference.c,v 1.12.2.1.2.2.2.10 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,9 +27,7 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_entityreference_construct, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
@@ -42,7 +40,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_entityreference_class_functions[] = {
+const zend_function_entry php_dom_entityreference_class_functions[] = {
PHP_ME(domentityreference, __construct, arginfo_dom_entityreference_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
@@ -56,14 +54,15 @@ PHP_METHOD(domentityreference, __construct)
dom_object *intern;
char *name;
int name_len, name_valid;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_entityreference_class_entry, &name, &name_len) == FAILURE) {
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
name_valid = xmlValidateName((xmlChar *) name, 0);
if (name_valid != 0) {
@@ -87,6 +86,15 @@ PHP_METHOD(domentityreference, __construct)
php_libxml_increment_node_ptr((php_libxml_node_object *)intern, node, (void *)intern TSRMLS_CC);
}
}
-
/* }}} end DOMEntityReference::__construct */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c
index 2f83607a2..50c8f027f 100644
--- a/ext/dom/namednodemap.c
+++ b/ext/dom/namednodemap.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: namednodemap.c,v 1.15.2.2.2.4 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: namednodemap.c,v 1.15.2.2.2.1.2.8 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,40 +27,32 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_get_named_item, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_set_named_item, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_remove_named_item, 0, 0, 0)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_item, 0, 0, 0)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_get_named_item_ns, 0, 0, 0)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, localName)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_set_named_item_ns, 0, 0, 0)
ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_remove_named_item_ns, 0, 0, 0)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_ARG_INFO(0, localName)
@@ -74,7 +66,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_namednodemap_class_functions[] = {
+const zend_function_entry php_dom_namednodemap_class_functions[] = { /* {{{ */
PHP_FALIAS(getNamedItem, dom_namednodemap_get_named_item, arginfo_dom_namednodemap_get_named_item)
PHP_FALIAS(setNamedItem, dom_namednodemap_set_named_item, arginfo_dom_namednodemap_set_named_item)
PHP_FALIAS(removeNamedItem, dom_namednodemap_remove_named_item, arginfo_dom_namednodemap_remove_named_item)
@@ -84,6 +76,7 @@ zend_function_entry php_dom_namednodemap_class_functions[] = {
PHP_FALIAS(removeNamedItemNS, dom_namednodemap_remove_named_item_ns, arginfo_dom_namednodemap_remove_named_item_ns)
{NULL, NULL, NULL}
};
+/* }}} */
/* {{{ length int
readonly=yes
@@ -127,9 +120,6 @@ int dom_namednodemap_length_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
-
/* {{{ proto DOMNode dom_namednodemap_get_named_item(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1074577549
Since:
@@ -184,7 +174,6 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
}
/* }}} end dom_namednodemap_get_named_item */
-
/* {{{ proto DOMNode dom_namednodemap_set_named_item(DOMNode arg);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1025163788
Since:
@@ -195,7 +184,6 @@ PHP_FUNCTION(dom_namednodemap_set_named_item)
}
/* }}} end dom_namednodemap_set_named_item */
-
/* {{{ proto DOMNode dom_namednodemap_remove_named_item(string name);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D58B193
Since:
@@ -206,7 +194,6 @@ PHP_FUNCTION(dom_namednodemap_remove_named_item)
}
/* }}} end dom_namednodemap_remove_named_item */
-
/* {{{ proto DOMNode dom_namednodemap_item(int index);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-349467F9
Since:
@@ -265,7 +252,6 @@ PHP_FUNCTION(dom_namednodemap_item)
}
/* }}} end dom_namednodemap_item */
-
/* {{{ proto DOMNode dom_namednodemap_get_named_item_ns(string namespaceURI, string localName);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getNamedItemNS
Since: DOM Level 2
@@ -320,7 +306,6 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
}
/* }}} end dom_namednodemap_get_named_item_ns */
-
/* {{{ proto DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-setNamedItemNS
Since: DOM Level 2
@@ -331,7 +316,6 @@ PHP_FUNCTION(dom_namednodemap_set_named_item_ns)
}
/* }}} end dom_namednodemap_set_named_item_ns */
-
/* {{{ proto DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-removeNamedItemNS
Since: DOM Level 2
@@ -341,4 +325,14 @@ PHP_FUNCTION(dom_namednodemap_remove_named_item_ns)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_namednodemap_remove_named_item_ns */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/namelist.c b/ext/dom/namelist.c
index c0c82b602..164e04963 100644
--- a/ext/dom/namelist.c
+++ b/ext/dom/namelist.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: namelist.c,v 1.7.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: namelist.c,v 1.7.2.1.2.1.2.8 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,14 +27,11 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namelist_get_name, 0, 0, 1)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namelist_get_namespace_uri, 0, 0, 1)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO();
@@ -47,7 +44,7 @@ ZEND_END_ARG_INFO();
* Since: DOM Level 3
*/
-zend_function_entry php_dom_namelist_class_functions[] = {
+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}
@@ -67,9 +64,6 @@ int dom_namelist_length_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
-
/* {{{ proto string dom_namelist_get_name(int index);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getName
Since:
@@ -80,7 +74,6 @@ PHP_FUNCTION(dom_namelist_get_name)
}
/* }}} end dom_namelist_get_name */
-
/* {{{ proto string dom_namelist_get_namespace_uri(int index);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getNamespaceURI
Since:
@@ -90,4 +83,14 @@ PHP_FUNCTION(dom_namelist_get_namespace_uri)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_namelist_get_namespace_uri */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 138c59dec..82366c63c 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: node.c,v 1.37.2.3.2.13 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: node.c,v 1.37.2.3.2.8.2.14 2009/03/13 13:43:29 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,104 +28,87 @@
#include "php_dom.h"
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_insert_before, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
ZEND_ARG_OBJ_INFO(0, refChild, DOMNode, 1)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_replace_child, 0, 0, 2)
ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
ZEND_ARG_OBJ_INFO(0, oldChild, DOMNode, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_remove_child, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, oldChild, DOMNode, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_append_child, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_has_child_nodes, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_clone_node, 0, 0, 1)
ZEND_ARG_INFO(0, deep)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_normalize, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_supported, 0, 0, 2)
ZEND_ARG_INFO(0, feature)
ZEND_ARG_INFO(0, version)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_has_attributes, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_compare_document_position, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, other, DOMNode, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_same_node, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, other, DOMNode, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_lookup_prefix, 0, 0, 1)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_default_namespace, 0, 0, 1)
ZEND_ARG_INFO(0, namespaceURI)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_lookup_namespace_uri, 0, 0, 1)
ZEND_ARG_INFO(0, prefix)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_equal_node, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_get_feature, 0, 0, 2)
ZEND_ARG_INFO(0, feature)
ZEND_ARG_INFO(0, version)
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_INFO(0, data)
ZEND_ARG_INFO(0, handler)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_get_user_data, 0, 0, 1)
ZEND_ARG_INFO(0, key)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_getNodePath, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_getLineNo, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_C14N, 0, 0, 0)
ZEND_ARG_INFO(0, exclusive)
ZEND_ARG_INFO(0, with_comments)
@@ -133,7 +116,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_C14N, 0, 0, 0)
ZEND_ARG_ARRAY_INFO(0, ns_prefixes, 1)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_C14NFile, 0, 0, 1)
ZEND_ARG_INFO(0, uri)
ZEND_ARG_INFO(0, exclusive)
@@ -150,7 +132,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_node_class_functions[] = {
+const zend_function_entry php_dom_node_class_functions[] = { /* {{{ */
PHP_FALIAS(insertBefore, dom_node_insert_before, arginfo_dom_node_insert_before)
PHP_FALIAS(replaceChild, dom_node_replace_child, arginfo_dom_node_replace_child)
PHP_FALIAS(removeChild, dom_node_remove_child, arginfo_dom_node_remove_child)
@@ -170,26 +152,44 @@ zend_function_entry php_dom_node_class_functions[] = {
PHP_FALIAS(setUserData, dom_node_set_user_data, arginfo_dom_node_set_user_data)
PHP_FALIAS(getUserData, dom_node_get_user_data, arginfo_dom_node_get_user_data)
PHP_ME(domnode, getNodePath, arginfo_dom_node_getNodePath, ZEND_ACC_PUBLIC)
+ 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}
};
+/* }}} */
-static void dom_reconcile_ns(xmlDocPtr doc, xmlNodePtr nodep) {
- xmlNsPtr nsptr;
+static void dom_reconcile_ns(xmlDocPtr doc, xmlNodePtr nodep) /* {{{ */
+{
+ xmlNsPtr nsptr, nsdftptr, curns, prevns = NULL;
if (nodep->type == XML_ELEMENT_NODE) {
/* Following if block primarily used for inserting nodes created via createElementNS */
- if (nodep->nsDef != NULL && nodep->nsDef->href != NULL) {
- if((nsptr = xmlSearchNsByHref(doc, nodep->parent, nodep->nsDef->href)) &&
- (nodep->nsDef->prefix == NULL || xmlStrEqual(nsptr->prefix, nodep->nsDef->prefix))) {
- dom_set_old_ns(doc, nodep->nsDef);
- nodep->nsDef = NULL;
+ if (nodep->nsDef != NULL) {
+ curns = nodep->nsDef;
+ while (curns) {
+ nsdftptr = curns->next;
+ if (curns->href != NULL) {
+ if((nsptr = xmlSearchNsByHref(doc, nodep->parent, curns->href)) &&
+ (curns->prefix == NULL || xmlStrEqual(nsptr->prefix, curns->prefix))) {
+ curns->next = NULL;
+ if (prevns == NULL) {
+ nodep->nsDef = nsdftptr;
+ } else {
+ prevns->next = nsdftptr;
+ }
+ dom_set_old_ns(doc, curns);
+ curns = prevns;
+ }
+ }
+ prevns = curns;
+ curns = nsdftptr;
}
}
xmlReconciliateNs(doc, nodep);
}
}
+/* }}} */
/* {{{ nodeName string
readonly=yes
@@ -260,7 +260,6 @@ int dom_node_node_name_read(dom_object *obj, zval **retval TSRMLS_DC)
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Node Type");
- return FAILURE;
}
ALLOC_ZVAL(*retval);
@@ -281,8 +280,6 @@ int dom_node_node_name_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ nodeValue string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-F68D080
@@ -356,7 +353,7 @@ int dom_node_node_value_write(dom_object *obj, zval *newval TSRMLS_DC)
case XML_CDATA_SECTION_NODE:
case XML_PI_NODE:
if (newval->type != IS_STRING) {
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -377,8 +374,6 @@ int dom_node_node_value_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
-
-
/* {{{ nodeType int
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-111237558
@@ -409,8 +404,6 @@ int dom_node_node_type_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ parentNode DomNode
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1060184317
@@ -428,13 +421,14 @@ int dom_node_parent_node_read(dom_object *obj, zval **retval TSRMLS_DC)
return FAILURE;
}
+ ALLOC_ZVAL(*retval);
+
nodeparent = nodep->parent;
if (!nodeparent) {
- return FAILURE;
+ ZVAL_NULL(*retval);
+ return SUCCESS;
}
- ALLOC_ZVAL(*retval);
-
if (NULL == (*retval = php_dom_create_object(nodeparent, &ret, NULL, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
@@ -444,8 +438,6 @@ int dom_node_parent_node_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ childNodes DomNodeList
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1451460987
@@ -478,8 +470,6 @@ int dom_node_child_nodes_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ firstChild DomNode
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-169727388
@@ -501,12 +491,13 @@ int dom_node_first_child_read(dom_object *obj, zval **retval TSRMLS_DC)
first = nodep->children;
}
+ ALLOC_ZVAL(*retval);
+
if (!first) {
- return FAILURE;
+ ZVAL_NULL(*retval);
+ return SUCCESS;
}
- ALLOC_ZVAL(*retval);
-
if (NULL == (*retval = php_dom_create_object(first, &ret, NULL, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
@@ -516,8 +507,6 @@ int dom_node_first_child_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ lastChild DomNode
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-61AD09FB
@@ -539,12 +528,13 @@ int dom_node_last_child_read(dom_object *obj, zval **retval TSRMLS_DC)
last = nodep->last;
}
+ ALLOC_ZVAL(*retval);
+
if (!last) {
- return FAILURE;
+ ZVAL_NULL(*retval);
+ return SUCCESS;
}
- ALLOC_ZVAL(*retval);
-
if (NULL == (*retval = php_dom_create_object(last, &ret, NULL, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
@@ -554,8 +544,6 @@ int dom_node_last_child_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ previousSibling DomNode
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-640FB3C8
@@ -573,13 +561,14 @@ int dom_node_previous_sibling_read(dom_object *obj, zval **retval TSRMLS_DC)
return FAILURE;
}
+ ALLOC_ZVAL(*retval);
+
prevsib = nodep->prev;
if (!prevsib) {
- return FAILURE;
+ ZVAL_NULL(*retval);
+ return SUCCESS;
}
- ALLOC_ZVAL(*retval);
-
if (NULL == (*retval = php_dom_create_object(prevsib, &ret, NULL, *retval, obj TSRMLS_CC))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
return FAILURE;
@@ -589,8 +578,6 @@ int dom_node_previous_sibling_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ nextSibling DomNode
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6AC54C2F
@@ -624,8 +611,6 @@ int dom_node_next_sibling_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ attributes DomNamedNodeMap
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-84CF096
@@ -658,8 +643,6 @@ int dom_node_attributes_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ ownerDocument DomDocument
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-node-ownerDoc
@@ -700,8 +683,6 @@ int dom_node_owner_document_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ namespaceUri string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeNSname
@@ -745,8 +726,6 @@ int dom_node_namespace_uri_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ prefix string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeNSPrefix
@@ -816,7 +795,7 @@ int dom_node_prefix_write(dom_object *obj, zval *newval TSRMLS_DC)
}
}
if (newval->type != IS_STRING) {
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -869,8 +848,6 @@ int dom_node_prefix_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
-
-
/* {{{ localName string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeNSLocalN
@@ -900,8 +877,6 @@ int dom_node_local_name_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ baseURI string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-baseURI
@@ -934,8 +909,6 @@ int dom_node_base_uri_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ textContent string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-textContent
@@ -974,10 +947,7 @@ int dom_node_text_content_write(dom_object *obj, zval *newval TSRMLS_DC)
/* }}} */
-
-static xmlNodePtr _php_dom_insert_fragment(xmlNodePtr nodep, xmlNodePtr prevsib,
- xmlNodePtr nextsib, xmlNodePtr fragment,
- dom_object *intern, dom_object *childobj TSRMLS_DC)
+static xmlNodePtr _php_dom_insert_fragment(xmlNodePtr nodep, xmlNodePtr prevsib, xmlNodePtr nextsib, xmlNodePtr fragment, dom_object *intern, dom_object *childobj TSRMLS_DC) /* {{{ */
{
xmlNodePtr newchild, node;
@@ -1020,6 +990,7 @@ static xmlNodePtr _php_dom_insert_fragment(xmlNodePtr nodep, xmlNodePtr prevsib,
return newchild;
}
+/* }}} */
/* {{{ proto domnode dom_node_insert_before(DomNode newChild, DomNode refChild);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-952280727
@@ -1182,7 +1153,6 @@ PHP_FUNCTION(dom_node_insert_before)
}
/* }}} end dom_node_insert_before */
-
/* {{{ proto DomNode dom_node_replace_child(DomNode newChild, DomNode oldChild);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-785887307
Since:
@@ -1274,7 +1244,6 @@ PHP_FUNCTION(dom_node_replace_child)
}
/* }}} end dom_node_replace_child */
-
/* {{{ proto DomNode dom_node_remove_child(DomNode oldChild);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1734834066
Since:
@@ -1327,7 +1296,6 @@ PHP_FUNCTION(dom_node_remove_child)
}
/* }}} end dom_node_remove_child */
-
/* {{{ proto DomNode dom_node_append_child(DomNode newChild);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-184E7107
Since:
@@ -1429,7 +1397,6 @@ PHP_FUNCTION(dom_node_append_child)
}
/* }}} end dom_node_append_child */
-
/* {{{ proto boolean dom_node_has_child_nodes();
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-810594187
Since:
@@ -1458,7 +1425,6 @@ PHP_FUNCTION(dom_node_has_child_nodes)
}
/* }}} end dom_node_has_child_nodes */
-
/* {{{ proto DomNode dom_node_clone_node(boolean deep);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3A0ED0A4
Since:
@@ -1521,8 +1487,6 @@ PHP_FUNCTION(dom_node_clone_node)
}
/* }}} end dom_node_clone_node */
-
-
/* {{{ proto void dom_node_normalize();
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-normalize
Since:
@@ -1544,7 +1508,6 @@ PHP_FUNCTION(dom_node_normalize)
}
/* }}} end dom_node_normalize */
-
/* {{{ proto boolean dom_node_is_supported(string feature, string version);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Level-2-Core-Node-supports
Since: DOM Level 2
@@ -1567,7 +1530,6 @@ PHP_FUNCTION(dom_node_is_supported)
}
/* }}} end dom_node_is_supported */
-
/* {{{ proto boolean dom_node_has_attributes();
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeHasAttrs
Since: DOM Level 2
@@ -1605,7 +1567,6 @@ PHP_FUNCTION(dom_node_compare_document_position)
}
/* }}} end dom_node_compare_document_position */
-
/* {{{ proto boolean dom_node_is_same_node(DomNode other);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isSameNode
Since: DOM Level 3
@@ -1632,7 +1593,6 @@ PHP_FUNCTION(dom_node_is_same_node)
}
/* }}} end dom_node_is_same_node */
-
/* {{{ proto string dom_node_lookup_prefix(string namespaceURI);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-lookupNamespacePrefix
Since: DOM Level 3
@@ -1683,7 +1643,6 @@ PHP_FUNCTION(dom_node_lookup_prefix)
}
/* }}} end dom_node_lookup_prefix */
-
/* {{{ proto boolean dom_node_is_default_namespace(string namespaceURI);
URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace
Since: DOM Level 3
@@ -1717,7 +1676,6 @@ PHP_FUNCTION(dom_node_is_default_namespace)
}
/* }}} end dom_node_is_default_namespace */
-
/* {{{ proto string dom_node_lookup_namespace_uri(string prefix);
URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI
Since: DOM Level 3
@@ -1752,7 +1710,6 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri)
}
/* }}} end dom_node_lookup_namespace_uri */
-
/* {{{ proto boolean dom_node_is_equal_node(DomNode arg);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isEqualNode
Since: DOM Level 3
@@ -1763,7 +1720,6 @@ PHP_FUNCTION(dom_node_is_equal_node)
}
/* }}} end dom_node_is_equal_node */
-
/* {{{ proto DomNode dom_node_get_feature(string feature, string version);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getFeature
Since: DOM Level 3
@@ -1774,7 +1730,6 @@ PHP_FUNCTION(dom_node_get_feature)
}
/* }}} end dom_node_get_feature */
-
/* {{{ proto DomUserData dom_node_set_user_data(string key, DomUserData data, userdatahandler handler);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-setUserData
Since: DOM Level 3
@@ -1785,7 +1740,6 @@ PHP_FUNCTION(dom_node_set_user_data)
}
/* }}} end dom_node_set_user_data */
-
/* {{{ proto DomUserData dom_node_get_user_data(string key);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getUserData
Since: DOM Level 3
@@ -1796,8 +1750,7 @@ PHP_FUNCTION(dom_node_get_user_data)
}
/* }}} end dom_node_get_user_data */
-
-static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode)
+static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
{
zval *id;
zval *xpath_array=NULL, *ns_prefixes=NULL;
@@ -1965,6 +1918,7 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode)
}
}
}
+/* }}} */
/* {{{ proto string DOMNode::C14N([bool exclusive [, bool with_comments [, array xpath [, array ns_prefixes]]]])
Canonicalize nodes to a string */
@@ -1972,6 +1926,7 @@ PHP_METHOD(domnode, C14N)
{
dom_canonicalization(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
+/* }}} */
/* {{{ proto int DOMNode::C14NFile(string uri [, bool exclusive [, bool with_comments [, array xpath [, array ns_prefixes]]]])
Canonicalize nodes to a file */
@@ -1979,12 +1934,10 @@ PHP_METHOD(domnode, C14NFile)
{
dom_canonicalization(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
-
-#endif
+/* }}} */
/* {{{ proto int DOMNode::getNodePath()
Gets an xpath for a node */
-
PHP_METHOD(domnode, getNodePath)
{
zval *id;
@@ -1992,8 +1945,6 @@ PHP_METHOD(domnode, getNodePath)
dom_object *intern;
char *value;
-
-
DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
value = xmlGetNodePath(nodep);
@@ -2003,7 +1954,34 @@ PHP_METHOD(domnode, getNodePath)
RETVAL_STRING(value, 1);
xmlFree(value);
}
+}
+/* }}} */
+/* {{{ proto int DOMNode::getLineNo()
+ Gets line number for a node */
+PHP_METHOD(domnode, getLineNo)
+{
+ zval *id;
+ xmlNode *nodep;
+ dom_object *intern;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
+
+ RETURN_LONG(xmlGetLineNo(nodep));
}
+/* }}} */
+#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c
index ecea228dc..84ca08dc4 100644
--- a/ext/dom/nodelist.c
+++ b/ext/dom/nodelist.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: nodelist.c,v 1.17.2.2.2.5 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: nodelist.c,v 1.17.2.2.2.2.2.8 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,7 +29,6 @@
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_nodelist_item, 0, 0, 1)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO();
@@ -42,7 +41,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_nodelist_class_functions[] = {
+const zend_function_entry php_dom_nodelist_class_functions[] = {
PHP_FALIAS(item, dom_nodelist_item, arginfo_dom_nodelist_item)
{NULL, NULL, NULL}
};
@@ -99,7 +98,6 @@ int dom_nodelist_length_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
/* {{{ proto DOMNode dom_nodelist_item(int index);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-844377136
Since:
@@ -173,4 +171,14 @@ PHP_FUNCTION(dom_nodelist_item)
RETVAL_NULL();
}
/* }}} end dom_nodelist_item */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/notation.c b/ext/dom/notation.c
index e30f5a875..84e5bdf42 100644
--- a/ext/dom/notation.c
+++ b/ext/dom/notation.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: notation.c,v 1.9.2.2.2.3 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: notation.c,v 1.9.2.2.2.1.2.4 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,7 +27,6 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/*
* class DOMNotation extends DOMNode
*
@@ -35,7 +34,7 @@
* Since:
*/
-zend_function_entry php_dom_notation_class_functions[] = {
+const zend_function_entry php_dom_notation_class_functions[] = {
{NULL, NULL, NULL}
};
@@ -69,8 +68,6 @@ int dom_notation_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ systemId string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-E8AAB1D0
@@ -99,4 +96,15 @@ int dom_notation_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
+/* }}} */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 37d4dc2a7..feaf3afeb 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.c,v 1.73.2.12.2.15 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: php_dom.c,v 1.73.2.12.2.12.2.14 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -34,6 +34,7 @@
#define PHP_XPATH 1
#define PHP_XPTR 2
+/* {{{ class entries */
zend_class_entry *dom_node_class_entry;
zend_class_entry *dom_domexception_class_entry;
zend_class_entry *dom_domstringlist_class_entry;
@@ -67,12 +68,12 @@ zend_class_entry *dom_string_extend_class_entry;
zend_class_entry *dom_xpath_class_entry;
#endif
zend_class_entry *dom_namespace_node_class_entry;
+/* }}} */
zend_object_handlers dom_object_handlers;
-zend_object_handlers dom_ze1_object_handlers;
static HashTable classes;
-
+/* {{{ prop handler tables */
static HashTable dom_domstringlist_prop_handlers;
static HashTable dom_namelist_prop_handlers;
static HashTable dom_domimplementationlist_prop_handlers;
@@ -95,6 +96,7 @@ static HashTable dom_namespace_node_prop_handlers;
#if defined(LIBXML_XPATH_ENABLED)
static HashTable dom_xpath_prop_handlers;
#endif
+/* }}} */
typedef int (*dom_read_t)(dom_object *obj, zval **retval TSRMLS_DC);
typedef int (*dom_write_t)(dom_object *obj, zval *newval TSRMLS_DC);
@@ -170,6 +172,31 @@ dom_doc_propsptr dom_get_doc_props(php_libxml_ref_obj *document)
}
}
+static void dom_copy_doc_props(php_libxml_ref_obj *source_doc, php_libxml_ref_obj *dest_doc)
+{
+ dom_doc_propsptr source, dest;
+
+ if (source_doc && dest_doc) {
+
+ source = dom_get_doc_props(source_doc);
+ dest = dom_get_doc_props(dest_doc);
+
+ dest->formatoutput = source->formatoutput;
+ dest->validateonparse = source->validateonparse;
+ dest->resolveexternals = source->resolveexternals;
+ dest->preservewhitespace = source->preservewhitespace;
+ dest->substituteentities = source->substituteentities;
+ dest->stricterror = source->stricterror;
+ dest->recover = source->recover;
+ if (source->classmap) {
+ ALLOC_HASHTABLE(dest->classmap);
+ zend_hash_init(dest->classmap, 0, NULL, NULL, 0);
+ zend_hash_copy(dest->classmap, source->classmap, NULL, NULL, sizeof(zend_class_entry *));
+ }
+
+ }
+}
+
int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce TSRMLS_DC)
{
dom_doc_propsptr doc_props;
@@ -275,7 +302,7 @@ static void dom_register_prop_handler(HashTable *prop_handler, char *name, dom_r
}
/* }}} */
-static zval **dom_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC)
+static zval **dom_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */
{
dom_object *obj;
zval tmp_member;
@@ -306,6 +333,7 @@ static zval **dom_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC)
}
return retval;
}
+/* }}} */
/* {{{ dom_read_property */
zval *dom_read_property(zval *object, zval *member, int type TSRMLS_DC)
@@ -336,8 +364,8 @@ zval *dom_read_property(zval *object, zval *member, int type TSRMLS_DC)
ret = hnd->read_func(obj, &retval TSRMLS_CC);
if (ret == SUCCESS) {
/* ensure we're creating a temporary variable */
- retval->refcount = 0;
- retval->is_ref = 0;
+ Z_SET_REFCOUNT_P(retval, 0);
+ Z_UNSET_ISREF_P(retval);
} else {
retval = EG(uninitialized_zval_ptr);
}
@@ -416,8 +444,8 @@ static int dom_property_exists(zval *object, zval *member, int check_empty TSRML
if (check_empty == 2) {
retval = 1;
} else if (hnd->read_func(obj, &tmp TSRMLS_CC) == SUCCESS) {
- tmp->refcount = 1;
- tmp->is_ref = 0;
+ Z_SET_REFCOUNT_P(tmp, 1);
+ Z_UNSET_ISREF_P(tmp);
if (check_empty == 1) {
retval = zend_is_true(tmp);
} else if (check_empty == 0) {
@@ -437,7 +465,7 @@ static int dom_property_exists(zval *object, zval *member, int check_empty TSRML
}
/* }}} */
-void *php_dom_export_node(zval *object TSRMLS_DC)
+void *php_dom_export_node(zval *object TSRMLS_DC) /* {{{ */
{
php_libxml_node_object *intern;
xmlNodePtr nodep = NULL;
@@ -449,6 +477,7 @@ void *php_dom_export_node(zval *object TSRMLS_DC)
return nodep;
}
+/* }}} */
/* {{{ proto somNode dom_import_simplexml(sxeobject node)
Get a simplexml_element object from dom to allow for processing */
@@ -476,7 +505,7 @@ PHP_FUNCTION(dom_import_simplexml)
}
/* }}} */
-zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC)
+zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC) /* {{{ */
{
zend_object_value retval;
void *new_object;
@@ -503,35 +532,30 @@ zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC)
return retval;
}
+/* }}} */
+/* {{{ arginfo */
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_import_simplexml, 0, 0, 1)
+ ZEND_ARG_INFO(0, node)
+ZEND_END_ARG_INFO()
+/* }}} */
-zend_object_value dom_objects_ze1_clone_obj(zval *zobject TSRMLS_DC)
-{
- php_error(E_ERROR, "Cannot clone object of class %s due to 'zend.ze1_compatibility_mode'", Z_OBJCE_P(zobject)->name);
- /* Return zobject->value.obj just to satisfy compiler */
- return zobject->value.obj;
-}
-
-static zend_function_entry dom_functions[] = {
- PHP_FE(dom_import_simplexml, NULL)
+static const zend_function_entry dom_functions[] = {
+ PHP_FE(dom_import_simplexml, arginfo_dom_import_simplexml)
{NULL, NULL, NULL}
};
static zend_object_handlers* dom_get_obj_handlers(TSRMLS_D) {
- if (EG(ze1_compatibility_mode)) {
- return &dom_ze1_object_handlers;
- } else {
- return &dom_object_handlers;
- }
+ return &dom_object_handlers;
}
-static zend_module_dep dom_deps[] = {
+static const zend_module_dep dom_deps[] = {
ZEND_MOD_REQUIRED("libxml")
ZEND_MOD_CONFLICTS("domxml")
{NULL, NULL, NULL}
};
-zend_module_entry dom_module_entry = {
+zend_module_entry dom_module_entry = { /* {{{ */
STANDARD_MODULE_HEADER_EX, NULL,
dom_deps,
"dom",
@@ -544,6 +568,7 @@ zend_module_entry dom_module_entry = {
DOM_API_VERSION, /* Extension versionnumber */
STANDARD_MODULE_PROPERTIES
};
+/* }}} */
#ifdef COMPILE_DL_DOM
ZEND_GET_MODULE(dom)
@@ -561,13 +586,6 @@ PHP_MINIT_FUNCTION(dom)
dom_object_handlers.clone_obj = dom_objects_store_clone_obj;
dom_object_handlers.has_property = dom_property_exists;
- memcpy(&dom_ze1_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- dom_ze1_object_handlers.read_property = dom_read_property;
- dom_ze1_object_handlers.write_property = dom_write_property;
- dom_ze1_object_handlers.get_property_ptr_ptr = dom_get_property_ptr_ptr;
- dom_ze1_object_handlers.clone_obj = dom_objects_ze1_clone_obj;
- dom_ze1_object_handlers.has_property = dom_property_exists;
-
zend_hash_init(&classes, 0, NULL, NULL, 1);
INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions);
@@ -887,7 +905,7 @@ PHP_MINFO_FUNCTION(dom)
}
/* }}} */
-PHP_MSHUTDOWN_FUNCTION(dom)
+PHP_MSHUTDOWN_FUNCTION(dom) /* {{{ */
{
zend_hash_destroy(&dom_domstringlist_prop_handlers);
zend_hash_destroy(&dom_namelist_prop_handlers);
@@ -920,6 +938,7 @@ PHP_MSHUTDOWN_FUNCTION(dom)
return SUCCESS;
}
+/* }}} */
/* {{{ node_list_unlink */
void node_list_unlink(xmlNodePtr node TSRMLS_DC)
@@ -960,7 +979,7 @@ void node_list_unlink(xmlNodePtr node TSRMLS_DC)
/* {{{ dom_xpath_objects_free_storage */
void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
{
- dom_object *intern = (dom_object *)object;
+ dom_xpath_object *intern = (dom_xpath_object *)object;
zend_object_std_dtor(&intern->std TSRMLS_CC);
@@ -970,6 +989,16 @@ void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
intern->ptr = NULL;
}
+ if (intern->registered_phpfunctions) {
+ zend_hash_destroy(intern->registered_phpfunctions);
+ FREE_HASHTABLE(intern->registered_phpfunctions);
+ }
+
+ if (intern->node_list) {
+ zend_hash_destroy(intern->node_list);
+ FREE_HASHTABLE(intern->node_list);
+ }
+
efree(object);
}
/* }}} */
@@ -997,7 +1026,7 @@ void dom_objects_free_storage(void *object TSRMLS_DC)
}
/* }}} */
-void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns TSRMLS_DC)
+void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns TSRMLS_DC) /* {{{ */
{
dom_nnodemap_object *mapptr;
zval *baseobj = NULL;
@@ -1006,7 +1035,7 @@ void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xml
if (basenode) {
MAKE_STD_ZVAL(baseobj);
baseobj->type = IS_OBJECT;
- baseobj->is_ref = 1;
+ Z_SET_ISREF_P(baseobj);
baseobj->value.obj.handle = basenode->handle;
baseobj->value.obj.handlers = dom_get_obj_handlers(TSRMLS_C);
zval_copy_ctor(baseobj);
@@ -1019,14 +1048,20 @@ void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xml
mapptr->ns = ns;
}
+/* }}} */
-static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool hash_copy TSRMLS_DC)
+static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool hash_copy TSRMLS_DC) /* {{{ */
{
zend_class_entry *base_class;
zval *tmp;
dom_object *intern;
- intern = emalloc(sizeof(dom_object));
+ if (instanceof_function(class_type, dom_xpath_class_entry TSRMLS_CC)) {
+ intern = emalloc(sizeof(dom_xpath_object));
+ memset(intern, 0, sizeof(dom_xpath_object));
+ } else {
+ intern = emalloc(sizeof(dom_object));
+ }
intern->ptr = NULL;
intern->prop_handler = NULL;
intern->document = NULL;
@@ -1045,6 +1080,7 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
return intern;
}
+/* }}} */
/* {{{ dom_objects_clone */
void dom_objects_clone(void *object, void **object_clone TSRMLS_DC)
@@ -1067,6 +1103,9 @@ void dom_objects_clone(void *object, void **object_clone TSRMLS_DC)
}
php_libxml_increment_doc_ref((php_libxml_node_object *)clone, cloned_node->doc TSRMLS_CC);
php_libxml_increment_node_ptr((php_libxml_node_object *)clone, cloned_node, (void *)clone TSRMLS_CC);
+ if (intern->document != clone->document) {
+ dom_copy_doc_props(intern->document, clone->document);
+ }
}
}
@@ -1097,9 +1136,15 @@ zend_object_value dom_objects_new(zend_class_entry *class_type TSRMLS_DC)
zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC)
{
zend_object_value retval;
- dom_object *intern;
-
- intern = dom_objects_set_class(class_type, 1 TSRMLS_CC);
+ dom_xpath_object *intern;
+
+ intern = (dom_xpath_object *)dom_objects_set_class(class_type, 1 TSRMLS_CC);
+ intern->registerPhpFunctions = 0;
+ intern->registered_phpfunctions = NULL;
+ intern->node_list = NULL;
+
+ ALLOC_HASHTABLE(intern->registered_phpfunctions);
+ zend_hash_init(intern->registered_phpfunctions, 0, NULL, ZVAL_PTR_DTOR, 0);
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t)dom_xpath_objects_free_storage, dom_objects_clone TSRMLS_CC);
intern->handle = retval.handle;
@@ -1110,7 +1155,7 @@ zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC)
/* }}} */
#endif
-static void dom_nnodemap_object_dtor(void *object, zend_object_handle handle TSRMLS_DC)
+static void dom_nnodemap_object_dtor(void *object, zend_object_handle handle TSRMLS_DC) /* {{{ */
{
zval *baseobj;
dom_object *intern;
@@ -1136,8 +1181,9 @@ static void dom_nnodemap_object_dtor(void *object, zend_object_handle handle TSR
}
+/* }}} */
-void dom_nnodemap_objects_free_storage(void *object TSRMLS_DC)
+void dom_nnodemap_objects_free_storage(void *object TSRMLS_DC) /* {{{ */
{
dom_object *intern = (dom_object *)object;
@@ -1147,8 +1193,9 @@ void dom_nnodemap_objects_free_storage(void *object TSRMLS_DC)
efree(object);
}
+/* }}} */
-zend_object_value dom_nnodemap_objects_new(zend_class_entry *class_type TSRMLS_DC)
+zend_object_value dom_nnodemap_objects_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
zend_object_value retval;
dom_object *intern;
@@ -1170,8 +1217,9 @@ zend_object_value dom_nnodemap_objects_new(zend_class_entry *class_type TSRMLS_D
return retval;
}
+/* }}} */
-void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC)
+void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce;
@@ -1183,6 +1231,7 @@ void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC)
object_init_ex(return_value, ce);
}
+/* }}} */
/* {{{ php_dom_create_object */
PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wrapper_in, zval *return_value, dom_object *domobj TSRMLS_DC)
@@ -1201,7 +1250,7 @@ PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wra
if ((intern = (dom_object *) php_dom_object_get_data((void *) obj))) {
return_value->type = IS_OBJECT;
- return_value->is_ref = 1;
+ Z_SET_ISREF_P(return_value);
return_value->value.obj.handle = intern->handle;
return_value->value.obj.handlers = dom_get_obj_handlers(TSRMLS_C);
zval_copy_ctor(return_value);
@@ -1304,7 +1353,6 @@ PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wra
}
/* }}} end php_domobject_new */
-
void php_dom_create_implementation(zval **retval TSRMLS_DC) {
object_init_ex(*retval, dom_domimplementation_class_entry);
}
@@ -1345,14 +1393,14 @@ int dom_has_feature(char *feature, char *version)
}
/* }}} end dom_has_feature */
-xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *local, int *cur, int index)
+xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *local, int *cur, int index) /* {{{ */
{
xmlNodePtr ret = NULL;
while (nodep != NULL && (*cur <= index || index == -1)) {
if (nodep->type == XML_ELEMENT_NODE) {
- if (xmlStrEqual(nodep->name, local) || xmlStrEqual("*", local)) {
- if (ns == NULL || (nodep->ns != NULL && (xmlStrEqual(nodep->ns->href, ns) || xmlStrEqual("*", ns)))) {
+ if (xmlStrEqual(nodep->name, (xmlChar *)local) || xmlStrEqual((xmlChar *)"*", (xmlChar *)local)) {
+ if (ns == NULL || (nodep->ns != NULL && (xmlStrEqual(nodep->ns->href, (xmlChar *)ns) || xmlStrEqual((xmlChar *)"*", (xmlChar *)ns)))) {
if (*cur == index) {
ret = nodep;
break;
@@ -1369,9 +1417,9 @@ xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *l
}
return ret;
}
+/* }}} */
/* }}} end dom_element_get_elements_by_tag_name_ns_raw */
-
/* {{{ void dom_normalize (xmlNodePtr nodep TSRMLS_DC) */
void dom_normalize (xmlNodePtr nodep TSRMLS_DC)
{
@@ -1459,9 +1507,9 @@ int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, i
return NAMESPACE_ERR;
}
- *localname = xmlSplitQName2(qname, (xmlChar **) prefix);
+ *localname = (char *)xmlSplitQName2((xmlChar *)qname, (xmlChar **) prefix);
if (*localname == NULL) {
- *localname = xmlStrdup(qname);
+ *localname = (char *)xmlStrdup((xmlChar *)qname);
if (*prefix == NULL && uri_len == 0) {
return 0;
}
@@ -1479,7 +1527,7 @@ int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, i
return 0;
}
-
+/* }}} */
/*
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-DocCrElNS
@@ -1497,10 +1545,10 @@ xmlNsPtr dom_get_ns(xmlNodePtr nodep, char *uri, int *errorcode, char *prefix) {
*errorcode = 0;
- if (! ((prefix && !strcmp (prefix, "xml" ) && strcmp(uri, XML_XML_NAMESPACE)) ||
- (prefix && !strcmp (prefix, "xmlns") && strcmp(uri, DOM_XMLNS_NAMESPACE)) ||
- (prefix && !strcmp(uri, DOM_XMLNS_NAMESPACE) && strcmp (prefix, "xmlns")))) {
- nsptr = xmlNewNs(nodep, uri, prefix);
+ if (! ((prefix && !strcmp (prefix, "xml") && strcmp(uri, (char *)XML_XML_NAMESPACE)) ||
+ (prefix && !strcmp (prefix, "xmlns") && strcmp(uri, (char *)DOM_XMLNS_NAMESPACE)) ||
+ (prefix && !strcmp(uri, (char *)DOM_XMLNS_NAMESPACE) && strcmp (prefix, "xmlns")))) {
+ nsptr = xmlNewNs(nodep, (xmlChar *)uri, (xmlChar *)prefix);
}
if (nsptr == NULL) {
@@ -1519,7 +1567,7 @@ xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) {
if (node == NULL)
return NULL;
- if (localName == NULL || xmlStrEqual(localName, "")) {
+ if (localName == NULL || xmlStrEqual(localName, (xmlChar *)"")) {
cur = node->nsDef;
while (cur != NULL) {
if (cur->prefix == NULL && cur->href != NULL) {
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index 61f11f3bb..4d2e4b6f1 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.h,v 1.28.2.1.2.6 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: php_dom.h,v 1.28.2.1.2.4.2.5 2008/12/31 11:15:36 sebastian Exp $ */
#ifndef PHP_DOM_H
#define PHP_DOM_H
@@ -67,6 +67,17 @@ extern zend_module_entry dom_module_entry;
/* Define a custom type for iterating using an unused nodetype */
#define DOM_NODESET XML_XINCLUDE_START
+typedef struct _dom_xpath_object {
+ zend_object std;
+ void *ptr;
+ php_libxml_ref_obj *document;
+ HashTable *prop_handler;
+ zend_object_handle handle;
+ int registerPhpFunctions;
+ HashTable *registered_phpfunctions;
+ HashTable *node_list;
+} dom_xpath_object;
+
typedef struct _dom_nnodemap_object {
dom_object *baseobj;
int nodetype;
@@ -127,8 +138,7 @@ entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
}
#define DOM_NO_ARGS() \
- if (ZEND_NUM_ARGS() != 0) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expects exactly 0 parameters, %d given", ZEND_NUM_ARGS()); \
+ if (zend_parse_parameters_none() == FAILURE) { \
return; \
}
@@ -144,3 +154,12 @@ PHP_MSHUTDOWN_FUNCTION(dom);
PHP_MINFO_FUNCTION(dom);
#endif /* PHP_DOM_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c
index 67354d829..850001485 100644
--- a/ext/dom/processinginstruction.c
+++ b/ext/dom/processinginstruction.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: processinginstruction.c,v 1.17.2.1.2.5 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: processinginstruction.c,v 1.17.2.1.2.1.2.12 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,7 +29,6 @@
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_processinginstruction_construct, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, value)
@@ -43,7 +42,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_processinginstruction_class_functions[] = {
+const zend_function_entry php_dom_processinginstruction_class_functions[] = {
PHP_ME(domprocessinginstruction, __construct, arginfo_dom_processinginstruction_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
@@ -57,14 +56,15 @@ PHP_METHOD(domprocessinginstruction, __construct)
dom_object *intern;
char *name, *value = NULL;
int name_len, value_len, name_valid;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_processinginstruction_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
name_valid = xmlValidateName((xmlChar *) name, 0);
if (name_valid != 0) {
@@ -114,8 +114,6 @@ int dom_processinginstruction_target_read(dom_object *obj, zval **retval TSRMLS_
/* }}} */
-
-
/* {{{ data string
readonly=no
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-837822393
@@ -159,7 +157,7 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval TSRMLS_DC
}
if (newval->type != IS_STRING) {
- if(newval->refcount > 1) {
+ if(Z_REFCOUNT_P(newval) > 1) {
value_copy = *newval;
zval_copy_ctor(&value_copy);
newval = &value_copy;
@@ -179,3 +177,12 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval TSRMLS_DC
/* }}} */
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/string_extend.c b/ext/dom/string_extend.c
index af0a1db27..cf7a48f7a 100644
--- a/ext/dom/string_extend.c
+++ b/ext/dom/string_extend.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string_extend.c,v 1.5.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: string_extend.c,v 1.5.2.1.2.1.2.8 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,14 +27,11 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_string_extend_find_offset16, 0, 0, 1)
ZEND_ARG_INFO(0, offset32)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_string_extend_find_offset32, 0, 0, 1)
ZEND_ARG_INFO(0, offset16)
ZEND_END_ARG_INFO();
@@ -47,7 +44,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_string_extend_class_functions[] = {
+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}
@@ -55,7 +52,6 @@ zend_function_entry php_dom_string_extend_class_functions[] = {
/* {{{ attribute protos, not implemented yet */
-
/* {{{ proto int dom_string_extend_find_offset16(int offset32);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset16
Since:
@@ -66,7 +62,6 @@ PHP_FUNCTION(dom_string_extend_find_offset16)
}
/* }}} end dom_string_extend_find_offset16 */
-
/* {{{ proto int dom_string_extend_find_offset32(int offset16);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset32
Since:
@@ -76,4 +71,16 @@ PHP_FUNCTION(dom_string_extend_find_offset32)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_string_extend_find_offset32 */
+
+/* }}} */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/tests/DOMCharacterData_appendData_basic.phpt b/ext/dom/tests/DOMCharacterData_appendData_basic.phpt
index ee590de80..e479c1e8b 100644
--- a/ext/dom/tests/DOMCharacterData_appendData_basic.phpt
+++ b/ext/dom/tests/DOMCharacterData_appendData_basic.phpt
@@ -3,6 +3,8 @@ DOMCharacterData::appendData basic functionality test
--CREDITS--
Mike Sullivan <mike@regexia.com>
#TestFest 2008 (London)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
diff --git a/ext/dom/tests/DOMDocument_savexml_basic.phpt b/ext/dom/tests/DOMDocument_savexml_basic.phpt
new file mode 100644
index 000000000..10f748cc4
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_savexml_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+DOM Document : save and saveXML
+--CREDITS--
+Sami Greenbury (sami@patabugen.co.uk)
+# TestFest 2008
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+$xml = <<< EOXML
+<?xml version="1.0" encoding="utf-8"?>
+<courses>
+ <!-- Hello World! -->
+ <aNode>
+ <childNode>
+ <childlessNode />
+ </childNode>
+ </aNode>
+</courses>
+EOXML;
+
+$dom = new DOMDocument();
+$dom->loadXML($xml);
+$root = $dom->documentElement;
+$directory = dirname(__FILE__);
+
+$filename = $directory."/tmp_dom_savexml".time();
+var_dump($dom->save($filename));
+$result = file_get_contents($filename);
+var_dump($result == $dom->saveXML());
+
+unlink($filename);
+
+--EXPECTF--
+int(151)
+bool(true) \ No newline at end of file
diff --git a/ext/dom/tests/DOMElement_hasAttributes_basic.phpt b/ext/dom/tests/DOMElement_hasAttributes_basic.phpt
index 36c4f5873..8e38d935e 100644
--- a/ext/dom/tests/DOMElement_hasAttributes_basic.phpt
+++ b/ext/dom/tests/DOMElement_hasAttributes_basic.phpt
@@ -1,10 +1,10 @@
--TEST--
DOMNode: hasAttributes()
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
--CREDITS--
James Lewis <james@s-1.com>
#TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once("dom_test.inc");
diff --git a/ext/dom/tests/DOMNode_hasChildNodes.phpt b/ext/dom/tests/DOMNode_hasChildNodes.phpt
new file mode 100644
index 000000000..5c1d714e1
--- /dev/null
+++ b/ext/dom/tests/DOMNode_hasChildNodes.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Tests DOMNode::hasChildNodes()
+--CREDITS--
+Michael Stillwell <mjs@beebo.org>
+# TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$dom = new DOMDocument();
+
+$dom->loadXML('<root/>');
+
+echo $dom->saveXML();
+
+echo "Document has child nodes\n";
+var_dump($dom->documentElement->hasChildNodes());
+
+echo "Document has child nodes\n";
+$dom->loadXML('<root><a/></root>');
+var_dump($dom->documentElement->hasChildNodes());
+
+echo "Remove node and save\n";
+$dom->documentElement->removeChild($dom->documentElement->firstChild);
+echo $dom->saveXML();
+
+echo "Document has child nodes\n";
+var_dump($dom->documentElement->hasChildNodes());
+
+echo "Document with 2 child nodes\n";
+$dom->loadXML('<root><a/><b/></root>');
+var_dump($dom->documentElement->hasChildNodes());
+
+?>
+--EXPECTF--
+<?xml version="1.0"?>
+<root/>
+Document has child nodes
+bool(false)
+Document has child nodes
+bool(true)
+Remove node and save
+<?xml version="1.0"?>
+<root/>
+Document has child nodes
+bool(false)
+Document with 2 child nodes
+bool(true)
diff --git a/ext/dom/tests/DOMNode_insertBefore.phpt b/ext/dom/tests/DOMNode_insertBefore.phpt
new file mode 100644
index 000000000..d371aaf04
--- /dev/null
+++ b/ext/dom/tests/DOMNode_insertBefore.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Tests DOMNode::insertBefore()
+--CREDITS--
+Michael Stillwell <mjs@beebo.org>
+# TestFest 2008
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$dom = new DOMDocument();
+$dom->loadXML('<root/>');
+echo $dom->saveXML();
+
+$e1 = $dom->createElement("A");
+$e2 = $dom->documentElement->appendChild($dom->createElement("B"));
+
+echo "Add new node B\n";
+echo $dom->saveXML();
+
+echo "Add new node A before B\n";
+$e2->parentNode->insertBefore($e1, $e2);
+echo $dom->saveXML();
+
+?>
+--EXPECTF--
+<?xml version="1.0"?>
+<root/>
+Add new node B
+<?xml version="1.0"?>
+<root><B/></root>
+Add new node A before B
+<?xml version="1.0"?>
+<root><A/><B/></root>
diff --git a/ext/dom/tests/bug38474.phpt b/ext/dom/tests/bug38474.phpt
index 5c1c1abd1..54226efe5 100644
--- a/ext/dom/tests/bug38474.phpt
+++ b/ext/dom/tests/bug38474.phpt
@@ -4,7 +4,7 @@ Bug #38474 (getAttribute select attribute by order, even when prefixed) (OK to f
<?php
require_once('skipif.inc');
if (version_compare(LIBXML_DOTTED_VERSION, "2.6.20", "<")) {
- print "skip libxml version " . LIBXML_DOTTED_VERSION;
+ print "skip libxml version " . LIBXML_DOTTED_VERSION;
}
?>
--FILE--
diff --git a/ext/dom/tests/bug43364.phpt b/ext/dom/tests/bug43364.phpt
index 0df581b7a..6e08ffc01 100644
--- a/ext/dom/tests/bug43364.phpt
+++ b/ext/dom/tests/bug43364.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #43364 (recursive xincludes don't remove internal xml nodes properly)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
function loopElements($nodes)
diff --git a/ext/dom/tests/bug44648.phpt b/ext/dom/tests/bug44648.phpt
new file mode 100644
index 000000000..d04f590ac
--- /dev/null
+++ b/ext/dom/tests/bug44648.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #44648 (Attribute names not checked for wellformedness)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$doc = new DOMDocument();
+$doc->loadXML('<root/>');
+
+$root = $doc->documentElement;
+
+try {
+ $attr = new DOMAttr('@acb', '123');
+ $root->setAttributeNode($attr);
+} catch (DOMException $e) {
+ echo $e->getMessage()."\n";
+}
+
+try {
+ $root->setAttribute('@def', '456');
+} catch (DOMException $e) {
+ echo $e->getMessage()."\n";
+}
+
+try {
+ $root->setAttributeNS(NULL, '@ghi', '789');
+} catch (DOMException $e) {
+ echo $e->getMessage()."\n";
+}
+
+try {
+ $root->setAttributeNS('urn::test', 'a:g@hi', '789');
+} catch (DOMException $e) {
+ echo $e->getMessage()."\n";
+}
+
+echo $doc->saveXML($root);
+?>
+--EXPECT--
+Invalid Character Error
+Invalid Character Error
+Invalid Character Error
+Namespace Error
+<root/> \ No newline at end of file
diff --git a/ext/dom/tests/bug46185.phpt b/ext/dom/tests/bug46185.phpt
new file mode 100644
index 000000000..02117cdd6
--- /dev/null
+++ b/ext/dom/tests/bug46185.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #46185 (importNode changes the namespace of an XML element).
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$aDOM = new DOMDocument();
+$aDOM->loadXML('<?xml version="1.0"?>
+<ns1:a xmlns:ns1="urn::ns"/>');
+$a= $aDOM->firstChild;
+
+$ok = new DOMDocument();
+$ok->loadXML('<?xml version="1.0"?>
+<ns1:ok xmlns:ns1="urn::ns" xmlns="urn::REAL"><watch-me xmlns:default="urn::BOGUS"/></ns1:ok>');
+
+$imported= $aDOM->importNode($ok->firstChild, true);
+$a->appendChild($imported);
+
+echo $aDOM->saveXML();
+?>
+--EXPECT--
+<?xml version="1.0"?>
+<ns1:a xmlns:ns1="urn::ns"><ns1:ok xmlns="urn::REAL"><watch-me xmlns:default="urn::BOGUS"/></ns1:ok></ns1:a> \ No newline at end of file
diff --git a/ext/dom/tests/bug46849.phpt b/ext/dom/tests/bug46849.phpt
new file mode 100644
index 000000000..c51c96e69
--- /dev/null
+++ b/ext/dom/tests/bug46849.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #46849 (Cloning DOMDocument doesn't clone the properties).
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$dom = new DOMDocument;
+$dom->formatOutput = 1;
+var_dump($dom->formatOutput);
+
+$dom2 = clone $dom;
+var_dump($dom2->formatOutput);
+?>
+--EXPECT--
+bool(true)
+bool(true)
diff --git a/ext/dom/tests/bug47430.phpt b/ext/dom/tests/bug47430.phpt
new file mode 100644
index 000000000..d3ca435e5
--- /dev/null
+++ b/ext/dom/tests/bug47430.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #47430 (Errors after writing to nodeValue parameter of an absent previousSibling).
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$xml = '<?xml
+version="1.0"?><html><p><i>Hello</i></p><p><i>World!</i></p></html>';
+$dom = new DOMDocument();
+$dom->loadXML($xml);
+
+$elements = $dom->getElementsByTagName('i');
+foreach ($elements as $i) {
+ $i->previousSibling->nodeValue = '';
+}
+
+$arr = array();
+$arr[0] = 'Value';
+
+print_r($arr);
+
+?>
+--EXPECTF--
+Strict Standards: Creating default object from empty value in %s on line %d
+
+Strict Standards: Creating default object from empty value in %s on line %d
+Array
+(
+ [0] => Value
+)
diff --git a/ext/dom/tests/dom003.phpt b/ext/dom/tests/dom003.phpt
index 1eb6d4a4f..1fae56908 100644
--- a/ext/dom/tests/dom003.phpt
+++ b/ext/dom/tests/dom003.phpt
@@ -21,16 +21,16 @@ $rootNode->appendChild($rootNode);
?>
--EXPECTF--
--- Catch exception with try/catch
-object(DOMException)#%d (6) {
- ["message:protected"]=>
+object(DOMException)#%d (%d) {
+ ["message":protected]=>
string(23) "Hierarchy Request Error"
- ["string:private"]=>
+ ["string":"Exception":private]=>
string(0) ""
- ["file:protected"]=>
+ ["file":protected]=>
string(%d) "%sdom003.php"
- ["line:protected"]=>
+ ["line":protected]=>
int(8)
- ["trace:private"]=>
+ ["trace":"Exception":private]=>
array(1) {
[0]=>
array(6) {
@@ -52,6 +52,8 @@ object(DOMException)#%d (6) {
}
}
}
+ ["previous":"Exception":private]=>
+ NULL
["code"]=>
int(3)
}
diff --git a/ext/dom/tests/dom_set_attr_node.phpt b/ext/dom/tests/dom_set_attr_node.phpt
index 7d783c562..05f8086e7 100644
--- a/ext/dom/tests/dom_set_attr_node.phpt
+++ b/ext/dom/tests/dom_set_attr_node.phpt
@@ -31,16 +31,16 @@ try {
?>
--EXPECTF--
-object(DOMException)#%d (6) {
- ["message:protected"]=>
+object(DOMException)#%d (7) {
+ ["message":protected]=>
string(20) "Wrong Document Error"
- ["string:private"]=>
+ ["string":"Exception":private]=>
string(0) ""
- ["file:protected"]=>
+ ["file":protected]=>
string(%d) "%sdom_set_attr_node.php"
- ["line:protected"]=>
+ ["line":protected]=>
int(%d)
- ["trace:private"]=>
+ ["trace":"Exception":private]=>
array(1) {
[0]=>
array(6) {
@@ -62,6 +62,8 @@ object(DOMException)#%d (6) {
}
}
}
+ ["previous":"Exception":private]=>
+ NULL
["code"]=>
int(4)
}
diff --git a/ext/dom/tests/dom_xinclude.phpt b/ext/dom/tests/dom_xinclude.phpt
index f9a3dd761..bf335d032 100644
--- a/ext/dom/tests/dom_xinclude.phpt
+++ b/ext/dom/tests/dom_xinclude.phpt
@@ -23,10 +23,10 @@ foreach ($dom->documentElement->childNodes as $node) {
--EXPECTF--
<?xml version="1.0"?>
<foo xmlns:xi="http://www.w3.org/2001/XInclude">
- <book xml:base="compress.zlib://%sext/dom/tests/book.xml">
+ <book xml:base="compress.zlib://%sbook.xml">
<title>The Grapes of Wrath</title>
<author>John Steinbeck</author>
- </book><book xml:base="compress.zlib://%sext/dom/tests/book.xml">
+ </book><book xml:base="compress.zlib://%sbook.xml">
<title>The Pearl</title>
<author>John Steinbeck</author>
</book>
diff --git a/ext/dom/tests/domxpath.phpt b/ext/dom/tests/domxpath.phpt
new file mode 100644
index 000000000..82396b521
--- /dev/null
+++ b/ext/dom/tests/domxpath.phpt
@@ -0,0 +1,58 @@
+--TEST--
+DOMXPath Tests
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+function MyAverage($nodelist) {
+ $count = 0;
+ $val = 0;
+ foreach ($nodelist AS $node) {
+ $count++;
+ $val += $node->textContent;
+ }
+ if ($val > 0) {
+ return $val/$count;
+ } else {
+ return 0;
+ }
+}
+
+$dom = new DOMDocument;
+$dom->loadXML(b'<root xmlns="urn::default"><child>myval</child></root>');
+
+$xpath = new DOMXPath($dom);
+
+$xpath->registerPHPFunctions('MyAverage');
+$xpath->registerNamespace("php", "http://php.net/xpath");
+
+$xpath->registerNamespace("def", "urn::default");
+$nodelist = $xpath->query("//def:child");
+if ($node = $nodelist->item(0)) {
+ print $node->textContent."\n";
+}
+
+$count = $xpath->evaluate("count(//def:child)");
+
+var_dump($count);
+
+$xpathdoc = $xpath->document;
+
+var_dump($xpathdoc instanceof DOMDocument);
+
+$root = $dom->documentElement;
+$root->appendChild($dom->createElementNS("urn::default", "testnode", 3));
+$root->appendChild($dom->createElementNS("urn::default", "testnode", 4));
+$root->appendChild($dom->createElementNS("urn::default", "testnode", 4));
+$root->appendChild($dom->createElementNS("urn::default", "testnode", 5));
+
+$avg = $xpath->evaluate('number(php:function("MyAverage", //def:testnode))');
+var_dump($avg);
+?>
+--EXPECT--
+myval
+float(1)
+bool(true)
+float(4) \ No newline at end of file
diff --git a/ext/dom/text.c b/ext/dom/text.c
index b0acfa014..c9073ea30 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: text.c,v 1.23.2.1.2.9 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: text.c,v 1.23.2.1.2.4.2.12 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -29,21 +29,17 @@
#include "dom_ce.h"
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_split_text, 0, 0, 1)
ZEND_ARG_INFO(0, offset)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_is_whitespace_in_element_content, 0, 0, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_replace_whole_text, 0, 0, 1)
ZEND_ARG_INFO(0, content)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_construct, 0, 0, 0)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
@@ -56,7 +52,7 @@ ZEND_END_ARG_INFO();
* Since:
*/
-zend_function_entry php_dom_text_class_functions[] = {
+const zend_function_entry php_dom_text_class_functions[] = {
PHP_FALIAS(splitText, dom_text_split_text, arginfo_dom_text_split_text)
PHP_FALIAS(isWhitespaceInElementContent, dom_text_is_whitespace_in_element_content, arginfo_dom_text_is_whitespace_in_element_content)
PHP_FALIAS(isElementContentWhitespace, dom_text_is_whitespace_in_element_content, arginfo_dom_text_is_whitespace_in_element_content)
@@ -74,14 +70,15 @@ PHP_METHOD(domtext, __construct)
dom_object *intern;
char *value = NULL;
int value_len;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, dom_text_class_entry, &value, &value_len) == FAILURE) {
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
nodep = xmlNewText((xmlChar *) value);
if (!nodep) {
@@ -141,7 +138,6 @@ int dom_text_whole_text_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
/* {{{ proto DOMText dom_text_split_text(int offset);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-38853C1D
Since:
@@ -204,7 +200,6 @@ PHP_FUNCTION(dom_text_split_text)
}
/* }}} end dom_text_split_text */
-
/* {{{ proto boolean dom_text_is_whitespace_in_element_content();
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-isWhitespaceInElementContent
Since: DOM Level 3
@@ -228,7 +223,6 @@ PHP_FUNCTION(dom_text_is_whitespace_in_element_content)
}
/* }}} end dom_text_is_whitespace_in_element_content */
-
/* {{{ proto DOMText dom_text_replace_whole_text(string content);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText
Since: DOM Level 3
@@ -238,4 +232,14 @@ PHP_FUNCTION(dom_text_replace_whole_text)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_text_replace_whole_text */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/typeinfo.c b/ext/dom/typeinfo.c
index 8753be925..f7e65a3eb 100644
--- a/ext/dom/typeinfo.c
+++ b/ext/dom/typeinfo.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: typeinfo.c,v 1.6.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: typeinfo.c,v 1.6.2.1.2.1.2.4 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -35,7 +35,7 @@
* Since: DOM Level 3
*/
-zend_function_entry php_dom_typeinfo_class_functions[] = {
+const zend_function_entry php_dom_typeinfo_class_functions[] = {
{NULL, NULL, NULL}
};
@@ -55,8 +55,6 @@ int dom_typeinfo_type_name_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
-
-
/* {{{ type_namespace string
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#TypeInfo-typeNamespace
@@ -71,4 +69,15 @@ int dom_typeinfo_type_namespace_read(dom_object *obj, zval **retval TSRMLS_DC)
/* }}} */
+/* }}} */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/userdatahandler.c b/ext/dom/userdatahandler.c
index a2655c743..06979edc9 100644
--- a/ext/dom/userdatahandler.c
+++ b/ext/dom/userdatahandler.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: userdatahandler.c,v 1.6.2.1.2.3 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: userdatahandler.c,v 1.6.2.1.2.1.2.4 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -35,14 +35,13 @@
* Since: DOM Level 3
*/
-zend_function_entry php_dom_userdatahandler_class_functions[] = {
+const zend_function_entry php_dom_userdatahandler_class_functions[] = {
PHP_FALIAS(handle, dom_userdatahandler_handle, NULL)
{NULL, NULL, NULL}
};
/* {{{ attribute protos, not implemented yet */
-
/* {{{ proto dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-handleUserDataEvent
Since:
@@ -52,4 +51,16 @@ PHP_FUNCTION(dom_userdatahandler_handle)
DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_userdatahandler_handle */
+
+/* }}} */
+
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h
index 3578763a8..b574fd492 100644
--- a/ext/dom/xml_common.h
+++ b/ext/dom/xml_common.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xml_common.h,v 1.23.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: xml_common.h,v 1.23.2.1.2.2.2.4 2008/12/31 11:15:36 sebastian Exp $ */
#ifndef PHP_XML_COMMON_H
#define PHP_XML_COMMON_H
@@ -35,14 +35,19 @@ typedef struct _dom_object {
} dom_object;
#ifdef PHP_WIN32
-#ifdef PHPAPI
-#undef PHPAPI
-#endif
-#ifdef DOM_EXPORTS
-#define PHPAPI __declspec(dllexport)
-#else
-#define PHPAPI __declspec(dllimport)
-#endif /* DOM_EXPORTS */
+# ifdef PHPAPI
+# undef PHPAPI
+# endif
+# ifdef DOM_EXPORTS
+# define PHPAPI __declspec(dllexport)
+# else
+# define PHPAPI __declspec(dllimport)
+# endif /* DOM_EXPORTS */
+#elif defined(__GNUC__) && __GNUC__ >= 4
+# ifdef PHPAPI
+# undef PHPAPI
+# endif
+# define PHPAPI __attribute__ ((visibility("default")))
#endif /* PHP_WIN32 */
#define PHP_DOM_EXPORT PHPAPI
@@ -90,3 +95,12 @@ PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj);
DOM_GET_OBJ(__ptr, __id, __prtype, __intern);
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index 76561fef6..8bc12fd45 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xpath.c,v 1.26.2.1.2.4 2008/12/31 11:17:37 sebastian Exp $ */
+/* $Id: xpath.c,v 1.26.2.1.2.1.2.12 2008/12/31 11:15:36 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -37,53 +37,251 @@
#if defined(LIBXML_XPATH_ENABLED)
/* {{{ arginfo */
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_construct, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, doc, DOMDocument, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_register_ns, 0, 0, 2)
ZEND_ARG_INFO(0, prefix)
ZEND_ARG_INFO(0, uri)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_query, 0, 0, 1)
ZEND_ARG_INFO(0, expr)
ZEND_ARG_OBJ_INFO(0, context, DOMNode, 0)
ZEND_END_ARG_INFO();
-static
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_evaluate, 0, 0, 1)
ZEND_ARG_INFO(0, expr)
ZEND_ARG_OBJ_INFO(0, context, DOMNode, 0)
ZEND_END_ARG_INFO();
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_register_php_functions, 0, 0, 0)
+ZEND_END_ARG_INFO();
/* }}} */
-zend_function_entry php_dom_xpath_class_functions[] = {
+const zend_function_entry php_dom_xpath_class_functions[] = {
PHP_ME(domxpath, __construct, arginfo_dom_xpath_construct, ZEND_ACC_PUBLIC)
PHP_FALIAS(registerNamespace, dom_xpath_register_ns, arginfo_dom_xpath_register_ns)
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}
};
-/* {{{ proto void DOMXPath::__construct(DOMDocument doc); */
+
+static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int type) /* {{{ */
+{
+ zval **args;
+ zval *retval;
+ int result, i, ret;
+ int error = 0;
+ zend_fcall_info fci;
+ zval handler;
+ xmlXPathObjectPtr obj;
+ char *str;
+ char *callable = NULL;
+ dom_xpath_object *intern;
+
+ TSRMLS_FETCH();
+
+ if (! zend_is_executing(TSRMLS_C)) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlExtFunctionTest: Function called from outside of PHP\n");
+ error = 1;
+ } else {
+ intern = (dom_xpath_object *) ctxt->context->userData;
+ if (intern == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlExtFunctionTest: failed to get the internal object\n");
+ error = 1;
+ }
+ else if (intern->registerPhpFunctions == 0) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlExtFunctionTest: PHP Object did not register PHP functions\n");
+ error = 1;
+ }
+ }
+
+ if (error == 1) {
+ for (i = nargs - 1; i >= 0; i--) {
+ obj = valuePop(ctxt);
+ xmlXPathFreeObject(obj);
+ }
+ return;
+ }
+
+ fci.param_count = nargs - 1;
+ if (fci.param_count > 0) {
+ fci.params = safe_emalloc(fci.param_count, sizeof(zval**), 0);
+ args = safe_emalloc(fci.param_count, sizeof(zval *), 0);
+ }
+ /* Reverse order to pop values off ctxt stack */
+ for (i = nargs - 2; i >= 0; i--) {
+ obj = valuePop(ctxt);
+ MAKE_STD_ZVAL(args[i]);
+ switch (obj->type) {
+ case XPATH_STRING:
+ ZVAL_STRING(args[i], (char *)obj->stringval, 1);
+ break;
+ case XPATH_BOOLEAN:
+ ZVAL_BOOL(args[i], obj->boolval);
+ break;
+ case XPATH_NUMBER:
+ ZVAL_DOUBLE(args[i], obj->floatval);
+ break;
+ case XPATH_NODESET:
+ if (type == 1) {
+ str = (char *)xmlXPathCastToString(obj);
+ ZVAL_STRING(args[i], str, 1);
+ xmlFree(str);
+ } else if (type == 2) {
+ int j;
+ array_init(args[i]);
+ if (obj->nodesetval && obj->nodesetval->nodeNr > 0) {
+ for (j = 0; j < obj->nodesetval->nodeNr; j++) {
+ xmlNodePtr node = obj->nodesetval->nodeTab[j];
+ zval *child;
+ MAKE_STD_ZVAL(child);
+ /* not sure, if we need this... it's copied from xpath.c */
+ if (node->type == XML_NAMESPACE_DECL) {
+ xmlNsPtr curns;
+ xmlNodePtr nsparent;
+
+ nsparent = node->_private;
+ curns = xmlNewNs(NULL, node->name, NULL);
+ if (node->children) {
+ curns->prefix = xmlStrdup((xmlChar *) node->children);
+ }
+ if (node->children) {
+ node = xmlNewDocNode(node->doc, NULL, (xmlChar *) node->children, node->name);
+ } else {
+ node = xmlNewDocNode(node->doc, NULL, (xmlChar *) "xmlns", node->name);
+ }
+ node->type = XML_NAMESPACE_DECL;
+ node->parent = nsparent;
+ node->ns = curns;
+ }
+ child = php_dom_create_object(node, &ret, NULL, child, (dom_object *)intern TSRMLS_CC);
+ add_next_index_zval(args[i], child);
+ }
+ }
+ }
+ break;
+ default:
+ ZVAL_STRING(args[i], (char *)xmlXPathCastToString(obj), 1);
+ }
+ xmlXPathFreeObject(obj);
+ fci.params[i] = &args[i];
+ }
+
+ fci.size = sizeof(fci);
+ fci.function_table = EG(function_table);
+
+ obj = valuePop(ctxt);
+ if (obj->stringval == NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Handler name must be a string");
+ xmlXPathFreeObject(obj);
+ if (fci.param_count > 0) {
+ for (i = 0; i < nargs - 1; i++) {
+ zval_ptr_dtor(&args[i]);
+ }
+ efree(args);
+ efree(fci.params);
+ }
+ return;
+ }
+ INIT_PZVAL(&handler);
+ ZVAL_STRING(&handler, obj->stringval, 1);
+ xmlXPathFreeObject(obj);
+
+ fci.function_name = &handler;
+ fci.symbol_table = NULL;
+ fci.object_ptr = NULL;
+ fci.retval_ptr_ptr = &retval;
+ fci.no_separation = 0;
+
+ if (!zend_make_callable(&handler, &callable TSRMLS_CC)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", callable);
+
+ } else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable, strlen(callable) + 1) == 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not allowed to call handler '%s()'.", callable);
+ /* Push an empty string, so that we at least have an xslt result... */
+ valuePush(ctxt, xmlXPathNewString((xmlChar *)""));
+ } else {
+ result = zend_call_function(&fci, NULL TSRMLS_CC);
+ if (result == FAILURE) {
+ if (Z_TYPE(handler) == IS_STRING) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(&handler));
+ }
+ /* retval is == NULL, when an exception occured, don't report anything, because PHP itself will handle that */
+ } else if (retval == NULL) {
+ } else {
+ if (retval->type == IS_OBJECT && instanceof_function( Z_OBJCE_P(retval), dom_node_class_entry TSRMLS_CC)) {
+ xmlNode *nodep;
+ dom_object *obj;
+ if (intern->node_list == NULL) {
+ ALLOC_HASHTABLE(intern->node_list);
+ zend_hash_init(intern->node_list, 0, NULL, ZVAL_PTR_DTOR, 0);
+ }
+ zval_add_ref(&retval);
+ zend_hash_next_index_insert(intern->node_list, &retval, sizeof(zval *), NULL);
+ obj = (dom_object *)zend_object_store_get_object(retval TSRMLS_CC);
+ nodep = dom_object_get_node(obj);
+ valuePush(ctxt, xmlXPathNewNodeSet(nodep));
+ } else if (retval->type == IS_BOOL) {
+ valuePush(ctxt, xmlXPathNewBoolean(retval->value.lval));
+ } else if (retval->type == IS_OBJECT) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "A PHP Object can not be converted to a XPath-string");
+ valuePush(ctxt, xmlXPathNewString((xmlChar *)""));
+ } else {
+ convert_to_string_ex(&retval);
+ valuePush(ctxt, xmlXPathNewString( Z_STRVAL_P(retval)));
+ }
+ zval_ptr_dtor(&retval);
+ }
+ }
+ efree(callable);
+ zval_dtor(&handler);
+ if (fci.param_count > 0) {
+ for (i = 0; i < nargs - 1; i++) {
+ zval_ptr_dtor(&args[i]);
+ }
+ efree(args);
+ efree(fci.params);
+ }
+}
+/* }}} */
+
+static void dom_xpath_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs) /* {{{ */
+{
+ dom_xpath_ext_function_php(ctxt, nargs, 1);
+}
+/* }}} */
+
+static void dom_xpath_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs) /* {{{ */
+{
+ dom_xpath_ext_function_php(ctxt, nargs, 2);
+}
+/* }}} */
+
+/* {{{ proto void DOMXPath::__construct(DOMDocument doc) U */
PHP_METHOD(domxpath, __construct)
{
zval *id, *doc;
xmlDocPtr docp = NULL;
- dom_object *docobj, *intern;
+ dom_object *docobj;
+ dom_xpath_object *intern;
xmlXPathContextPtr ctx, oldctx;
+ zend_error_handling error_handling;
- php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_xpath_class_entry, &doc, dom_document_class_entry) == FAILURE) {
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
- php_std_error_handling();
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
DOM_GET_OBJ(docp, doc, xmlDocPtr, docobj);
ctx = xmlXPathNewContext(docp);
@@ -92,14 +290,23 @@ PHP_METHOD(domxpath, __construct)
RETURN_FALSE;
}
- intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
+ intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC);
if (intern != NULL) {
oldctx = (xmlXPathContextPtr)intern->ptr;
if (oldctx != NULL) {
php_libxml_decrement_doc_ref((php_libxml_node_object *)intern TSRMLS_CC);
xmlXPathFreeContext(oldctx);
}
+
+ xmlXPathRegisterFuncNS (ctx, (const xmlChar *) "functionString",
+ (const xmlChar *) "http://php.net/xpath",
+ dom_xpath_ext_function_string_php);
+ xmlXPathRegisterFuncNS (ctx, (const xmlChar *) "function",
+ (const xmlChar *) "http://php.net/xpath",
+ dom_xpath_ext_function_object_php);
+
intern->ptr = ctx;
+ ctx->userData = (void *)intern;
intern->document = docobj->document;
php_libxml_increment_doc_ref((php_libxml_node_object *)intern, docp TSRMLS_CC);
}
@@ -126,6 +333,7 @@ int dom_xpath_document_read(dom_object *obj, zval **retval TSRMLS_DC)
}
return SUCCESS;
}
+/* }}} */
/* {{{ proto boolean dom_xpath_register_ns(string prefix, string uri); */
PHP_FUNCTION(dom_xpath_register_ns)
@@ -133,14 +341,14 @@ PHP_FUNCTION(dom_xpath_register_ns)
zval *id;
xmlXPathContextPtr ctxp;
int prefix_len, ns_uri_len;
- dom_object *intern;
+ dom_xpath_object *intern;
unsigned char *prefix, *ns_uri;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) {
return;
}
- intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
+ intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC);
ctxp = (xmlXPathContextPtr) intern->ptr;
if (ctxp == NULL) {
@@ -153,8 +361,9 @@ PHP_FUNCTION(dom_xpath_register_ns)
}
RETURN_TRUE;
}
+/* }}} */
-static void dom_xpath_iter(zval *baseobj, dom_object *intern)
+static void dom_xpath_iter(zval *baseobj, dom_object *intern) /* {{{ */
{
dom_nnodemap_object *mapptr;
@@ -163,24 +372,26 @@ static void dom_xpath_iter(zval *baseobj, dom_object *intern)
mapptr->nodetype = DOM_NODESET;
}
+/* }}} */
-static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) {
+static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
+{
zval *id, *retval, *context = NULL;
xmlXPathContextPtr ctxp;
xmlNodePtr nodep = NULL;
xmlXPathObjectPtr xpathobjp;
int expr_len, ret, nsnbr = 0, xpath_type;
- dom_object *intern, *nodeobj;
+ dom_xpath_object *intern;
+ dom_object *nodeobj;
char *expr;
xmlDoc *docp = NULL;
xmlNsPtr *ns;
-
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|O", &id, dom_xpath_class_entry, &expr, &expr_len, &context, dom_node_class_entry) == FAILURE) {
return;
}
- intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
+ intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC);
ctxp = (xmlXPathContextPtr) intern->ptr;
if (ctxp == NULL) {
@@ -276,13 +487,13 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) {
node->parent = nsparent;
node->ns = curns;
}
- child = php_dom_create_object(node, &ret, NULL, child, intern TSRMLS_CC);
+ child = php_dom_create_object(node, &ret, NULL, child, (dom_object *)intern TSRMLS_CC);
add_next_index_zval(retval, child);
}
}
php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
- intern = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
- dom_xpath_iter(retval, intern);
+ nodeobj = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
+ dom_xpath_iter(retval, nodeobj);
break;
}
@@ -305,6 +516,7 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) {
xmlXPathFreeObject(xpathobjp);
}
+/* }}} */
/* {{{ proto DOMNodeList dom_xpath_query(string expr [,DOMNode context]); */
PHP_FUNCTION(dom_xpath_query)
@@ -320,7 +532,59 @@ PHP_FUNCTION(dom_xpath_evaluate)
}
/* }}} end dom_xpath_evaluate */
+/* {{{ proto void dom_xpath_register_php_functions() */
+PHP_FUNCTION(dom_xpath_register_php_functions)
+{
+ zval *id;
+ dom_xpath_object *intern;
+ zval *array_value, **entry, *new_string;
+ int name_len = 0;
+ char *name;
+
+ DOM_GET_THIS(id);
+
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "a", &array_value) == SUCCESS) {
+ intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC);
+ zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value));
+
+ while (zend_hash_get_current_data(Z_ARRVAL_P(array_value), (void **)&entry) == SUCCESS) {
+ SEPARATE_ZVAL(entry);
+ convert_to_string_ex(entry);
+
+ MAKE_STD_ZVAL(new_string);
+ ZVAL_LONG(new_string,1);
+
+ zend_hash_update(intern->registered_phpfunctions, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &new_string, sizeof(zval*), NULL);
+ zend_hash_move_forward(Z_ARRVAL_P(array_value));
+ }
+ intern->registerPhpFunctions = 2;
+ RETURN_TRUE;
+
+ } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == SUCCESS) {
+ intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC);
+
+ MAKE_STD_ZVAL(new_string);
+ ZVAL_LONG(new_string,1);
+ zend_hash_update(intern->registered_phpfunctions, name, name_len + 1, &new_string, sizeof(zval*), NULL);
+ intern->registerPhpFunctions = 2;
+
+ } else {
+ intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC);
+ intern->registerPhpFunctions = 1;
+ }
+
+}
+/* }}} end dom_xpath_register_php_functions */
+
#endif /* LIBXML_XPATH_ENABLED */
-/* }}} */
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */