summaryrefslogtreecommitdiff
path: root/ext/dom
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom')
-rw-r--r--ext/dom/attr.c24
-rw-r--r--ext/dom/cdatasection.c15
-rw-r--r--ext/dom/characterdata.c43
-rw-r--r--ext/dom/comment.c15
-rw-r--r--ext/dom/config.m418
-rw-r--r--ext/dom/document.c114
-rw-r--r--ext/dom/documentfragment.c18
-rw-r--r--ext/dom/documenttype.c11
-rw-r--r--ext/dom/dom_ce.h11
-rw-r--r--ext/dom/dom_fe.h11
-rw-r--r--ext/dom/dom_iterators.c14
-rw-r--r--ext/dom/dom_properties.h11
-rw-r--r--ext/dom/domconfiguration.c11
-rw-r--r--ext/dom/domerror.c11
-rw-r--r--ext/dom/domerrorhandler.c11
-rw-r--r--ext/dom/domexception.c11
-rw-r--r--ext/dom/domimplementation.c11
-rw-r--r--ext/dom/domimplementationlist.c11
-rw-r--r--ext/dom/domimplementationsource.c11
-rw-r--r--ext/dom/domlocator.c11
-rw-r--r--ext/dom/domstringlist.c11
-rw-r--r--ext/dom/element.c69
-rw-r--r--ext/dom/entity.c11
-rw-r--r--ext/dom/entityreference.c14
-rw-r--r--ext/dom/namednodemap.c23
-rw-r--r--ext/dom/namelist.c11
-rw-r--r--ext/dom/node.c90
-rw-r--r--ext/dom/nodelist.c17
-rw-r--r--ext/dom/notation.c11
-rw-r--r--ext/dom/php_dom.c17
-rw-r--r--ext/dom/php_dom.h11
-rw-r--r--ext/dom/processinginstruction.c19
-rw-r--r--ext/dom/string_extend.c11
-rw-r--r--ext/dom/tests/DOMAttr_value_basic_001.phpt1
-rw-r--r--ext/dom/tests/DOMCharacterData_appendData_error_001.phpt19
-rw-r--r--ext/dom/tests/DOMCharacterData_deleteData_error_001.phpt19
-rw-r--r--ext/dom/tests/DOMCharacterData_insertData_error_001.phpt19
-rw-r--r--ext/dom/tests/DOMCharacterData_length_error_001.phpt1
-rw-r--r--ext/dom/tests/DOMCharacterData_replaceData_error_001.phpt19
-rw-r--r--ext/dom/tests/DOMDocumentFragment_appendXML_error_001.phpt14
-rw-r--r--ext/dom/tests/DOMDocument_createEntityReference_basic.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_implementationRead_basic.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadHTML_error1.phpt15
-rw-r--r--ext/dom/tests/DOMDocument_loadHTMLfile.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadXML_basic.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadXML_error1.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadXML_error2.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadXML_error3.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadXML_error4.phpt3
-rw-r--r--ext/dom/tests/DOMDocument_loadXML_error5.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadXML_variation1.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadXML_variation2.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadXML_variation3.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_loadXML_variation4.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_load_basic.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_load_error1.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_load_error2.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_load_error3.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_load_error4.phpt3
-rw-r--r--ext/dom/tests/DOMDocument_load_error5.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_load_variation1.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_load_variation2.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_load_variation3.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_load_variation4.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_preserveWhiteSpace_basic.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_preserveWhiteSpace_variations.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_saveHTMLFile_basic.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_saveHTMLFile_error1.phpt24
-rw-r--r--ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_saveHTMLFile_formatOutput.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_saveHTML_basic.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_saveHTML_error2.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_saveHTML_variant1.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_saveHTML_variant2.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_save_basic.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_savexml_basic.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidateSource_basic.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidateSource_error1.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidateSource_error2.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt21
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidate_basic.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidate_error1.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidate_error2.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidate_error3.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidate_error4.phpt21
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidate_error5.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_strictErrorChecking_basic.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_validate_basic.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_validate_error1.phpt16
-rw-r--r--ext/dom/tests/DOMDocument_validate_error2.phpt2
-rw-r--r--ext/dom/tests/DOMDocument_validate_external_dtd.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt2
-rw-r--r--ext/dom/tests/DOMNode_C14NFile_basic.phpt4
-rw-r--r--ext/dom/tests/DOMNode_getLineNo_basic.phpt2
-rw-r--r--ext/dom/tests/DOMNode_getNodePath_basic.phpt2
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error2.phpt2
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error3.phpt2
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error4.phpt2
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error5.phpt2
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error6.phpt2
-rw-r--r--[-rwxr-xr-x]ext/dom/tests/book-non-conforming-schema.xsd0
-rw-r--r--[-rwxr-xr-x]ext/dom/tests/book-not-a-schema.xsd0
-rw-r--r--[-rwxr-xr-x]ext/dom/tests/book.xsd0
-rw-r--r--ext/dom/tests/bug37456.phpt2
-rw-r--r--ext/dom/tests/bug38949.phpt2
-rw-r--r--ext/dom/tests/bug41257.phpt2
-rw-r--r--ext/dom/tests/bug42082.phpt1
-rw-r--r--ext/dom/tests/bug67081.phpt8
-rw-r--r--ext/dom/tests/bug76285.phpt3
-rw-r--r--ext/dom/tests/dom003.phpt2
-rw-r--r--ext/dom/tests/dom004.phpt2
-rw-r--r--ext/dom/tests/dom005.phpt2
-rw-r--r--ext/dom/tests/dom006.phpt2
-rw-r--r--ext/dom/tests/dom_import_simplexml.phpt2
-rw-r--r--ext/dom/tests/dom_xinclude.phpt4
-rw-r--r--ext/dom/tests/domdocument_createcomment_error_001.phpt16
-rw-r--r--ext/dom/tests/domdocument_createentityreference_002.phpt17
-rw-r--r--ext/dom/tests/domdocumentload_test_method.inc (renamed from ext/dom/tests/domdocumentload_test_method.php)2
-rw-r--r--ext/dom/tests/domdocumentload_test_method_savexml.inc (renamed from ext/dom/tests/domdocumentload_test_method_savexml.php)2
-rw-r--r--ext/dom/tests/domdocumentload_utilities.inc (renamed from ext/dom/tests/domdocumentload_utilities.php)0
-rw-r--r--ext/dom/tests/domdocumentloadxml_test_method.inc (renamed from ext/dom/tests/domdocumentloadxml_test_method.php)2
-rw-r--r--ext/dom/tests/domdocumentloadxml_test_method_savexml.inc (renamed from ext/dom/tests/domdocumentloadxml_test_method_savexml.php)2
-rw-r--r--ext/dom/tests/toString_exceptions.phpt58
-rw-r--r--ext/dom/text.c21
-rw-r--r--ext/dom/typeinfo.c11
-rw-r--r--ext/dom/userdatahandler.c11
-rw-r--r--ext/dom/xml_common.h16
-rw-r--r--ext/dom/xpath.c21
144 files changed, 430 insertions, 866 deletions
diff --git a/ext/dom/attr.c b/ext/dom/attr.c
index dfe9218b4f..9326e145bf 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -53,7 +53,6 @@ const zend_function_entry php_dom_attr_class_functions[] = {
/* {{{ proto DOMAttr::__construct(string name, [string value]) */
PHP_METHOD(domattr, __construct)
{
- zval *id = getThis();
xmlAttrPtr nodep = NULL;
xmlNodePtr oldnode = NULL;
dom_object *intern;
@@ -64,7 +63,7 @@ PHP_METHOD(domattr, __construct)
return;
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_DOMOBJ_P(ZEND_THIS);
name_valid = xmlValidateName((xmlChar *) name, 0);
if (name_valid != 0) {
@@ -161,12 +160,15 @@ int dom_attr_value_write(dom_object *obj, zval *newval)
return FAILURE;
}
+ str = zval_try_get_string(newval);
+ if (UNEXPECTED(!str)) {
+ return FAILURE;
+ }
+
if (attrp->children) {
node_list_unlink(attrp->children);
}
- str = zval_get_string(newval);
-
xmlNodeSetContentLen((xmlNodePtr) attrp, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1);
zend_string_release_ex(str, 0);
@@ -228,7 +230,8 @@ PHP_FUNCTION(dom_attr_is_id)
dom_object *intern;
xmlAttrPtr attrp;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_attr_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -243,12 +246,3 @@ 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 9e7c6c6ee1..4d34e58a61 100644
--- a/ext/dom/cdatasection.c
+++ b/ext/dom/cdatasection.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -47,8 +47,6 @@ const zend_function_entry php_dom_cdatasection_class_functions[] = {
/* {{{ proto DOMCdataSection::__construct(string value); */
PHP_METHOD(domcdatasection, __construct)
{
-
- zval *id = getThis();
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
char *value = NULL;
@@ -65,7 +63,7 @@ PHP_METHOD(domcdatasection, __construct)
RETURN_FALSE;
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_DOMOBJ_P(ZEND_THIS);
oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode );
@@ -75,12 +73,3 @@ 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 8965202c15..b0ac50f44e 100644
--- a/ext/dom/characterdata.c
+++ b/ext/dom/characterdata.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -104,7 +104,10 @@ int dom_characterdata_data_write(dom_object *obj, zval *newval)
return FAILURE;
}
- str = zval_get_string(newval);
+ str = zval_try_get_string(newval);
+ if (UNEXPECTED(!str)) {
+ return FAILURE;
+ }
xmlNodeSetContentLen(nodep, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1);
@@ -158,7 +161,8 @@ PHP_FUNCTION(dom_characterdata_substring_data)
int length;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &offset, &count) == FAILURE) {
return;
}
@@ -205,24 +209,13 @@ PHP_FUNCTION(dom_characterdata_append_data)
char *arg;
size_t arg_len;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_characterdata_class_entry, &arg, &arg_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) {
return;
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
-#if LIBXML_VERSION < 20627
-/* Implement logic from libxml xmlTextConcat to add support for comments and PI */
- if ((nodep->content == (xmlChar *) &(nodep->properties)) ||
- ((nodep->doc != NULL) && (nodep->doc->dict != NULL) &&
- xmlDictOwns(nodep->doc->dict, nodep->content))) {
- nodep->content = xmlStrncatNew(nodep->content, arg, arg_len);
- } else {
- nodep->content = xmlStrncat(nodep->content, arg, arg_len);
- }
- nodep->properties = NULL;
-#else
xmlTextConcat(nodep, (xmlChar *) arg, arg_len);
-#endif
RETURN_TRUE;
}
/* }}} end dom_characterdata_append_data */
@@ -242,7 +235,8 @@ PHP_FUNCTION(dom_characterdata_insert_data)
size_t arg_len;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ols", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &offset, &arg, &arg_len) == FAILURE) {
return;
}
@@ -289,7 +283,8 @@ PHP_FUNCTION(dom_characterdata_delete_data)
int length;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &offset, &count) == FAILURE) {
return;
}
@@ -346,7 +341,8 @@ PHP_FUNCTION(dom_characterdata_replace_data)
size_t arg_len;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Olls", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lls", &offset, &count, &arg, &arg_len) == FAILURE) {
return;
}
@@ -395,12 +391,3 @@ PHP_FUNCTION(dom_characterdata_replace_data)
/* }}} 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 924d713b97..9cbec9f173 100644
--- a/ext/dom/comment.c
+++ b/ext/dom/comment.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -47,8 +47,6 @@ const zend_function_entry php_dom_comment_class_functions[] = {
/* {{{ proto DOMComment::__construct([string value]); */
PHP_METHOD(domcomment, __construct)
{
-
- zval *id = getThis();
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
char *value = NULL;
@@ -65,7 +63,7 @@ PHP_METHOD(domcomment, __construct)
RETURN_FALSE;
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_DOMOBJ_P(ZEND_THIS);
if (intern != NULL) {
oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
@@ -77,12 +75,3 @@ 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.m4 b/ext/dom/config.m4
index 5d96e7bc0f..1a7f81ef8d 100644
--- a/ext/dom/config.m4
+++ b/ext/dom/config.m4
@@ -1,17 +1,13 @@
-dnl config.m4 for extension dom
-
-PHP_ARG_ENABLE(dom, whether to enable DOM support,
-[ --disable-dom Disable DOM support], yes)
-
-if test -z "$PHP_LIBXML_DIR"; then
- PHP_ARG_WITH(libxml-dir, libxml2 install dir,
- [ --with-libxml-dir[=DIR] DOM: libxml2 install prefix], no, no)
-fi
+PHP_ARG_ENABLE([dom],
+ [whether to enable DOM support],
+ [AS_HELP_STRING([--disable-dom],
+ [Disable DOM support])],
+ [yes])
if test "$PHP_DOM" != "no"; then
if test "$PHP_LIBXML" = "no"; then
- AC_MSG_ERROR([DOM extension requires LIBXML extension, add --enable-libxml])
+ AC_MSG_ERROR([DOM extension requires LIBXML extension, add --with-libxml])
fi
PHP_SETUP_LIBXML(DOM_SHARED_LIBADD, [
@@ -30,7 +26,5 @@ if test "$PHP_DOM" != "no"; then
PHP_SUBST(DOM_SHARED_LIBADD)
PHP_INSTALL_HEADERS([ext/dom/xml_common.h])
PHP_ADD_EXTENSION_DEP(dom, libxml)
- ], [
- AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
])
fi
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 9f9ce5e2f8..672fd624b3 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -337,7 +337,10 @@ int dom_document_encoding_write(dom_object *obj, zval *newval)
return FAILURE;
}
- str = zval_get_string(newval);
+ str = zval_try_get_string(newval);
+ if (UNEXPECTED(!str)) {
+ return FAILURE;
+ }
handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
@@ -431,12 +434,15 @@ int dom_document_version_write(dom_object *obj, zval *newval)
return FAILURE;
}
+ str = zval_try_get_string(newval);
+ if (UNEXPECTED(!str)) {
+ return FAILURE;
+ }
+
if (docp->version != NULL) {
xmlFree((xmlChar *) docp->version );
}
- str = zval_get_string(newval);
-
docp->version = xmlStrdup((const xmlChar *) ZSTR_VAL(str));
zend_string_release_ex(str, 0);
@@ -659,12 +665,15 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval)
return FAILURE;
}
+ str = zval_try_get_string(newval);
+ if (UNEXPECTED(!str)) {
+ return FAILURE;
+ }
+
if (docp->URL != NULL) {
xmlFree((xmlChar *) docp->URL);
}
- str = zval_get_string(newval);
-
docp->URL = xmlStrdup((const xmlChar *) ZSTR_VAL(str));
zend_string_release_ex(str, 0);
@@ -700,7 +709,8 @@ PHP_FUNCTION(dom_document_create_element)
size_t name_len, value_len;
char *name, *value = NULL;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &value, &value_len) == FAILURE) {
return;
}
@@ -732,7 +742,8 @@ PHP_FUNCTION(dom_document_create_document_fragment)
dom_object *intern;
int ret;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_document_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -761,7 +772,8 @@ PHP_FUNCTION(dom_document_create_text_node)
dom_object *intern;
char *value;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
return;
}
@@ -790,7 +802,8 @@ PHP_FUNCTION(dom_document_create_comment)
dom_object *intern;
char *value;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
return;
}
@@ -819,7 +832,8 @@ PHP_FUNCTION(dom_document_create_cdatasection)
dom_object *intern;
char *value;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
return;
}
@@ -848,7 +862,8 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
dom_object *intern;
char *name, *value = NULL;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &value, &value_len) == FAILURE) {
return;
}
@@ -884,7 +899,8 @@ PHP_FUNCTION(dom_document_create_attribute)
dom_object *intern;
char *name;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
@@ -919,7 +935,8 @@ PHP_FUNCTION(dom_document_create_entity_reference)
size_t name_len;
char *name;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
@@ -952,7 +969,8 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name)
char *name;
xmlChar *local;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
@@ -978,7 +996,8 @@ PHP_FUNCTION(dom_document_import_node)
int ret;
zend_bool recursive = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO|b", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|b", &node, dom_node_class_entry, &recursive) == FAILURE) {
return;
}
@@ -1037,7 +1056,8 @@ PHP_FUNCTION(dom_document_create_element_ns)
int errorcode;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!s|s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s|s", &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
return;
}
@@ -1101,7 +1121,8 @@ PHP_FUNCTION(dom_document_create_attribute_ns)
dom_object *intern;
int errorcode;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
return;
}
@@ -1163,7 +1184,8 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns)
char *uri, *name;
xmlChar *local, *nsuri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &uri, &uri_len, &name, &name_len) == FAILURE) {
return;
}
@@ -1191,7 +1213,8 @@ PHP_FUNCTION(dom_document_get_element_by_id)
dom_object *intern;
char *idname;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_document_class_entry, &idname, &idname_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &idname, &idname_len) == FAILURE) {
return;
}
@@ -1228,7 +1251,8 @@ PHP_FUNCTION(dom_document_normalize_document)
xmlDocPtr docp;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_document_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -1251,8 +1275,6 @@ PHP_FUNCTION(dom_document_rename_node)
/* {{{ proto DOMDocument::__construct([string version], [string encoding]); */
PHP_METHOD(domdocument, __construct)
{
-
- zval *id = getThis();
xmlDoc *docp = NULL, *olddoc;
dom_object *intern;
char *encoding, *version = NULL;
@@ -1274,7 +1296,7 @@ PHP_METHOD(domdocument, __construct)
docp->encoding = (const xmlChar *) xmlStrdup((xmlChar *) encoding);
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_DOMOBJ_P(ZEND_THIS);
if (intern != NULL) {
olddoc = (xmlDocPtr) dom_object_get_node(intern);
if (olddoc != NULL) {
@@ -1569,7 +1591,8 @@ PHP_FUNCTION(dom_document_save)
char *file;
zend_long options = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Op|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", &file, &file_len, &options) == FAILURE) {
return;
}
@@ -1615,7 +1638,8 @@ PHP_FUNCTION(dom_document_savexml)
int size, format, saveempty = 0;
zend_long options = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|O!l", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|O!l", &nodep, dom_node_class_entry, &options) == FAILURE) {
return;
}
@@ -1722,7 +1746,8 @@ PHP_FUNCTION(dom_document_xinclude)
int err;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|l", &id, dom_document_class_entry, &flags) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags) == FAILURE) {
return;
}
@@ -1766,7 +1791,8 @@ PHP_FUNCTION(dom_document_validate)
dom_object *intern;
xmlValidCtxt *cvp;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_document_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -1805,7 +1831,8 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
int is_valid;
char resolved_path[MAXPATHLEN + 1];
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &source, &source_len, &flags) == FAILURE) {
return;
}
@@ -1858,11 +1885,9 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
RETURN_FALSE;
}
-#if LIBXML_VERSION >= 20614
if (flags & XML_SCHEMA_VAL_VC_I_CREATE) {
valid_opts |= XML_SCHEMA_VAL_VC_I_CREATE;
}
-#endif
xmlSchemaSetValidOptions(vptr, valid_opts);
xmlSchemaSetValidErrors(vptr, php_libxml_error_handler, php_libxml_error_handler, vptr);
@@ -1905,7 +1930,8 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
int is_valid;
char resolved_path[MAXPATHLEN + 1];
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &source, &source_len) == FAILURE) {
return;
}
@@ -2115,7 +2141,8 @@ PHP_FUNCTION(dom_document_save_html_file)
char *file;
const char *encoding;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Op", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &file, &file_len) == FAILURE) {
return;
}
@@ -2155,8 +2182,9 @@ PHP_FUNCTION(dom_document_save_html)
int format;
dom_doc_propsptr doc_props;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
- "O|O!", &id, dom_document_class_entry, &nodep, dom_node_class_entry)
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(),
+ "|O!", &nodep, dom_node_class_entry)
== FAILURE) {
return;
}
@@ -2213,11 +2241,7 @@ PHP_FUNCTION(dom_document_save_html)
xmlBufferFree(buf);
} else {
int size = 0;
-#if LIBXML_VERSION >= 20623
htmlDocDumpMemoryFormat(docp, &mem, &size, format);
-#else
- htmlDocDumpMemory(docp, &mem, &size);
-#endif
if (!size || !mem) {
RETVAL_FALSE;
} else {
@@ -2241,7 +2265,8 @@ PHP_METHOD(domdocument, registerNodeClass)
zend_class_entry *basece = dom_node_class_entry, *ce = NULL;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OCC!", &id, dom_document_class_entry, &basece, &ce) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "CC!", &basece, &ce) == FAILURE) {
return;
}
@@ -2257,12 +2282,3 @@ 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 0c289565a2..9b222586ac 100644
--- a/ext/dom/documentfragment.c
+++ b/ext/dom/documentfragment.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -50,8 +50,6 @@ const zend_function_entry php_dom_documentfragment_class_functions[] = {
/* {{{ proto DOMDocumentFragment::__construct() */
PHP_METHOD(domdocumentfragment, __construct)
{
-
- zval *id = getThis();
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
@@ -66,7 +64,7 @@ PHP_METHOD(domdocumentfragment, __construct)
RETURN_FALSE;
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_DOMOBJ_P(ZEND_THIS);
oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode );
@@ -120,7 +118,8 @@ PHP_METHOD(domdocumentfragment, appendXML) {
int err;
xmlNodePtr lst;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_documentfragment_class_entry, &data, &data_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) == FAILURE) {
return;
}
@@ -149,12 +148,3 @@ PHP_METHOD(domdocumentfragment, appendXML) {
/* }}} */
#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 c45af17b01..dd8a647167 100644
--- a/ext/dom/documenttype.c
+++ b/ext/dom/documenttype.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -216,12 +216,3 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval *retval)
/* }}} */
#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 282b4e5ae7..a8b9c9227c 100644
--- a/ext/dom/dom_ce.h
+++ b/ext/dom/dom_ce.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -55,12 +55,3 @@ extern PHP_DOM_EXPORT zend_class_entry *dom_xpath_class_entry;
extern PHP_DOM_EXPORT 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 63e7994a4d..b8c1ff2266 100644
--- a/ext/dom/dom_fe.h
+++ b/ext/dom/dom_fe.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -270,12 +270,3 @@ 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 d1488ded6b..7483235c0f 100644
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -272,7 +272,8 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
iterator = emalloc(sizeof(php_dom_iterator));
zend_iterator_init(&iterator->intern);
- ZVAL_COPY(&iterator->intern.data, object);
+ Z_ADDREF_P(object);
+ ZVAL_OBJ(&iterator->intern.data, Z_OBJ_P(object));
iterator->intern.funcs = &php_dom_iterator_funcs;
ZVAL_UNDEF(&iterator->curobj);
@@ -327,12 +328,3 @@ err:
/* }}} */
#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 caf52f80e8..73d404429e 100644
--- a/ext/dom/dom_properties.h
+++ b/ext/dom/dom_properties.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -161,12 +161,3 @@ int dom_xpath_document_read(dom_object *obj, zval *retval);
#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 aec50632e3..b1d8ef452a 100644
--- a/ext/dom/domconfiguration.c
+++ b/ext/dom/domconfiguration.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -90,12 +90,3 @@ PHP_FUNCTION(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 d822915e65..1932d51408 100644
--- a/ext/dom/domerror.c
+++ b/ext/dom/domerror.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -120,12 +120,3 @@ int dom_domerror_location_read(dom_object *obj, zval *retval)
/* }}} */
#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 cbdf770a68..344cb77c4f 100644
--- a/ext/dom/domerrorhandler.c
+++ b/ext/dom/domerrorhandler.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -58,12 +58,3 @@ PHP_FUNCTION(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 4676c39f39..922d01c95e 100644
--- a/ext/dom/domexception.c
+++ b/ext/dom/domexception.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -112,12 +112,3 @@ void php_dom_throw_error(int error_code, int strict_error)
/* }}} 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 c6629c85e9..e80561a86e 100644
--- a/ext/dom/domimplementation.c
+++ b/ext/dom/domimplementation.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -261,12 +261,3 @@ PHP_METHOD(domimplementation, getFeature)
/* }}} 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 aa9a07286f..9b248d4a02 100644
--- a/ext/dom/domimplementationlist.c
+++ b/ext/dom/domimplementationlist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -71,12 +71,3 @@ PHP_FUNCTION(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 27889c921e..7f3f8b9dfc 100644
--- a/ext/dom/domimplementationsource.c
+++ b/ext/dom/domimplementationsource.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -74,12 +74,3 @@ PHP_FUNCTION(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 e85d67f2ab..7ad0ff8866 100644
--- a/ext/dom/domlocator.c
+++ b/ext/dom/domlocator.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -107,12 +107,3 @@ int dom_domlocator_uri_read(dom_object *obj, zval *retval)
/* }}} */
#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 7293dd3176..224b924c1a 100644
--- a/ext/dom/domstringlist.c
+++ b/ext/dom/domstringlist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -71,12 +71,3 @@ PHP_FUNCTION(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 19ecfed7d9..51aba0e155 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -151,8 +151,6 @@ const zend_function_entry php_dom_element_class_functions[] = { /* {{{ */
/* {{{ proto DOMElement::__construct(string name, [string value], [string uri]) */
PHP_METHOD(domelement, __construct)
{
-
- zval *id = getThis();
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
char *name, *value = NULL, *uri = NULL;
@@ -214,7 +212,7 @@ PHP_METHOD(domelement, __construct)
xmlNodeSetContentLen(nodep, (xmlChar *) value, value_len);
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_DOMOBJ_P(ZEND_THIS);
oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode );
@@ -327,7 +325,8 @@ PHP_FUNCTION(dom_element_get_attribute)
xmlNodePtr attr;
size_t name_len;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
@@ -370,7 +369,8 @@ PHP_FUNCTION(dom_element_set_attribute)
dom_object *intern;
char *name, *value;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &id, dom_element_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &value, &value_len) == FAILURE) {
return;
}
@@ -435,7 +435,8 @@ PHP_FUNCTION(dom_element_remove_attribute)
size_t name_len;
char *name;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
@@ -484,7 +485,8 @@ PHP_FUNCTION(dom_element_get_attribute_node)
dom_object *intern;
char *name;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
@@ -530,7 +532,8 @@ PHP_FUNCTION(dom_element_set_attribute_node)
dom_object *intern, *attrobj, *oldobj;
int ret;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_attr_class_entry) == FAILURE) {
return;
}
@@ -596,7 +599,8 @@ PHP_FUNCTION(dom_element_remove_attribute_node)
dom_object *intern, *attrobj;
int ret;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_attr_class_entry) == FAILURE) {
return;
}
@@ -634,7 +638,8 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name)
char *name;
xmlChar *local;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
@@ -661,7 +666,8 @@ PHP_FUNCTION(dom_element_get_attribute_ns)
char *uri, *name;
xmlChar *strattr;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
return;
}
@@ -743,7 +749,8 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
dom_object *intern;
int errorcode = 0, stricterror, is_xmlns = 0, name_valid;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!ss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!ss", &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
return;
}
@@ -869,7 +876,8 @@ PHP_FUNCTION(dom_element_remove_attribute_ns)
size_t name_len, uri_len;
char *name, *uri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
return;
}
@@ -926,7 +934,8 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns)
int ret;
char *uri, *name;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
return;
}
@@ -980,7 +989,8 @@ PHP_FUNCTION(dom_element_set_attribute_node_ns)
dom_object *intern, *attrobj, *oldobj;
int ret;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_attr_class_entry) == FAILURE) {
return;
}
@@ -1053,7 +1063,8 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns)
char *uri, *name;
xmlChar *local, *nsuri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &uri, &uri_len, &name, &name_len) == FAILURE) {
return;
}
@@ -1081,7 +1092,8 @@ PHP_FUNCTION(dom_element_has_attribute)
size_t name_len;
xmlNodePtr attr;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
@@ -1110,7 +1122,8 @@ PHP_FUNCTION(dom_element_has_attribute_ns)
char *uri, *name;
xmlChar *value;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
return;
}
@@ -1167,7 +1180,8 @@ PHP_FUNCTION(dom_element_set_id_attribute)
size_t name_len;
zend_bool is_id;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osb", &id, dom_element_class_entry, &name, &name_len, &is_id) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sb", &name, &name_len, &is_id) == FAILURE) {
return;
}
@@ -1203,7 +1217,8 @@ PHP_FUNCTION(dom_element_set_id_attribute_ns)
char *uri, *name;
zend_bool is_id;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ossb", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &is_id) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssb", &uri, &uri_len, &name, &name_len, &is_id) == FAILURE) {
return;
}
@@ -1237,7 +1252,8 @@ PHP_FUNCTION(dom_element_set_id_attribute_node)
dom_object *intern, *attrobj;
zend_bool is_id;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OOb", &id, dom_element_class_entry, &node, dom_attr_class_entry, &is_id) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &node, dom_attr_class_entry, &is_id) == FAILURE) {
return;
}
@@ -1261,12 +1277,3 @@ 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 4caf4abeab..b41255066a 100644
--- a/ext/dom/entity.c
+++ b/ext/dom/entity.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -170,12 +170,3 @@ int dom_entity_version_write(dom_object *obj, zval *newval)
/* }}} */
#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 80f3daa223..f7c0c2a711 100644
--- a/ext/dom/entityreference.c
+++ b/ext/dom/entityreference.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -46,7 +46,6 @@ const zend_function_entry php_dom_entityreference_class_functions[] = {
/* {{{ proto DOMEntityReference::__construct(string name) */
PHP_METHOD(domentityreference, __construct)
{
- zval *id = getThis();
xmlNode *node;
xmlNodePtr oldnode = NULL;
dom_object *intern;
@@ -70,7 +69,7 @@ PHP_METHOD(domentityreference, __construct)
RETURN_FALSE;
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_DOMOBJ_P(ZEND_THIS);
if (intern != NULL) {
oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
@@ -82,12 +81,3 @@ PHP_METHOD(domentityreference, __construct)
/* }}} 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 19a15730a9..4b8df2734f 100644
--- a/ext/dom/namednodemap.c
+++ b/ext/dom/namednodemap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -138,7 +138,8 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
xmlNodePtr nodep;
xmlNotation *notep = NULL;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_namednodemap_class_entry, &named, &namedlen) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &named, &namedlen) == FAILURE) {
return;
}
@@ -212,7 +213,8 @@ PHP_FUNCTION(dom_namednodemap_item)
xmlNodePtr nodep, curnode;
int count;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &id, dom_namednodemap_class_entry, &index) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
return;
}
if (index >= 0) {
@@ -276,7 +278,8 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
xmlNodePtr nodep;
xmlNotation *notep = NULL;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!s", &id, dom_namednodemap_class_entry, &uri, &urilen, &named, &namedlen) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &urilen, &named, &namedlen) == FAILURE) {
return;
}
@@ -341,7 +344,8 @@ PHP_FUNCTION(dom_namednodemap_count)
zval *id;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_namednodemap_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -353,12 +357,3 @@ PHP_FUNCTION(dom_namednodemap_count)
/* }}} end dom_namednodemap_count */
#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 4ef9062eb8..a235536bb5 100644
--- a/ext/dom/namelist.c
+++ b/ext/dom/namelist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -82,12 +82,3 @@ PHP_FUNCTION(dom_namelist_get_namespace_uri)
/* }}} 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 0e7f64a9bd..609d1a6116 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -291,7 +291,7 @@ int dom_node_node_value_read(dom_object *obj, zval *retval)
return FAILURE;
}
- /* Access to Element node is implemented as a convience method */
+ /* Access to Element node is implemented as a convenience method */
switch (nodep->type) {
case XML_ATTRIBUTE_NODE:
case XML_TEXT_NODE:
@@ -323,13 +323,19 @@ int dom_node_node_value_read(dom_object *obj, zval *retval)
int dom_node_node_value_write(dom_object *obj, zval *newval)
{
xmlNode *nodep = dom_object_get_node(obj);
+ zend_string *str;
if (nodep == NULL) {
php_dom_throw_error(INVALID_STATE_ERR, 0);
return FAILURE;
}
- /* Access to Element node is implemented as a convience method */
+ str = zval_try_get_string(newval);
+ if (UNEXPECTED(!str)) {
+ return FAILURE;
+ }
+
+ /* Access to Element node is implemented as a convenience method */
switch (nodep->type) {
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
@@ -342,16 +348,13 @@ int dom_node_node_value_write(dom_object *obj, zval *newval)
case XML_COMMENT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_PI_NODE:
- {
- zend_string *str = zval_get_string(newval);
- xmlNodeSetContentLen(nodep, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1);
- zend_string_release_ex(str, 0);
- break;
- }
+ xmlNodeSetContentLen(nodep, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1);
+ break;
default:
break;
}
+ zend_string_release_ex(str, 0);
return SUCCESS;
}
@@ -721,7 +724,11 @@ int dom_node_prefix_write(dom_object *obj, zval *newval)
nsnode = xmlDocGetRootElement(nodep->doc);
}
}
- str = zval_get_string(newval);
+ str = zval_try_get_string(newval);
+ if (UNEXPECTED(!str)) {
+ return FAILURE;
+ }
+
prefix = ZSTR_VAL(str);
if (nsnode && nodep->ns != NULL && !xmlStrEqual(nodep->ns->prefix, (xmlChar *)prefix)) {
strURI = (char *) nodep->ns->href;
@@ -854,6 +861,11 @@ int dom_node_text_content_write(dom_object *obj, zval *newval)
return FAILURE;
}
+ str = zval_try_get_string(newval);
+ if (UNEXPECTED(!str)) {
+ return FAILURE;
+ }
+
if (nodep->type == XML_ELEMENT_NODE || nodep->type == XML_ATTRIBUTE_NODE) {
if (nodep->children) {
node_list_unlink(nodep->children);
@@ -862,7 +874,6 @@ int dom_node_text_content_write(dom_object *obj, zval *newval)
}
}
- str = zval_get_string(newval);
/* we have to use xmlNodeAddContent() to get the same behavior as with xmlNewText() */
xmlNodeSetContent(nodep, (xmlChar *) "");
xmlNodeAddContent(nodep, (xmlChar *) ZSTR_VAL(str));
@@ -929,7 +940,8 @@ PHP_FUNCTION(dom_node_insert_before)
dom_object *intern, *childobj, *refpobj;
int ret, stricterror;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO|O!", &id, dom_node_class_entry, &node, dom_node_class_entry, &ref, dom_node_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|O!", &node, dom_node_class_entry, &ref, dom_node_class_entry) == FAILURE) {
return;
}
@@ -1092,7 +1104,8 @@ PHP_FUNCTION(dom_node_replace_child)
int ret;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OOO", &id, dom_node_class_entry, &newnode, dom_node_class_entry, &oldnode, dom_node_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &newnode, dom_node_class_entry, &oldnode, dom_node_class_entry) == FAILURE) {
return;
}
@@ -1178,7 +1191,8 @@ PHP_FUNCTION(dom_node_remove_child)
dom_object *intern, *childobj;
int ret, stricterror;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_node_class_entry) == FAILURE) {
return;
}
@@ -1229,7 +1243,8 @@ PHP_FUNCTION(dom_node_append_child)
dom_object *intern, *childobj;
int ret, stricterror;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_node_class_entry) == FAILURE) {
return;
}
@@ -1329,7 +1344,8 @@ PHP_FUNCTION(dom_node_has_child_nodes)
xmlNode *nodep;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_node_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -1359,7 +1375,8 @@ PHP_FUNCTION(dom_node_clone_node)
dom_object *intern;
zend_bool recursive = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|b", &id, dom_node_class_entry, &recursive) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &recursive) == FAILURE) {
return;
}
@@ -1418,7 +1435,8 @@ PHP_FUNCTION(dom_node_normalize)
xmlNode *nodep;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_node_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -1435,11 +1453,10 @@ Since: DOM Level 2
*/
PHP_FUNCTION(dom_node_is_supported)
{
- zval *id;
size_t feature_len, version_len;
char *feature, *version;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &id, dom_node_class_entry, &feature, &feature_len, &version, &version_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &feature, &feature_len, &version, &version_len) == FAILURE) {
return;
}
@@ -1461,7 +1478,8 @@ PHP_FUNCTION(dom_node_has_attributes)
xmlNode *nodep;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_node_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -1498,7 +1516,8 @@ PHP_FUNCTION(dom_node_is_same_node)
xmlNodePtr nodeotherp, nodep;
dom_object *intern, *nodeotherobj;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_node_class_entry) == FAILURE) {
return;
}
@@ -1527,7 +1546,8 @@ PHP_FUNCTION(dom_node_lookup_prefix)
size_t uri_len = 0;
char *uri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &uri, &uri_len) == FAILURE) {
return;
}
@@ -1578,7 +1598,8 @@ PHP_FUNCTION(dom_node_is_default_namespace)
size_t uri_len = 0;
char *uri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &uri, &uri_len) == FAILURE) {
return;
}
@@ -1611,7 +1632,8 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri)
size_t prefix_len;
char *prefix;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!", &id, dom_node_class_entry, &prefix, &prefix_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!", &prefix, &prefix_len) == FAILURE) {
return;
}
@@ -1689,15 +1711,16 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
xmlXPathContextPtr ctxp=NULL;
xmlXPathObjectPtr xpathobjp=NULL;
+ id = ZEND_THIS;
if (mode == 0) {
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
- "O|bba!a!", &id, dom_node_class_entry, &exclusive, &with_comments,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(),
+ "|bba!a!", &exclusive, &with_comments,
&xpath_array, &ns_prefixes) == FAILURE) {
return;
}
} else {
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
- "Os|bba!a!", &id, dom_node_class_entry, &file, &file_len, &exclusive,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(),
+ "s|bba!a!", &file, &file_len, &exclusive,
&with_comments, &xpath_array, &ns_prefixes) == FAILURE) {
return;
}
@@ -1902,12 +1925,3 @@ PHP_METHOD(domnode, getLineNo)
/* }}} */
#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 6cb15150c8..84c4a9eb73 100644
--- a/ext/dom/nodelist.c
+++ b/ext/dom/nodelist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -109,7 +109,8 @@ PHP_FUNCTION(dom_nodelist_count)
zval *id;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_nodelist_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -138,7 +139,8 @@ PHP_FUNCTION(dom_nodelist_item)
xmlNodePtr nodep, curnode;
int count = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &id, dom_nodelist_class_entry, &index) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
return;
}
@@ -196,12 +198,3 @@ PHP_FUNCTION(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 7c65e43911..2fc3a84fec 100644
--- a/ext/dom/notation.c
+++ b/ext/dom/notation.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -91,12 +91,3 @@ int dom_notation_system_id_read(dom_object *obj, zval *retval)
/* }}} */
#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 72ae3c3ffe..726b74b934 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -356,7 +356,7 @@ zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot,
/* }}} */
/* {{{ dom_write_property */
-void dom_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *dom_write_property(zval *object, zval *member, zval *value, void **cache_slot)
{
dom_object *obj = Z_DOMOBJ_P(object);
zend_string *member_str = zval_get_string(member);
@@ -368,10 +368,12 @@ void dom_write_property(zval *object, zval *member, zval *value, void **cache_sl
if (hnd) {
hnd->write_func(obj, value);
} else {
- zend_std_write_property(object, member, value, cache_slot);
+ value = zend_std_write_property(object, member, value, cache_slot);
}
zend_string_release_ex(member_str, 0);
+
+ return value;
}
/* }}} */
@@ -1558,12 +1560,3 @@ int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty)
} /* }}} end dom_nodelist_has_dimension */
#endif /* 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/php_dom.h b/ext/dom/php_dom.h
index 41a2bf71ce..ce377b5ce7 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -158,12 +158,3 @@ 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 999ac61fb9..8cd2848c51 100644
--- a/ext/dom/processinginstruction.c
+++ b/ext/dom/processinginstruction.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -48,7 +48,6 @@ const zend_function_entry php_dom_processinginstruction_class_functions[] = {
/* {{{ proto DOMProcessingInstruction::__construct(string name, [string value]); */
PHP_METHOD(domprocessinginstruction, __construct)
{
- zval *id = getThis();
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
char *name, *value = NULL;
@@ -72,7 +71,7 @@ PHP_METHOD(domprocessinginstruction, __construct)
RETURN_FALSE;
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_DOMOBJ_P(ZEND_THIS);
oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode );
@@ -139,7 +138,10 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval)
return FAILURE;
}
- str = zval_get_string(newval);
+ str = zval_try_get_string(newval);
+ if (UNEXPECTED(!str)) {
+ return FAILURE;
+ }
xmlNodeSetContentLen(nodep, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1);
@@ -150,12 +152,3 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval)
/* }}} */
#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 81d3a96c11..ecc29b0dd6 100644
--- a/ext/dom/string_extend.c
+++ b/ext/dom/string_extend.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -73,12 +73,3 @@ PHP_FUNCTION(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/DOMAttr_value_basic_001.phpt b/ext/dom/tests/DOMAttr_value_basic_001.phpt
index d7af71649c..9898a406c5 100644
--- a/ext/dom/tests/DOMAttr_value_basic_001.phpt
+++ b/ext/dom/tests/DOMAttr_value_basic_001.phpt
@@ -13,4 +13,3 @@ print $attr->value."\n";
===DONE===
--EXPECT--
===DONE===
-
diff --git a/ext/dom/tests/DOMCharacterData_appendData_error_001.phpt b/ext/dom/tests/DOMCharacterData_appendData_error_001.phpt
deleted file mode 100644
index cf38004d85..0000000000
--- a/ext/dom/tests/DOMCharacterData_appendData_error_001.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-DOMCharacterData::appendData() with no arguments.
---CREDITS--
-Eric Stewart <ericleestewart@gmail.com>
-# TestFest Atlanta 2009-05-24
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-$document = new DOMDocument;
-$root = $document->createElement('root');
-$document->appendChild($root);
-
-$cdata = $document->createCDATASection('test');
-$root->appendChild($cdata);
-$cdata->appendData();
-?>
---EXPECTF--
-Warning: DOMCharacterData::appendData() expects exactly 1 parameter, 0 given in %s on line %d
diff --git a/ext/dom/tests/DOMCharacterData_deleteData_error_001.phpt b/ext/dom/tests/DOMCharacterData_deleteData_error_001.phpt
deleted file mode 100644
index 3726202d10..0000000000
--- a/ext/dom/tests/DOMCharacterData_deleteData_error_001.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-DOMCharacterData::deleteData() with no arguments.
---CREDITS--
-Eric Lee Stewart <ericleestewart@gmail.com>
-# TestFest Atlanta 2009-05-24
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-$document = new DOMDocument;
-$root = $document->createElement('root');
-$document->appendChild($root);
-
-$cdata = $document->createCDATASection('test');
-$root->appendChild($cdata);
-$cdata->deleteData();
-?>
---EXPECTF--
-Warning: DOMCharacterData::deleteData() expects exactly 2 parameters, 0 given in %s on line %d
diff --git a/ext/dom/tests/DOMCharacterData_insertData_error_001.phpt b/ext/dom/tests/DOMCharacterData_insertData_error_001.phpt
deleted file mode 100644
index 55038e369a..0000000000
--- a/ext/dom/tests/DOMCharacterData_insertData_error_001.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-DOMCharacterData::insertData() with no arguments.
---CREDITS--
-Eric Lee Stewart <ericleestewart@gmail.com>
-# TestFest Atlanta 2009-05-24
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-$document = new DOMDocument;
-$root = $document->createElement('root');
-$document->appendChild($root);
-
-$cdata = $document->createCDATASection('test');
-$root->appendChild($cdata);
-$cdata->insertData();
-?>
---EXPECTF--
-Warning: DOMCharacterData::insertData() expects exactly 2 parameters, 0 given in %s on line %d
diff --git a/ext/dom/tests/DOMCharacterData_length_error_001.phpt b/ext/dom/tests/DOMCharacterData_length_error_001.phpt
index e8bf16ab98..dd38ae2c36 100644
--- a/ext/dom/tests/DOMCharacterData_length_error_001.phpt
+++ b/ext/dom/tests/DOMCharacterData_length_error_001.phpt
@@ -14,4 +14,3 @@ print $character_data->length;
--EXPECTF--
Warning: main(): Invalid State Error in %s
===DONE===
-
diff --git a/ext/dom/tests/DOMCharacterData_replaceData_error_001.phpt b/ext/dom/tests/DOMCharacterData_replaceData_error_001.phpt
deleted file mode 100644
index fb3e66b4f8..0000000000
--- a/ext/dom/tests/DOMCharacterData_replaceData_error_001.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-DOMCharacterData::replaceData() with no arguments.
---CREDITS--
-Eric Lee Stewart <ericleestewart@gmail.com>
-# TestFest Atlanta 2009-05-24
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-$document = new DOMDocument;
-$root = $document->createElement('root');
-$document->appendChild($root);
-
-$cdata = $document->createCDATASection('test');
-$root->appendChild($cdata);
-$cdata->replaceData();
-?>
---EXPECTF--
-Warning: DOMCharacterData::replaceData() expects exactly 3 parameters, 0 given in %s on line %d
diff --git a/ext/dom/tests/DOMDocumentFragment_appendXML_error_001.phpt b/ext/dom/tests/DOMDocumentFragment_appendXML_error_001.phpt
deleted file mode 100644
index e0d9dfa6f5..0000000000
--- a/ext/dom/tests/DOMDocumentFragment_appendXML_error_001.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-DOMDocumentFragment::appendXML() with no arguments.
---CREDITS--
-Eric Lee Stewart <ericleestewart@gmail.com>
-# TestFest Atlanta 2009-05-24
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-$fragment = new DOMDocumentFragment();
-$fragment->appendXML();
-?>
---EXPECTF--
-Warning: DOMDocumentFragment::appendXML() expects exactly 1 parameter, 0 given in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_createEntityReference_basic.phpt b/ext/dom/tests/DOMDocument_createEntityReference_basic.phpt
index 2a3316ecc8..dd036b1bb4 100644
--- a/ext/dom/tests/DOMDocument_createEntityReference_basic.phpt
+++ b/ext/dom/tests/DOMDocument_createEntityReference_basic.phpt
@@ -5,7 +5,7 @@ Knut Urdalen <knut@php.net>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
diff --git a/ext/dom/tests/DOMDocument_implementationRead_basic.phpt b/ext/dom/tests/DOMDocument_implementationRead_basic.phpt
index 9482780b21..98da11ca2d 100644
--- a/ext/dom/tests/DOMDocument_implementationRead_basic.phpt
+++ b/ext/dom/tests/DOMDocument_implementationRead_basic.phpt
@@ -9,7 +9,7 @@ Lev Radin <prokurator@gmail.com>
<?php
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
var_dump($doc->implementation);
diff --git a/ext/dom/tests/DOMDocument_loadHTML_error1.phpt b/ext/dom/tests/DOMDocument_loadHTML_error1.phpt
deleted file mode 100644
index de8d349e9f..0000000000
--- a/ext/dom/tests/DOMDocument_loadHTML_error1.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-DOMDocument::loadHTML() should fail if no parameter is given
---CREDITS--
-Knut Urdalen <knut@php.net>
---SKIPIF--
-<?php
-require_once('skipif.inc');
-?>
---FILE--
-<?php
-$doc = new DOMDocument();
-$doc->loadHTML();
-?>
---EXPECTF--
-Warning: DOMDocument::loadHTML() expects at least 1 parameter, 0 given in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile.phpt
index 0431695737..dfbf8ec487 100644
--- a/ext/dom/tests/DOMDocument_loadHTMLfile.phpt
+++ b/ext/dom/tests/DOMDocument_loadHTMLfile.phpt
@@ -11,7 +11,7 @@ assert.bail=true
--FILE--
<?php
$doc = new DOMDocument();
-$result = $doc->loadHTMLFile(dirname(__FILE__) . "/test.html");
+$result = $doc->loadHTMLFile(__DIR__ . "/test.html");
assert($result === true);
?>
--EXPECT--
diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt
index 9542b69e84..cfb41686e8 100644
--- a/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt
+++ b/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt
@@ -11,7 +11,7 @@ assert.bail=true
--FILE--
<?php
$doc = new DOMDocument();
-$result = $doc->loadHTMLFile(dirname(__FILE__) . "/ffff/test.html");
+$result = $doc->loadHTMLFile(__DIR__ . "/ffff/test.html");
assert($result === false);
?>
--EXPECTF--
diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt
index 991103649e..cb071594fa 100644
--- a/ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt
+++ b/ext/dom/tests/DOMDocument_loadHTMLfile_variation1.phpt
@@ -11,7 +11,7 @@ assert.bail=true
--FILE--
<?php
$doc = new DOMDocument();
-$result = $doc->loadHTMLFile(dirname(__FILE__) . "/empty.html");
+$result = $doc->loadHTMLFile(__DIR__ . "/empty.html");
assert($result === true);
?>
--EXPECTF--
diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt
index 28533bf8af..2cbb1ed60d 100644
--- a/ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt
+++ b/ext/dom/tests/DOMDocument_loadHTMLfile_variation2.phpt
@@ -11,7 +11,7 @@ assert.bail=true
--FILE--
<?php
$doc = new DOMDocument();
-$result = $doc->loadHTMLFile(dirname(__FILE__) . "/not_well.html");
+$result = $doc->loadHTMLFile(__DIR__ . "/not_well.html");
assert($result === true);
?>
--EXPECT--
diff --git a/ext/dom/tests/DOMDocument_loadXML_basic.phpt b/ext/dom/tests/DOMDocument_loadXML_basic.phpt
index 569593c007..cf25c26d62 100644
--- a/ext/dom/tests/DOMDocument_loadXML_basic.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_basic.phpt
@@ -17,5 +17,5 @@ XML_FILE=/book.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=1
--FILE_EXTERNAL--
-domdocumentloadxml_test_method.php
+domdocumentloadxml_test_method.inc
--EXPECT--
diff --git a/ext/dom/tests/DOMDocument_loadXML_error1.phpt b/ext/dom/tests/DOMDocument_loadXML_error1.phpt
index 9a433d1282..a752a19570 100644
--- a/ext/dom/tests/DOMDocument_loadXML_error1.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_error1.phpt
@@ -17,7 +17,7 @@ XML_FILE=/not_well_formed.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
-domdocumentloadxml_test_method.php
+domdocumentloadxml_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s
diff --git a/ext/dom/tests/DOMDocument_loadXML_error2.phpt b/ext/dom/tests/DOMDocument_loadXML_error2.phpt
index e3072720e6..6d56a317ed 100644
--- a/ext/dom/tests/DOMDocument_loadXML_error2.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_error2.phpt
@@ -17,7 +17,7 @@ XML_FILE=/not_well_formed2.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
-domdocumentloadxml_test_method.php
+domdocumentloadxml_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): AttValue: " or ' expected %s
diff --git a/ext/dom/tests/DOMDocument_loadXML_error3.phpt b/ext/dom/tests/DOMDocument_loadXML_error3.phpt
index 3678c79601..834428e32c 100644
--- a/ext/dom/tests/DOMDocument_loadXML_error3.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_error3.phpt
@@ -17,6 +17,6 @@ XML_FILE=/not_well_formed3.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
-domdocumentloadxml_test_method.php
+domdocumentloadxml_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: boOk line 8 and book %s
diff --git a/ext/dom/tests/DOMDocument_loadXML_error4.phpt b/ext/dom/tests/DOMDocument_loadXML_error4.phpt
index e4a1e9d774..1489f143fa 100644
--- a/ext/dom/tests/DOMDocument_loadXML_error4.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_error4.phpt
@@ -12,12 +12,11 @@ Antonio Diaz Ruiz <dejalatele@gmail.com>
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
-<?php if (LIBXML_VERSION < 20701) die("skip: libxml2 2.7.1+ required"); ?>
--ENV--
XML_FILE=/not_well_formed4.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
-domdocumentloadxml_test_method.php
+domdocumentloadxml_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Unsupported version '3.1' %s
diff --git a/ext/dom/tests/DOMDocument_loadXML_error5.phpt b/ext/dom/tests/DOMDocument_loadXML_error5.phpt
index 29cb464e8d..221a378760 100644
--- a/ext/dom/tests/DOMDocument_loadXML_error5.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_error5.phpt
@@ -17,6 +17,6 @@ XML_FILE=/not_well_formed5.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
-domdocumentloadxml_test_method.php
+domdocumentloadxml_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s
diff --git a/ext/dom/tests/DOMDocument_loadXML_variation1.phpt b/ext/dom/tests/DOMDocument_loadXML_variation1.phpt
index 558137526f..e3a3d94d3b 100644
--- a/ext/dom/tests/DOMDocument_loadXML_variation1.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_variation1.phpt
@@ -17,5 +17,5 @@ XML_FILE=/book_with_dtd2.xml
LOAD_OPTIONS=LIBXML_DTDLOAD
EXPECTED_RESULT=1
--FILE_EXTERNAL--
-domdocumentloadxml_test_method.php
+domdocumentloadxml_test_method.inc
--EXPECT--
diff --git a/ext/dom/tests/DOMDocument_loadXML_variation2.phpt b/ext/dom/tests/DOMDocument_loadXML_variation2.phpt
index 71f638efc1..9f9a5edc07 100644
--- a/ext/dom/tests/DOMDocument_loadXML_variation2.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_variation2.phpt
@@ -17,6 +17,6 @@ XML_FILE=/wrong_book_with_dtd2.xml
LOAD_OPTIONS=LIBXML_DTDVALID
EXPECTED_RESULT=1
--FILE_EXTERNAL--
-domdocumentloadxml_test_method.php
+domdocumentloadxml_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Element book content does not follow the DTD, expecting (title , author), got (title author author ) %s
diff --git a/ext/dom/tests/DOMDocument_loadXML_variation3.phpt b/ext/dom/tests/DOMDocument_loadXML_variation3.phpt
index 8e61ec4dbc..e0186c802d 100644
--- a/ext/dom/tests/DOMDocument_loadXML_variation3.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_variation3.phpt
@@ -18,5 +18,5 @@ XML_FILE=/wrong_book_with_dtd.xml
LOAD_OPTIONS=LIBXML_DTDVALID | LIBXML_NOERROR
EXPECTED_RESULT=1
--FILE_EXTERNAL--
-domdocumentloadxml_test_method.php
+domdocumentloadxml_test_method.inc
--EXPECT--
diff --git a/ext/dom/tests/DOMDocument_loadXML_variation4.phpt b/ext/dom/tests/DOMDocument_loadXML_variation4.phpt
index 4f1ea37c19..ab15063642 100644
--- a/ext/dom/tests/DOMDocument_loadXML_variation4.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_variation4.phpt
@@ -18,7 +18,7 @@ XML_FILE=/book_with_dtd2.xml
LOAD_OPTIONS=LIBXML_DTDATTR|LIBXML_NOCDATA|LIBXML_NOENT|LIBXML_NOBLANKS
EXPECTED_RESULT=1
--FILE_EXTERNAL--
-domdocumentloadxml_test_method_savexml.php
+domdocumentloadxml_test_method_savexml.inc
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE books [
diff --git a/ext/dom/tests/DOMDocument_load_basic.phpt b/ext/dom/tests/DOMDocument_load_basic.phpt
index 6d70ed4522..7512fad6c7 100644
--- a/ext/dom/tests/DOMDocument_load_basic.phpt
+++ b/ext/dom/tests/DOMDocument_load_basic.phpt
@@ -17,5 +17,5 @@ XML_FILE=/book.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=1
--FILE_EXTERNAL--
-domdocumentload_test_method.php
+domdocumentload_test_method.inc
--EXPECT--
diff --git a/ext/dom/tests/DOMDocument_load_error1.phpt b/ext/dom/tests/DOMDocument_load_error1.phpt
index 4c661f7e69..d3401b3972 100644
--- a/ext/dom/tests/DOMDocument_load_error1.phpt
+++ b/ext/dom/tests/DOMDocument_load_error1.phpt
@@ -17,7 +17,7 @@ XML_FILE=/not_well_formed.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
-domdocumentload_test_method.php
+domdocumentload_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s
diff --git a/ext/dom/tests/DOMDocument_load_error2.phpt b/ext/dom/tests/DOMDocument_load_error2.phpt
index 282f764989..f450cf1654 100644
--- a/ext/dom/tests/DOMDocument_load_error2.phpt
+++ b/ext/dom/tests/DOMDocument_load_error2.phpt
@@ -17,7 +17,7 @@ XML_FILE=/not_well_formed2.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
-domdocumentload_test_method.php
+domdocumentload_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): AttValue: " or ' expected %s
diff --git a/ext/dom/tests/DOMDocument_load_error3.phpt b/ext/dom/tests/DOMDocument_load_error3.phpt
index fbd795ee4d..b3d70a94d0 100644
--- a/ext/dom/tests/DOMDocument_load_error3.phpt
+++ b/ext/dom/tests/DOMDocument_load_error3.phpt
@@ -17,6 +17,6 @@ XML_FILE=/not_well_formed3.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
-domdocumentload_test_method.php
+domdocumentload_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: boOk line 8 and book %s
diff --git a/ext/dom/tests/DOMDocument_load_error4.phpt b/ext/dom/tests/DOMDocument_load_error4.phpt
index b1a5103c8a..9c8e825cc7 100644
--- a/ext/dom/tests/DOMDocument_load_error4.phpt
+++ b/ext/dom/tests/DOMDocument_load_error4.phpt
@@ -12,12 +12,11 @@ Antonio Diaz Ruiz <dejalatele@gmail.com>
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
-<?php if (LIBXML_VERSION < 20701) die("skip: libxml2 2.7.1+ required"); ?>
--ENV--
XML_FILE=/not_well_formed4.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
-domdocumentload_test_method.php
+domdocumentload_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Unsupported version '3.1' %s
diff --git a/ext/dom/tests/DOMDocument_load_error5.phpt b/ext/dom/tests/DOMDocument_load_error5.phpt
index 27f2c06300..cd1875f906 100644
--- a/ext/dom/tests/DOMDocument_load_error5.phpt
+++ b/ext/dom/tests/DOMDocument_load_error5.phpt
@@ -17,6 +17,6 @@ XML_FILE=/not_well_formed5.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
-domdocumentload_test_method.php
+domdocumentload_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s
diff --git a/ext/dom/tests/DOMDocument_load_variation1.phpt b/ext/dom/tests/DOMDocument_load_variation1.phpt
index b2b99e74c7..f03920155a 100644
--- a/ext/dom/tests/DOMDocument_load_variation1.phpt
+++ b/ext/dom/tests/DOMDocument_load_variation1.phpt
@@ -17,5 +17,5 @@ XML_FILE=/book_with_dtd.xml
LOAD_OPTIONS=LIBXML_DTDLOAD
EXPECTED_RESULT=1
--FILE_EXTERNAL--
-domdocumentload_test_method.php
+domdocumentload_test_method.inc
--EXPECT--
diff --git a/ext/dom/tests/DOMDocument_load_variation2.phpt b/ext/dom/tests/DOMDocument_load_variation2.phpt
index c8460e55eb..53aed7315e 100644
--- a/ext/dom/tests/DOMDocument_load_variation2.phpt
+++ b/ext/dom/tests/DOMDocument_load_variation2.phpt
@@ -17,6 +17,6 @@ XML_FILE=/wrong_book_with_dtd.xml
LOAD_OPTIONS=LIBXML_DTDVALID
EXPECTED_RESULT=1
--FILE_EXTERNAL--
-domdocumentload_test_method.php
+domdocumentload_test_method.inc
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Element book content does not follow the DTD, expecting (title , author), got (title author author ) %s
diff --git a/ext/dom/tests/DOMDocument_load_variation3.phpt b/ext/dom/tests/DOMDocument_load_variation3.phpt
index 77801d475e..54d44b8263 100644
--- a/ext/dom/tests/DOMDocument_load_variation3.phpt
+++ b/ext/dom/tests/DOMDocument_load_variation3.phpt
@@ -18,5 +18,5 @@ XML_FILE=/wrong_book_with_dtd.xml
LOAD_OPTIONS=LIBXML_DTDVALID | LIBXML_NOERROR
EXPECTED_RESULT=1
--FILE_EXTERNAL--
-domdocumentload_test_method.php
+domdocumentload_test_method.inc
--EXPECT--
diff --git a/ext/dom/tests/DOMDocument_load_variation4.phpt b/ext/dom/tests/DOMDocument_load_variation4.phpt
index 3bf7ccc04d..3c7194ac56 100644
--- a/ext/dom/tests/DOMDocument_load_variation4.phpt
+++ b/ext/dom/tests/DOMDocument_load_variation4.phpt
@@ -18,7 +18,7 @@ XML_FILE=/book_with_dtd.xml
LOAD_OPTIONS=LIBXML_DTDATTR|LIBXML_NOCDATA|LIBXML_NOENT|LIBXML_NOBLANKS
EXPECTED_RESULT=1
--FILE_EXTERNAL--
-domdocumentload_test_method_savexml.php
+domdocumentload_test_method_savexml.inc
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE books SYSTEM "books.dtd">
diff --git a/ext/dom/tests/DOMDocument_preserveWhiteSpace_basic.phpt b/ext/dom/tests/DOMDocument_preserveWhiteSpace_basic.phpt
index 17430d0770..5ae5f341d8 100644
--- a/ext/dom/tests/DOMDocument_preserveWhiteSpace_basic.phpt
+++ b/ext/dom/tests/DOMDocument_preserveWhiteSpace_basic.phpt
@@ -9,7 +9,7 @@ Lev Radin <prokurator@gmail.com>
<?php
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
var_dump($doc->preserveWhiteSpace);
diff --git a/ext/dom/tests/DOMDocument_preserveWhiteSpace_variations.phpt b/ext/dom/tests/DOMDocument_preserveWhiteSpace_variations.phpt
index e467f56aa3..92a74a8390 100644
--- a/ext/dom/tests/DOMDocument_preserveWhiteSpace_variations.phpt
+++ b/ext/dom/tests/DOMDocument_preserveWhiteSpace_variations.phpt
@@ -10,14 +10,14 @@ Lev Radin <prokurator@gmail.com>
echo "Load document with preserveWhiteSpace on\n";
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
echo $doc->saveXML();
echo "\nLoad document with preserveWhiteSpace off\n";
$doc = new DOMDocument;
$doc->preserveWhiteSpace = false;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
echo $doc->saveXML();
?>
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt
index 94f86eb9d2..fa777f8ce5 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt
@@ -9,7 +9,7 @@ require_once('skipif.inc');
--FILE--
<?php
$rng = <<< RNG
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
@@ -23,7 +23,7 @@ $rng = <<< RNG
RNG;
$good_xml = <<< GOOD_XML
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<apple>
<pear>Pear</pear>
</apple>
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt
index 7da71a57a1..a277a30a2d 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt
@@ -9,7 +9,7 @@ require_once('skipif.inc');
--FILE--
<?php
$rng = <<< RNG
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
@@ -23,7 +23,7 @@ $rng = <<< RNG
RNG;
$bad_xml = <<< BAD_XML
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<apple>
<pear>Pear</pear>
<pear>Pear</pear>
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt
index d689934f4e..b11dc63f7e 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt
@@ -9,7 +9,7 @@ require_once('skipif.inc');
--FILE--
<?php
$rng = <<< RNG
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
@@ -20,7 +20,7 @@ $rng = <<< RNG
RNG;
$xml = <<< XML
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<apple>
<pear>Pear</pear>
</apple>
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt
index 7a08f37fa5..e4b784e376 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt
@@ -8,9 +8,9 @@ require_once('skipif.inc');
?>
--FILE--
<?php
-$rng = dirname(__FILE__).'/DOMDocument_relaxNGValidate_basic.rng';
+$rng = __DIR__.'/DOMDocument_relaxNGValidate_basic.rng';
$xml = <<< XML
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<apple>
<pear>Pear</pear>
</apple>
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt
index 82957c35bd..ab6befa3b1 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt
@@ -8,9 +8,9 @@ require_once('skipif.inc');
?>
--FILE--
<?php
-$rng = dirname(__FILE__).'/DOMDocument_relaxNGValidate_basic.rng';
+$rng = __DIR__.'/DOMDocument_relaxNGValidate_basic.rng';
$xml = <<< XML
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<apple>
<pear>Pear</pear>
<pear>Pear</pear>
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
index 5ffdc91eb2..cdd6e64194 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
@@ -8,9 +8,9 @@ require_once('skipif.inc');
?>
--FILE--
<?php
-$rng = dirname(__FILE__).'/foo.rng';
+$rng = __DIR__.'/foo.rng';
$xml = <<< XML
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<apple>
<pear>Pear</pear>
<pear>Pear</pear>
diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_basic.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_basic.phpt
index c38ea89633..30c090679c 100644
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_basic.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTMLFile_basic.phpt
@@ -5,11 +5,11 @@ Knut Urdalen <knut@php.net>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
-$filename = dirname(__FILE__)."/tmp_savehtmlfile".time().".html";
+$filename = __DIR__."/tmp_savehtmlfile".time().".html";
$doc = new DOMDocument('1.0');
$root = $doc->createElement('html');
$root = $doc->appendChild($root);
diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_error1.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_error1.phpt
deleted file mode 100644
index d4dfbe8fe0..0000000000
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_error1.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-DOMDocument::saveHTMLFile() should fail if no parameter is given
---CREDITS--
-Knut Urdalen <knut@php.net>
-#PHPTestFest2009 Norway 2009-06-09 \o/
---SKIPIF--
-<?php
-require_once('skipif.inc');
-?>
---FILE--
-<?php
-$doc = new DOMDocument('1.0');
-$root = $doc->createElement('html');
-$root = $doc->appendChild($root);
-$head = $doc->createElement('head');
-$head = $root->appendChild($head);
-$title = $doc->createElement('title');
-$title = $head->appendChild($title);
-$text = $doc->createTextNode('This is the title');
-$text = $title->appendChild($text);
-$doc->saveHTMLFile();
-?>
---EXPECTF--
-Warning: DOMDocument::saveHTMLFile() expects exactly 1 parameter, 0 given in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
index af0965c1c9..aa25bb16e7 100644
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
@@ -5,7 +5,7 @@ Knut Urdalen <knut@php.net>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_formatOutput.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_formatOutput.phpt
index 7471a6e60c..02ced08282 100644
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_formatOutput.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTMLFile_formatOutput.phpt
@@ -5,11 +5,11 @@ Knut Urdalen <knut@php.net>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
-$filename = dirname(__FILE__)."/tmp_savehtmlfile".time().".html";
+$filename = __DIR__."/tmp_savehtmlfile".time().".html";
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
$root = $doc->createElement('html');
diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt
index d5c6a797ef..6ca66730eb 100644
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt
@@ -5,7 +5,7 @@ Knut Urdalen <knut@php.net>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
diff --git a/ext/dom/tests/DOMDocument_saveHTML_basic.phpt b/ext/dom/tests/DOMDocument_saveHTML_basic.phpt
index 8675b957a1..79d65f5b11 100644
--- a/ext/dom/tests/DOMDocument_saveHTML_basic.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTML_basic.phpt
@@ -5,7 +5,7 @@ Knut Urdalen <knut@php.net>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
diff --git a/ext/dom/tests/DOMDocument_saveHTML_error2.phpt b/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
index e32e277803..83aefd5ba8 100644
--- a/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
@@ -5,7 +5,7 @@ Knut Urdalen <knut@php.net>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
diff --git a/ext/dom/tests/DOMDocument_saveHTML_variant1.phpt b/ext/dom/tests/DOMDocument_saveHTML_variant1.phpt
index ef51e7f126..12502e8a9a 100644
--- a/ext/dom/tests/DOMDocument_saveHTML_variant1.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTML_variant1.phpt
@@ -2,7 +2,7 @@
DOMDocument::saveHTML() optional parameters
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
diff --git a/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt b/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt
index 9c02e13adc..09ff24b391 100644
--- a/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTML_variant2.phpt
@@ -2,7 +2,7 @@
DOMDocument::saveHTML() vs DOMDocumet::saveXML()
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
diff --git a/ext/dom/tests/DOMDocument_save_basic.phpt b/ext/dom/tests/DOMDocument_save_basic.phpt
index bcad72dce5..2fe9cdac75 100644
--- a/ext/dom/tests/DOMDocument_save_basic.phpt
+++ b/ext/dom/tests/DOMDocument_save_basic.phpt
@@ -19,13 +19,13 @@ $title = $root->appendChild($title);
$text = $doc->createTextNode('This is the title');
$text = $title->appendChild($text);
-$temp_filename = dirname(__FILE__)."/DomDocument_save_basic.tmp";
+$temp_filename = __DIR__."/DomDocument_save_basic.tmp";
echo 'Wrote: ' . $doc->save($temp_filename) . ' bytes'; // Wrote: 72 bytes
?>
--CLEAN--
<?php
- $temp_filename = dirname(__FILE__)."/DomDocument_save_basic.tmp";
+ $temp_filename = __DIR__."/DomDocument_save_basic.tmp";
unlink($temp_filename);
?>
--EXPECT--
diff --git a/ext/dom/tests/DOMDocument_savexml_basic.phpt b/ext/dom/tests/DOMDocument_savexml_basic.phpt
index a0978ebb82..f08fc4e582 100644
--- a/ext/dom/tests/DOMDocument_savexml_basic.phpt
+++ b/ext/dom/tests/DOMDocument_savexml_basic.phpt
@@ -25,7 +25,7 @@ EOXML;
$dom = new DOMDocument();
$dom->loadXML($xml);
$root = $dom->documentElement;
-$directory = dirname(__FILE__);
+$directory = __DIR__;
$filename = $directory."/tmp_dom_savexml".time();
var_dump($dom->save($filename));
diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt
index 994b94d0c8..6140dc75b7 100644
--- a/ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt
@@ -9,9 +9,9 @@ Chris Wright <info@daverandom.com>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book-attr.xml");
+$doc->load(__DIR__."/book-attr.xml");
-$xsd = file_get_contents(dirname(__FILE__)."/book.xsd");
+$xsd = file_get_contents(__DIR__."/book.xsd");
$doc->schemaValidateSource($xsd, LIBXML_SCHEMA_CREATE);
diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_basic.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_basic.phpt
index 38bc3fa3cc..aaf2ba865a 100644
--- a/ext/dom/tests/DOMDocument_schemaValidateSource_basic.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidateSource_basic.phpt
@@ -10,9 +10,9 @@ Daniel Convissor <danielc@php.net>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
-$xsd = file_get_contents(dirname(__FILE__)."/book.xsd");
+$xsd = file_get_contents(__DIR__."/book.xsd");
$result = $doc->schemaValidateSource($xsd);
var_dump($result);
diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_error1.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_error1.phpt
index 51eb82e32f..8c63ec6146 100644
--- a/ext/dom/tests/DOMDocument_schemaValidateSource_error1.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidateSource_error1.phpt
@@ -10,7 +10,7 @@ Daniel Convissor <danielc@php.net>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
$result = $doc->schemaValidateSource('string that is not a schema');
var_dump($result);
diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_error2.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_error2.phpt
index 41a833b5aa..12295beade 100644
--- a/ext/dom/tests/DOMDocument_schemaValidateSource_error2.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidateSource_error2.phpt
@@ -10,9 +10,9 @@ Daniel Convissor <danielc@php.net>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
-$xsd = file_get_contents(dirname(__FILE__)."/book-non-conforming-schema.xsd");
+$xsd = file_get_contents(__DIR__."/book-non-conforming-schema.xsd");
$result = $doc->schemaValidateSource($xsd);
var_dump($result);
diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt
index 93dd792609..41f9015b92 100644
--- a/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt
@@ -10,7 +10,7 @@ Daniel Convissor <danielc@php.net>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
$result = $doc->schemaValidateSource('');
var_dump($result);
diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt
deleted file mode 100644
index f841b87428..0000000000
--- a/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-DomDocument::schemaValidateSource() - pass no parameters
---CREDITS--
-Daniel Convissor <danielc@php.net>
-# TestFest 2009 NYPHP
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-
-$doc = new DOMDocument;
-
-$doc->load(dirname(__FILE__)."/book.xml");
-
-$result = $doc->schemaValidateSource();
-var_dump($result);
-
-?>
---EXPECTF--
-Warning: DOMDocument::schemaValidateSource() expects at least 1 parameter, 0 given in %s.php on line %d
-NULL
diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt
index 7c98a74b1d..1f6761f768 100644
--- a/ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt
@@ -9,9 +9,9 @@ Chris Wright <info@daverandom.com>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book-attr.xml");
+$doc->load(__DIR__."/book-attr.xml");
-$xsd = file_get_contents(dirname(__FILE__)."/book.xsd");
+$xsd = file_get_contents(__DIR__."/book.xsd");
$doc->schemaValidateSource($xsd);
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt
index e0b5251b23..93058df27a 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt
@@ -9,9 +9,9 @@ Chris Wright <info@daverandom.com>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book-attr.xml");
+$doc->load(__DIR__."/book-attr.xml");
-$doc->schemaValidate(dirname(__FILE__)."/book.xsd", LIBXML_SCHEMA_CREATE);
+$doc->schemaValidate(__DIR__."/book.xsd", LIBXML_SCHEMA_CREATE);
foreach ($doc->getElementsByTagName('book') as $book) {
var_dump($book->getAttribute('is-hardback'));
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_basic.phpt b/ext/dom/tests/DOMDocument_schemaValidate_basic.phpt
index eec790de6f..5f3ed67937 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_basic.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_basic.phpt
@@ -10,9 +10,9 @@ Daniel Convissor <danielc@php.net>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
-$result = $doc->schemaValidate(dirname(__FILE__)."/book.xsd");
+$result = $doc->schemaValidate(__DIR__."/book.xsd");
var_dump($result);
?>
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error1.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error1.phpt
index 594c3c4291..d3ac5f5183 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_error1.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_error1.phpt
@@ -10,9 +10,9 @@ Daniel Convissor <danielc@php.net>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
-$result = $doc->schemaValidate(dirname(__FILE__)."/book-not-a-schema.xsd");
+$result = $doc->schemaValidate(__DIR__."/book-not-a-schema.xsd");
var_dump($result);
?>
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error2.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error2.phpt
index 5ffd533652..302fcc6665 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_error2.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_error2.phpt
@@ -10,9 +10,9 @@ Daniel Convissor <danielc@php.net>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
-$result = $doc->schemaValidate(dirname(__FILE__)."/book-non-conforming-schema.xsd");
+$result = $doc->schemaValidate(__DIR__."/book-non-conforming-schema.xsd");
var_dump($result);
?>
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt
index 275204f920..2ff2ce9487 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt
@@ -10,7 +10,7 @@ Daniel Convissor <danielc@php.net>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
$result = $doc->schemaValidate('');
var_dump($result);
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt
deleted file mode 100644
index 9e4b6c4b7c..0000000000
--- a/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-DomDocument::schemaValidate() - pass no parameters
---CREDITS--
-Daniel Convissor <danielc@php.net>
-# TestFest 2009 NYPHP
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-
-$doc = new DOMDocument;
-
-$doc->load(dirname(__FILE__)."/book.xml");
-
-$result = $doc->schemaValidate();
-var_dump($result);
-
-?>
---EXPECTF--
-Warning: DOMDocument::schemaValidate() expects at least 1 parameter, 0 given in %s.php on line %d
-NULL
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt
index d5743bc6cf..cb57b55b41 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt
@@ -10,9 +10,9 @@ Daniel Convissor <danielc@php.net>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
-$result = $doc->schemaValidate(dirname(__FILE__)."/non-existent-file");
+$result = $doc->schemaValidate(__DIR__."/non-existent-file");
var_dump($result);
?>
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt
index d253ad9690..f286379286 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt
@@ -9,9 +9,9 @@ Chris Wright <info@daverandom.com>
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book-attr.xml");
+$doc->load(__DIR__."/book-attr.xml");
-$doc->schemaValidate(dirname(__FILE__)."/book.xsd");
+$doc->schemaValidate(__DIR__."/book.xsd");
foreach ($doc->getElementsByTagName('book') as $book) {
var_dump($book->getAttribute('is-hardback'));
diff --git a/ext/dom/tests/DOMDocument_strictErrorChecking_basic.phpt b/ext/dom/tests/DOMDocument_strictErrorChecking_basic.phpt
index 33aecf4925..5a82aa5e24 100644
--- a/ext/dom/tests/DOMDocument_strictErrorChecking_basic.phpt
+++ b/ext/dom/tests/DOMDocument_strictErrorChecking_basic.phpt
@@ -9,7 +9,7 @@ Vincent Tsao <notes4vincent@gmail.com>
<?php
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
var_dump($doc->strictErrorChecking);
diff --git a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
index b6d94f9de7..3d99e0eb70 100644
--- a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
+++ b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
@@ -11,7 +11,7 @@ Vincent Tsao <notes4vincent@gmail.com>
echo "Load document\n";
$doc = new DOMDocument;
-$doc->load(dirname(__FILE__)."/book.xml");
+$doc->load(__DIR__."/book.xml");
echo "See if strictErrorChecking is on\n";
var_dump($doc->strictErrorChecking);
diff --git a/ext/dom/tests/DOMDocument_validate_basic.phpt b/ext/dom/tests/DOMDocument_validate_basic.phpt
index 21979b0bbe..092ff7cfe9 100644
--- a/ext/dom/tests/DOMDocument_validate_basic.phpt
+++ b/ext/dom/tests/DOMDocument_validate_basic.phpt
@@ -5,7 +5,7 @@ Knut Urdalen <knut@php.net>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
diff --git a/ext/dom/tests/DOMDocument_validate_error1.phpt b/ext/dom/tests/DOMDocument_validate_error1.phpt
deleted file mode 100644
index 8e1e72fe0f..0000000000
--- a/ext/dom/tests/DOMDocument_validate_error1.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-DOMDocument::validate() should fail if any parameter is given
---CREDITS--
-Knut Urdalen <knut@php.net>
-#PHPTestFest2009 Norway 2009-06-09 \o/
---SKIPIF--
-<?php
-require_once dirname(__FILE__) .'/skipif.inc';
-?>
---FILE--
-<?php
-$dom = new DOMDocument('1.0');
-$dom->validate(true);
-?>
---EXPECTF--
-Warning: DOMDocument::validate() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_validate_error2.phpt b/ext/dom/tests/DOMDocument_validate_error2.phpt
index 08ec083fbb..c6d03bf02d 100644
--- a/ext/dom/tests/DOMDocument_validate_error2.phpt
+++ b/ext/dom/tests/DOMDocument_validate_error2.phpt
@@ -5,7 +5,7 @@ Knut Urdalen <knut@php.net>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
diff --git a/ext/dom/tests/DOMDocument_validate_external_dtd.phpt b/ext/dom/tests/DOMDocument_validate_external_dtd.phpt
index 39dd70ee88..5f85b14fc4 100644
--- a/ext/dom/tests/DOMDocument_validate_external_dtd.phpt
+++ b/ext/dom/tests/DOMDocument_validate_external_dtd.phpt
@@ -5,7 +5,7 @@ Knut Urdalen <knut@php.net>
#PHPTestFest2009 Norway 2009-06-09 \o/
--SKIPIF--
<?php
-require_once dirname(__FILE__) .'/skipif.inc';
+require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
@@ -13,7 +13,7 @@ require_once dirname(__FILE__) .'/skipif.inc';
// reusing existing dtd: http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/dom.ent?view=co&content-type=text%2Fplain
$dom = new DOMDocument('1.0');
$dom->substituteEntities = true;
-$dom->load(dirname(__FILE__).'/dom.xml');
+$dom->load(__DIR__.'/dom.xml');
var_dump($dom->validate());
?>
--EXPECT--
diff --git a/ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt b/ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt
index cdf36319b3..5eb42a9907 100644
--- a/ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt
+++ b/ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt
@@ -13,7 +13,7 @@ require_once('skipif.inc');
require_once('dom_test.inc');
chdir(__DIR__);
-$XMLStringGood = file_get_contents(dirname(__FILE__).'/note.xml');
+$XMLStringGood = file_get_contents(__DIR__.'/note.xml');
$dom = new DOMDocument;
$dom->resolveExternals = TRUE;
diff --git a/ext/dom/tests/DOMNode_C14NFile_basic.phpt b/ext/dom/tests/DOMNode_C14NFile_basic.phpt
index 69edc860e4..b006e47deb 100644
--- a/ext/dom/tests/DOMNode_C14NFile_basic.phpt
+++ b/ext/dom/tests/DOMNode_C14NFile_basic.phpt
@@ -20,7 +20,7 @@ $xml = <<< XML
</books>
XML;
-$output = dirname(__FILE__).'/DOMNode_C14NFile_basic.tmp';
+$output = __DIR__.'/DOMNode_C14NFile_basic.tmp';
$doc = new DOMDocument();
$doc->loadXML($xml);
$node = $doc->getElementsByTagName('title')->item(0);
@@ -30,7 +30,7 @@ var_dump($content);
?>
--CLEAN--
<?php
-$output = dirname(__FILE__).'/DOMNode_C14NFile_basic.tmp';
+$output = __DIR__.'/DOMNode_C14NFile_basic.tmp';
unlink($output);
?>
--EXPECT--
diff --git a/ext/dom/tests/DOMNode_getLineNo_basic.phpt b/ext/dom/tests/DOMNode_getLineNo_basic.phpt
index f74d5d7cc9..655b751355 100644
--- a/ext/dom/tests/DOMNode_getLineNo_basic.phpt
+++ b/ext/dom/tests/DOMNode_getLineNo_basic.phpt
@@ -6,7 +6,7 @@ include('skipif.inc');
?>
--FILE--
<?php
-$file = dirname(__FILE__).'/book.xml';
+$file = __DIR__.'/book.xml';
$doc = new DOMDocument();
$doc->load($file);
$nodes = $doc->getElementsByTagName('title');
diff --git a/ext/dom/tests/DOMNode_getNodePath_basic.phpt b/ext/dom/tests/DOMNode_getNodePath_basic.phpt
index b422a5dbef..c490e0941f 100644
--- a/ext/dom/tests/DOMNode_getNodePath_basic.phpt
+++ b/ext/dom/tests/DOMNode_getNodePath_basic.phpt
@@ -6,7 +6,7 @@ include('skipif.inc');
?>
--FILE--
<?php
-$file = dirname(__FILE__).'/book.xml';
+$file = __DIR__.'/book.xml';
$doc = new DOMDocument();
$doc->load($file);
$nodes = $doc->getElementsByTagName('title');
diff --git a/ext/dom/tests/DOMNode_insertBefore_error2.phpt b/ext/dom/tests/DOMNode_insertBefore_error2.phpt
index fbe212d4b9..e951cd237a 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error2.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error2.phpt
@@ -14,7 +14,7 @@ assert.bail=true
<?php
$dom = new DOMDocument();
-$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
+$doc = $dom->load(__DIR__ . "/book.xml", LIBXML_NOBLANKS);
assert($doc === true);
$parent_node = $dom->getElementsByTagName("book")->item(0);
diff --git a/ext/dom/tests/DOMNode_insertBefore_error3.phpt b/ext/dom/tests/DOMNode_insertBefore_error3.phpt
index a8b4e45494..6e5137798c 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error3.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error3.phpt
@@ -14,7 +14,7 @@ assert.bail=true
<?php
$dom = new DOMDocument();
-$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
+$doc = $dom->load(__DIR__ . "/book.xml", LIBXML_NOBLANKS);
assert($doc === true);
$parent_node = $dom->getElementsByTagName("book")->item(0);
diff --git a/ext/dom/tests/DOMNode_insertBefore_error4.phpt b/ext/dom/tests/DOMNode_insertBefore_error4.phpt
index 5b1fc3150a..84fbcd82dd 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error4.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error4.phpt
@@ -14,7 +14,7 @@ assert.bail=true
<?php
$dom = new DOMDocument();
-$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
+$doc = $dom->load(__DIR__ . "/book.xml", LIBXML_NOBLANKS);
assert($doc === true);
$parent_node = $dom->getElementsByTagName("book")->item(0);
diff --git a/ext/dom/tests/DOMNode_insertBefore_error5.phpt b/ext/dom/tests/DOMNode_insertBefore_error5.phpt
index f5bcf098e7..e9dac3a459 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error5.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error5.phpt
@@ -14,7 +14,7 @@ assert.bail=true
<?php
$dom = new DOMDocument();
-$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
+$doc = $dom->load(__DIR__ . "/book.xml", LIBXML_NOBLANKS);
assert($doc === true);
$parent_node = $dom->getElementsByTagName("book")->item(0);
diff --git a/ext/dom/tests/DOMNode_insertBefore_error6.phpt b/ext/dom/tests/DOMNode_insertBefore_error6.phpt
index 5afecafed7..6027d44140 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error6.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error6.phpt
@@ -14,7 +14,7 @@ assert.bail=true
<?php
$dom = new DOMDocument();
-$doc = $dom->load(dirname(__FILE__) . "/book.xml", LIBXML_NOBLANKS);
+$doc = $dom->load(__DIR__ . "/book.xml", LIBXML_NOBLANKS);
assert($doc === true);
$parent_node = $dom->getElementsByTagName("book")->item(0);
diff --git a/ext/dom/tests/book-non-conforming-schema.xsd b/ext/dom/tests/book-non-conforming-schema.xsd
index d1ecbef01a..d1ecbef01a 100755..100644
--- a/ext/dom/tests/book-non-conforming-schema.xsd
+++ b/ext/dom/tests/book-non-conforming-schema.xsd
diff --git a/ext/dom/tests/book-not-a-schema.xsd b/ext/dom/tests/book-not-a-schema.xsd
index d89e3bbac6..d89e3bbac6 100755..100644
--- a/ext/dom/tests/book-not-a-schema.xsd
+++ b/ext/dom/tests/book-not-a-schema.xsd
diff --git a/ext/dom/tests/book.xsd b/ext/dom/tests/book.xsd
index 6b4a8ea545..6b4a8ea545 100755..100644
--- a/ext/dom/tests/book.xsd
+++ b/ext/dom/tests/book.xsd
diff --git a/ext/dom/tests/bug37456.phpt b/ext/dom/tests/bug37456.phpt
index d5a833413e..6d74a00308 100644
--- a/ext/dom/tests/bug37456.phpt
+++ b/ext/dom/tests/bug37456.phpt
@@ -7,7 +7,7 @@ Bug #37456 (DOMElement->setAttribute() loops forever)
$doc = new DOMDocument();
$doc->resolveExternals = true;
-$doc->load(dirname(__FILE__)."/dom.xml");
+$doc->load(__DIR__."/dom.xml");
$root = $doc->getElementsByTagName('foo')->item(0);
$root->setAttribute('bar', '&gt;');
diff --git a/ext/dom/tests/bug38949.phpt b/ext/dom/tests/bug38949.phpt
index 4c81d9b731..47d0720ef4 100644
--- a/ext/dom/tests/bug38949.phpt
+++ b/ext/dom/tests/bug38949.phpt
@@ -6,7 +6,7 @@ Bug #38949 (Cannot get xmlns value attribute)
<?php
$doc = new DOMDocument();
-$doc->load(dirname(__FILE__)."/nsdoc.xml");
+$doc->load(__DIR__."/nsdoc.xml");
$root = $doc->documentElement;
diff --git a/ext/dom/tests/bug41257.phpt b/ext/dom/tests/bug41257.phpt
index edf62a53a3..71522617a3 100644
--- a/ext/dom/tests/bug41257.phpt
+++ b/ext/dom/tests/bug41257.phpt
@@ -6,7 +6,7 @@ Bug #41257 (lookupNamespaceURI does not work as expected)
<?php
$doc = new DOMDocument();
-$doc->load(dirname(__FILE__)."/nsdoc.xml");
+$doc->load(__DIR__."/nsdoc.xml");
$root = $doc->documentElement;
diff --git a/ext/dom/tests/bug42082.phpt b/ext/dom/tests/bug42082.phpt
index 1ec561003e..498d8f0346 100644
--- a/ext/dom/tests/bug42082.phpt
+++ b/ext/dom/tests/bug42082.phpt
@@ -28,4 +28,3 @@ bool(true)
bool(false)
bool(false)
===DONE===
-
diff --git a/ext/dom/tests/bug67081.phpt b/ext/dom/tests/bug67081.phpt
index c6dc007d43..faf7f42b2c 100644
--- a/ext/dom/tests/bug67081.phpt
+++ b/ext/dom/tests/bug67081.phpt
@@ -8,22 +8,22 @@ require_once('skipif.inc');
<?php
$domDocument = new DOMDocument();
$domDocument->substituteEntities = true;
- $domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_0.xml");
+ $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_0.xml");
var_dump($domDocument->doctype->internalSubset);
$domDocument = new DOMDocument();
$domDocument->substituteEntities = true;
- $domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_1.xml");
+ $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_1.xml");
var_dump($domDocument->doctype->internalSubset);
$domDocument = new DOMDocument();
$domDocument->substituteEntities = true;
- $domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_2.xml");
+ $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_2.xml");
var_dump($domDocument->doctype->internalSubset);
$domDocument = new DOMDocument();
$domDocument->substituteEntities = true;
- $domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "dom.xml");
+ $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "dom.xml");
var_dump($domDocument->doctype->internalSubset);
?>
===DONE===
diff --git a/ext/dom/tests/bug76285.phpt b/ext/dom/tests/bug76285.phpt
index bcf275d520..c5fbd9627f 100644
--- a/ext/dom/tests/bug76285.phpt
+++ b/ext/dom/tests/bug76285.phpt
@@ -1,5 +1,8 @@
--TEST--
Bug #76285 DOMDocument::formatOutput attribute sometimes ignored
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+<?php if (!defined("LIBXML_HTML_NOIMPLIED")) die("skip libxml2 2.7.7 required"); ?>
--FILE--
<?php
diff --git a/ext/dom/tests/dom003.phpt b/ext/dom/tests/dom003.phpt
index 4c9d5a979f..05d23cd792 100644
--- a/ext/dom/tests/dom003.phpt
+++ b/ext/dom/tests/dom003.phpt
@@ -6,7 +6,7 @@ Test 3: Exception Test
<?php
$dom = new domdocument;
-$dom->load(dirname(__FILE__)."/book.xml");
+$dom->load(__DIR__."/book.xml");
$rootNode = $dom->documentElement;
print "--- Catch exception with try/catch\n";
try {
diff --git a/ext/dom/tests/dom004.phpt b/ext/dom/tests/dom004.phpt
index 3a9295feb3..383b731a8c 100644
--- a/ext/dom/tests/dom004.phpt
+++ b/ext/dom/tests/dom004.phpt
@@ -8,7 +8,7 @@ in_array('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrap
--FILE--
<?php
$dom = new domdocument;
-$dom->load("compress.zlib://".dirname(__FILE__)."/book.xml.gz");
+$dom->load("compress.zlib://".__DIR__."/book.xml.gz");
print $dom->saveXML();
--EXPECT--
<?xml version="1.0"?>
diff --git a/ext/dom/tests/dom005.phpt b/ext/dom/tests/dom005.phpt
index d7e828cc32..1006229997 100644
--- a/ext/dom/tests/dom005.phpt
+++ b/ext/dom/tests/dom005.phpt
@@ -5,7 +5,7 @@ Test 5: HTML Test
--FILE--
<?php
$dom = new domdocument;
-$dom->loadHTMLFile(dirname(__FILE__)."/test.html", LIBXML_NOBLANKS);
+$dom->loadHTMLFile(__DIR__."/test.html", LIBXML_NOBLANKS);
print "--- save as XML\n";
print adjustDoctype($dom->saveXML());
diff --git a/ext/dom/tests/dom006.phpt b/ext/dom/tests/dom006.phpt
index 6872a293ee..bd4b3922a9 100644
--- a/ext/dom/tests/dom006.phpt
+++ b/ext/dom/tests/dom006.phpt
@@ -23,7 +23,7 @@ Class books extends domDocument {
$dom = new books;
-$dom->load(dirname(__FILE__)."/book.xml");
+$dom->load(__DIR__."/book.xml");
$dom->addBook("PHP de Luxe", "Richard Samar, Christian Stocker");
print $dom->saveXML();
--EXPECT--
diff --git a/ext/dom/tests/dom_import_simplexml.phpt b/ext/dom/tests/dom_import_simplexml.phpt
index 81744aa260..6b39234851 100644
--- a/ext/dom/tests/dom_import_simplexml.phpt
+++ b/ext/dom/tests/dom_import_simplexml.phpt
@@ -5,7 +5,7 @@ Interop Test: Import from SimpleXML
<?php if (!extension_loaded('simplexml')) die('skip simplexml extension not available');?>
--FILE--
<?php
-$s = simplexml_load_file(dirname(__FILE__)."/book.xml");
+$s = simplexml_load_file(__DIR__."/book.xml");
if(!$s) {
echo "Error while loading the document\n";
exit;
diff --git a/ext/dom/tests/dom_xinclude.phpt b/ext/dom/tests/dom_xinclude.phpt
index 5d8906e316..a698895c60 100644
--- a/ext/dom/tests/dom_xinclude.phpt
+++ b/ext/dom/tests/dom_xinclude.phpt
@@ -9,8 +9,8 @@ in_array('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrap
<?php
$dom = new domdocument;
-$data = file_get_contents(dirname(__FILE__)."/xinclude.xml");
-$reldir = str_replace(getcwd(),".",dirname(__FILE__));
+$data = file_get_contents(__DIR__."/xinclude.xml");
+$reldir = str_replace(getcwd(),".",__DIR__);
if (DIRECTORY_SEPARATOR == '\\') {
$reldir = str_replace('\\',"/", $reldir);
}
diff --git a/ext/dom/tests/domdocument_createcomment_error_001.phpt b/ext/dom/tests/domdocument_createcomment_error_001.phpt
deleted file mode 100644
index e73e1f163a..0000000000
--- a/ext/dom/tests/domdocument_createcomment_error_001.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-DomDocument::CreateComment() - Incorrect Parameters
---CREDITS--
-Clint Priest @ PhpTek09
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
- $x = new DomDocument();
- $x->createComment();
-?>
-===DONE===
---EXPECTF--
-Warning: DOMDocument::createComment() expects exactly 1 parameter, 0 given in %s
-===DONE===
-
diff --git a/ext/dom/tests/domdocument_createentityreference_002.phpt b/ext/dom/tests/domdocument_createentityreference_002.phpt
deleted file mode 100644
index f981362890..0000000000
--- a/ext/dom/tests/domdocument_createentityreference_002.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-DomDocument::CreateEntityReference() - Empty Arguments
---CREDITS--
-Clint Priest @ PhpTek09
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
- $objDoc = new DomDocument();
-
- $objRef = $objDoc->createEntityReference();
-?>
-===DONE===
---EXPECTF--
-Warning: DOMDocument::createEntityReference() expects exactly 1 parameter, 0 given in %s
-===DONE===
-
diff --git a/ext/dom/tests/domdocumentload_test_method.php b/ext/dom/tests/domdocumentload_test_method.inc
index a15c9e53be..a643b428d1 100644
--- a/ext/dom/tests/domdocumentload_test_method.php
+++ b/ext/dom/tests/domdocumentload_test_method.inc
@@ -1,5 +1,5 @@
<?php
-include(dirname(__FILE__) . '/domdocumentload_utilities.php');
+include(dirname(__FILE__) . '/domdocumentload_utilities.inc');
$doc = new DOMDocument();
diff --git a/ext/dom/tests/domdocumentload_test_method_savexml.php b/ext/dom/tests/domdocumentload_test_method_savexml.inc
index c98ecf92f7..6f812eeac8 100644
--- a/ext/dom/tests/domdocumentload_test_method_savexml.php
+++ b/ext/dom/tests/domdocumentload_test_method_savexml.inc
@@ -1,5 +1,5 @@
<?php
-include(dirname(__FILE__) . '/domdocumentload_utilities.php');
+include(dirname(__FILE__) . '/domdocumentload_utilities.inc');
$doc = new DOMDocument();
diff --git a/ext/dom/tests/domdocumentload_utilities.php b/ext/dom/tests/domdocumentload_utilities.inc
index d40f7639ff..d40f7639ff 100644
--- a/ext/dom/tests/domdocumentload_utilities.php
+++ b/ext/dom/tests/domdocumentload_utilities.inc
diff --git a/ext/dom/tests/domdocumentloadxml_test_method.php b/ext/dom/tests/domdocumentloadxml_test_method.inc
index 9b97e2badd..1949012075 100644
--- a/ext/dom/tests/domdocumentloadxml_test_method.php
+++ b/ext/dom/tests/domdocumentloadxml_test_method.inc
@@ -1,5 +1,5 @@
<?php
-include(dirname(__FILE__) . '/domdocumentload_utilities.php');
+include(dirname(__FILE__) . '/domdocumentload_utilities.inc');
$doc = new DOMDocument();
diff --git a/ext/dom/tests/domdocumentloadxml_test_method_savexml.php b/ext/dom/tests/domdocumentloadxml_test_method_savexml.inc
index 1bcf8a8e33..386f53e69f 100644
--- a/ext/dom/tests/domdocumentloadxml_test_method_savexml.php
+++ b/ext/dom/tests/domdocumentloadxml_test_method_savexml.inc
@@ -1,5 +1,5 @@
<?php
-include(dirname(__FILE__) . '/domdocumentload_utilities.php');
+include(dirname(__FILE__) . '/domdocumentload_utilities.inc');
$doc = new DOMDocument();
diff --git a/ext/dom/tests/toString_exceptions.phpt b/ext/dom/tests/toString_exceptions.phpt
new file mode 100644
index 0000000000..4f97ae6c32
--- /dev/null
+++ b/ext/dom/tests/toString_exceptions.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Handling of exceptions during __toString
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+class BadStr {
+ public function __toString() {
+ throw new Exception("Exception");
+ }
+}
+
+$badStr = new BadStr;
+
+$doc = new DOMDocument();
+$doc->loadXML(
+ '<root xmlns:ns="foo"><node attr="foo" /><node>Text</node><ns:node/><?pi foobar?></root>');
+
+try { $doc->encoding = $badStr; } catch (Exception $e) { echo "Exception\n"; }
+try { $doc->version = $badStr; } catch (Exception $e) { echo "Exception\n"; }
+try { $doc->documentURI = $badStr; } catch (Exception $e) { echo "Exception\n"; }
+$root = $doc->childNodes[0];
+
+$node = $root->childNodes[0];
+$attrs = $node->attributes;
+$attr = $attrs[0];
+try { $attr->value = $badStr; } catch (Exception $e) { echo "Exception\n"; }
+try { $attr->nodeValue = $badStr; } catch (Exception $e) { echo "Exception\n"; }
+
+$node2 = $root->childNodes[1];
+try { $node2->nodeValue = $badStr; } catch (Exception $e) { echo "Exception\n"; }
+try { $node2->textContent = $badStr; } catch (Exception $e) { echo "Exception\n"; }
+$data = $node2->childNodes[0];
+try { $data->data = $badStr; } catch (Exception $e) { echo "Exception\n"; }
+
+$node3 = $root->childNodes[2];
+try { $node3->prefix = $badStr; } catch (Exception $e) { echo "Exception\n"; }
+
+$pi = $root->childNodes[3];
+try { $pi->data = $badStr; } catch (Exception $e) { echo "Exception\n"; }
+
+echo $doc->saveXML();
+
+?>
+--EXPECT--
+Exception
+Exception
+Exception
+Exception
+Exception
+Exception
+Exception
+Exception
+Exception
+Exception
+<?xml version="1.0"?>
+<root xmlns:ns="foo"><node attr="foo"/><node>Text</node><ns:node/><?pi foobar?></root>
diff --git a/ext/dom/text.c b/ext/dom/text.c
index 6e2773356f..168d06d8f4 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -62,8 +62,6 @@ const zend_function_entry php_dom_text_class_functions[] = {
/* {{{ proto DOMText::__construct([string value]); */
PHP_METHOD(domtext, __construct)
{
-
- zval *id = getThis();
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
char *value = NULL;
@@ -80,7 +78,7 @@ PHP_METHOD(domtext, __construct)
RETURN_FALSE;
}
- intern = Z_DOMOBJ_P(id);
+ intern = Z_DOMOBJ_P(ZEND_THIS);
if (intern != NULL) {
oldnode = dom_object_get_node(intern);
if (oldnode != NULL) {
@@ -147,7 +145,8 @@ PHP_FUNCTION(dom_text_split_text)
int length;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &id, dom_text_class_entry, &offset) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &offset) == FAILURE) {
return;
}
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
@@ -202,7 +201,8 @@ PHP_FUNCTION(dom_text_is_whitespace_in_element_content)
xmlNodePtr node;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_text_class_entry) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
return;
}
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
@@ -226,12 +226,3 @@ PHP_FUNCTION(dom_text_replace_whole_text)
/* }}} 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 977d6d8547..2d918c2007 100644
--- a/ext/dom/typeinfo.c
+++ b/ext/dom/typeinfo.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -68,12 +68,3 @@ int dom_typeinfo_type_namespace_read(dom_object *obj, zval *retval)
/* }}} */
#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 d9702ab941..6695d65c15 100644
--- a/ext/dom/userdatahandler.c
+++ b/ext/dom/userdatahandler.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -53,12 +53,3 @@ PHP_FUNCTION(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 35536a2bf5..6f51fecace 100644
--- a/ext/dom/xml_common.h
+++ b/ext/dom/xml_common.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -84,22 +84,10 @@ PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj);
*ret = php_dom_create_object(obj, return_value, domobject)
#define DOM_GET_THIS(zval) \
- if (NULL == (zval = getThis())) { \
- php_error_docref(NULL, E_WARNING, "Underlying object missing"); \
- RETURN_FALSE; \
- }
+ do { zval = ZEND_THIS; } while (0)
#define DOM_GET_THIS_OBJ(__ptr, __id, __prtype, __intern) \
DOM_GET_THIS(__id); \
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 513fad585b..69fdcb947f 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -250,7 +250,7 @@ static void dom_xpath_ext_function_object_php(xmlXPathParserContextPtr ctxt, int
/* {{{ proto DOMXPath::__construct(DOMDocument doc) U */
PHP_METHOD(domxpath, __construct)
{
- zval *id = getThis(), *doc;
+ zval *doc;
xmlDocPtr docp = NULL;
dom_object *docobj;
dom_xpath_object *intern;
@@ -268,7 +268,7 @@ PHP_METHOD(domxpath, __construct)
RETURN_FALSE;
}
- intern = Z_XPATHOBJ_P(id);
+ intern = Z_XPATHOBJ_P(ZEND_THIS);
if (intern != NULL) {
oldctx = (xmlXPathContextPtr)intern->dom.ptr;
if (oldctx != NULL) {
@@ -315,7 +315,8 @@ PHP_FUNCTION(dom_xpath_register_ns)
dom_xpath_object *intern;
unsigned char *prefix, *ns_uri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) {
return;
}
@@ -357,7 +358,8 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
xmlNsPtr *ns = NULL;
zend_bool register_node_ns = 1;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|O!b", &id, dom_xpath_class_entry, &expr, &expr_len, &context, dom_node_class_entry, &register_node_ns) == FAILURE) {
+ id = ZEND_THIS;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|O!b", &expr, &expr_len, &context, dom_node_class_entry, &register_node_ns) == FAILURE) {
return;
}
@@ -540,12 +542,3 @@ PHP_FUNCTION(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
- */