From 85ef799fb28df23f296cd3e8de00b2d9ccb787d0 Mon Sep 17 00:00:00 2001
From: NickSdot
Date: Fri, 7 Aug 2026 15:15:30 +0000
Subject: [PATCH] ext/dom: applied fixers to improve test robustness
---
.../tests/DOM4_ChildNode_wrong_document.phpt | 8 +--
.../DOM4_DOMNode_removeDanglingElement.phpt | 4 +-
.../DOM4_ParentNode_append_invalidtypes.phpt | 4 +-
...OM4_ParentNode_append_with_attributes.phpt | 4 +-
...DOM4_ParentNode_append_wrong_document.phpt | 6 +-
.../tests/DOMAttr_construct_error_001.phpt | 4 +-
.../DOMCDATASection_construct_error_001.phpt | 4 +-
.../DOMCharacterData_data_error_002.phpt | 4 +-
...DOMCharacterData_deleteData_error_002.phpt | 4 +-
.../DOMCharacterData_length_error_001.phpt | 4 +-
.../tests/DOMComment_construct_error_001.phpt | 4 +-
...MDocumentFragment_appendXML_error_002.phpt | 4 +-
...MDocumentFragment_construct_error_001.phpt | 4 +-
.../DOMDocumentType_entities_error_001.phpt | 4 +-
...DocumentType_internalSubset_error_001.phpt | 4 +-
.../tests/DOMDocumentType_name_error_001.phpt | 4 +-
.../DOMDocumentType_notations_error_001.phpt | 4 +-
.../DOMDocumentType_publicId_error_001.phpt | 4 +-
.../DOMDocumentType_systemId_error_001.phpt | 4 +-
ext/dom/tests/DOMDocument_adoptNode.phpt | 10 +--
...Document_createEntityReference_error1.phpt | 4 +-
ext/dom/tests/DOMDocument_encoding_basic.phpt | 4 +-
.../tests/DOMDocument_loadHTML_error2.phpt | 4 +-
.../DOMDocument_loadHTMLfile_error2.phpt | 8 +--
ext/dom/tests/DOMDocument_loadXML_error6.phpt | 4 +-
ext/dom/tests/DOMDocument_load_error6.phpt | 8 +--
.../DOMDocument_saveHTMLFile_error2.phpt | 4 +-
...ocument_saveHTMLFile_invalid_filename.phpt | 4 +-
.../tests/DOMDocument_saveHTML_error2.phpt | 4 +-
...MDocument_schemaValidateSource_error3.phpt | 4 +-
.../DOMDocument_schemaValidate_error3.phpt | 4 +-
.../DOMDocument_schemaValidate_error6.phpt | 4 +-
...ocument_strictErrorChecking_variation.phpt | 6 +-
.../tests/DOMDocument_validate_error2.phpt | 4 +-
ext/dom/tests/DOMDocument_version_write.phpt | 4 +-
.../DOMElement_append_hierarchy_test.phpt | 16 ++---
ext/dom/tests/DOMElement_className.phpt | 4 +-
ext/dom/tests/DOMElement_id.phpt | 4 +-
.../DOMElement_insertAdjacentElement.phpt | 14 ++--
.../tests/DOMElement_insertAdjacentText.phpt | 4 +-
ext/dom/tests/DOMElement_prefix_empty.phpt | 4 +-
.../DOMElement_prepend_hierarchy_test.phpt | 16 ++---
ext/dom/tests/DOMElement_replaceChildren.phpt | 8 +--
ext/dom/tests/DOMElement_toggleAttribute.phpt | 4 +-
ext/dom/tests/DOMEntityReference_error1.phpt | 4 +-
.../DOMNamedNodeMap_edge_case_offset.phpt | 8 +--
ext/dom/tests/DOMNode_C14NFile_basic.phpt | 8 +--
ext/dom/tests/DOMNode_C14N_basic.phpt | 8 +--
ext/dom/tests/DOMNode_contains.phpt | 4 +-
.../tests/DOMNode_insertBefore_error1.phpt | 4 +-
.../tests/DOMNode_insertBefore_error2.phpt | 4 +-
.../tests/DOMNode_insertBefore_error3.phpt | 4 +-
.../tests/DOMNode_insertBefore_error4.phpt | 4 +-
.../tests/DOMNode_insertBefore_error5.phpt | 4 +-
.../tests/DOMNode_insertBefore_error6.phpt | 4 +-
ext/dom/tests/DOMNode_removeChild_error1.phpt | 2 +-
.../tests/DOMNode_replaceChild_error1.phpt | 2 +-
.../tests/DOMNode_replaceChild_error2.phpt | 2 +-
ext/dom/tests/DOMProcessingInstruction.phpt | 20 +++---
ext/dom/tests/DOMXPath_callables.phpt | 8 +--
ext/dom/tests/DOMXPath_callables_errors.phpt | 36 +++++-----
ext/dom/tests/DOMXPath_clone.phpt | 4 +-
ext/dom/tests/bug44648.phpt | 16 ++---
ext/dom/tests/bug47430.phpt | 6 +-
ext/dom/tests/bug66783.phpt | 4 +-
ext/dom/tests/bug67949.phpt | 4 +-
ext/dom/tests/bug77569.phpt | 4 +-
ext/dom/tests/c14n_no_nodeset_returned.phpt | 4 +-
ext/dom/tests/clone_list_map_collection.phpt | 24 +++----
.../delayed_freeing/direct_construction.phpt | 40 +++++------
.../delayed_freeing/without_contructor.phpt | 12 ++--
ext/dom/tests/dom_import_simplexml.phpt | 4 +-
ext/dom/tests/dom_xinclude_errors.phpt | 4 +-
ext/dom/tests/domxpath.phpt | 8 +--
ext/dom/tests/entity_reference_stale_02.phpt | 2 +-
.../tests/gh11830/attribute_variation.phpt | 20 +++---
ext/dom/tests/gh11830/document_variation.phpt | 12 ++--
.../tests/gh11830/hierarchy_variation.phpt | 12 ++--
ext/dom/tests/gh11830/type_variation.phpt | 20 +++---
ext/dom/tests/gh12002.phpt | 8 +--
ext/dom/tests/gh13960.phpt | 4 +-
ext/dom/tests/gh15137.phpt | 1 -
ext/dom/tests/gh15910.phpt | 4 +-
ext/dom/tests/gh16039.phpt | 8 +--
ext/dom/tests/gh16151.phpt | 8 +--
ext/dom/tests/gh16190.phpt | 4 +-
ext/dom/tests/gh16316.phpt | 8 +--
ext/dom/tests/gh16465.phpt | 12 ++--
ext/dom/tests/gh16533.phpt | 4 +-
ext/dom/tests/gh16535.phpt | 4 +-
ext/dom/tests/gh16593.phpt | 4 +-
ext/dom/tests/gh16594.phpt | 4 +-
ext/dom/tests/gh16777_1.phpt | 4 +-
ext/dom/tests/gh16777_2.phpt | 4 +-
ext/dom/tests/gh17847.phpt | 16 ++---
.../tests/modern/common/template_rename.phpt | 4 +-
.../closest_invalid_selector.phpt | 4 +-
.../modern/css_selectors/combinators.phpt | 4 +-
.../matches_invalid_selector.phpt | 4 +-
.../css_selectors/pseudo_classes_blank.phpt | 4 +-
.../Element_renaming_html_ns_02.phpt | 8 +--
.../attribute_renaming_conflict.phpt | 26 ++++----
.../node_renaming_validation_errors.phpt | 8 +--
...ment_createFromFile_override_encoding.phpt | 4 +-
...nt_createFromString_override_encoding.phpt | 4 +-
.../HTMLDocument_encoding_field_test.phpt | 12 ++--
.../Document_body_setter_errors.phpt | 14 ++--
...Dom_Element_insertAdjacentHTML_errors.phpt | 16 ++---
.../HTMLCollection_dimension_errors.phpt | 12 ++--
.../HTMLDocument_registerNodeClass_02.phpt | 4 +-
.../interactions/without_constructor.phpt | 6 +-
...nt_fromFile_nul_terminator_cases_path.phpt | 8 +--
.../parser/HTMLDocument_parse_options.phpt | 66 +++++++++----------
..._deleteData_negative_in_bounds_length.phpt | 4 +-
.../CharacterData_insertData_edge_cases.phpt | 8 +--
...racterData_insertData_negative_offset.phpt | 4 +-
...Data_insertData_negative_offset_mod32.phpt | 12 ++--
...Data_replaceData_negative_count_mod32.phpt | 8 +--
...haracterData_substringData_edge_cases.phpt | 12 ++--
...Data_substringData_negative_arguments.phpt | 4 +-
...ubstringData_negative_arguments_mod32.phpt | 12 ++--
.../spec/Document_createAttributeNS.phpt | 16 ++---
.../modern/spec/Document_createElementNS.phpt | 12 ++--
.../Document_createElement_edge_cases.phpt | 8 +--
...lementation_createDocumentType_errors.phpt | 12 ++--
..._implementation_createDocument_errors.phpt | 8 +--
.../Document_implementation_same_object.phpt | 4 +-
.../Document_importNode_not_supported.phpt | 4 +-
.../spec/Element_insertAdjacentText.phpt | 4 +-
.../modern/spec/Element_prefix_readonly.phpt | 4 +-
.../Element_removeAttribute_edge_cases.phpt | 4 +-
.../modern/spec/Element_setAttributeNS.phpt | 4 +-
.../spec/Element_setAttributeNode_inuse.phpt | 4 +-
.../spec/HTMLDocument_createCDATASection.phpt | 12 ++--
...LDocument_createProcessingInstruction.phpt | 12 ++--
.../modern/spec/NamedNodeMap_dimensions.phpt | 6 +-
.../spec/NamedNodeMap_dimensions_errors.phpt | 4 +-
.../modern/spec/NodeList_dimensions.phpt | 10 +--
.../spec/NodeList_dimensions_errors.phpt | 4 +-
.../spec/Node_appendChild_attribute.phpt | 4 +-
...ppendChild_fragment_multiple_elements.phpt | 4 +-
.../spec/Node_appendChild_invalid_parent.phpt | 16 ++---
...de_cloneNode_copy_document_properties.phpt | 4 +-
.../modern/spec/Node_insertBefore_01.phpt | 4 +-
.../modern/spec/Node_insertBefore_02.phpt | 4 +-
.../spec/Node_replaceChild_edge_cases.phpt | 44 ++++++-------
...rentNode_append_exception_consistency.phpt | 4 +-
.../modern/spec/ParentNode_edge_case.phpt | 4 +-
.../spec/ParentNode_hierarchy_text_nodes.phpt | 16 ++---
.../modern/spec/Text_splitText_edge_case.phpt | 8 +--
.../modern/spec/XMLDocument_version.phpt | 8 +--
.../modern/spec/appendChild_dtd_legacy.phpt | 4 +-
.../append_text_nodes_invalid_hierarchy.phpt | 8 +--
.../tests/modern/spec/documentURI_URL.phpt | 4 +-
.../modern/spec/pre_insertion_validation.phpt | 36 +++++-----
.../modern/spec/textContent_edge_cases.phpt | 4 +-
.../tests/modern/token_list/add_errors.phpt | 16 ++---
ext/dom/tests/modern/token_list/clone.phpt | 2 +-
.../modern/token_list/contains_error.phpt | 4 +-
.../tests/modern/token_list/dimensions.phpt | 4 +-
.../modern/token_list/dimensions_error.phpt | 22 +++----
.../modern/token_list/foreach_by_ref.phpt | 4 +-
.../modern/token_list/remove_errors.phpt | 16 ++---
.../modern/token_list/replace_error.phpt | 12 ++--
ext/dom/tests/modern/token_list/supports.phpt | 4 +-
.../tests/modern/token_list/toggle_error.phpt | 8 +--
.../modern/token_list/value_edge_cases.phpt | 4 +-
...edNodeMap_dimension_index_overflow_64.phpt | 6 +-
.../xml/Element_innerHTML_writing_errors.phpt | 14 ++--
...Element_innerOuterHTML_reading_errors.phpt | 64 +++++++++---------
.../Element_insertAdjacentHTML_errors.phpt | 4 +-
.../xml/Element_outerHTML_writing_errors.phpt | 8 +--
.../xml/Node_removeChild_from_comment.phpt | 4 +-
...ment_createFromFile_override_encoding.phpt | 4 +-
...nt_createFromString_override_encoding.phpt | 4 +-
.../modern/xml/XMLDocument_fromFile_03.phpt | 4 +-
.../modern/xml/XMLDocument_fromString_03.phpt | 4 +-
.../tests/modern/xml/XMLDocument_xpath.phpt | 4 +-
.../modern/xml/XMLDocument_xpath_errors.phpt | 4 +-
.../modern/xml/canonicalize_unattached.phpt | 4 +-
ext/dom/tests/modern/xml/gh22570.phpt | 4 +-
.../modern/xml/serialize_empty_xmlns.phpt | 4 +-
.../tests/modern/xml/simplexml_interop.phpt | 4 +-
ext/dom/tests/not_serializable.phpt | 24 +++----
ext/dom/tests/not_unserializable.phpt | 10 +--
.../tests/null_text_content_manipulation.phpt | 16 ++---
ext/dom/tests/php_function_edge_cases.phpt | 8 +--
ext/dom/tests/property_write_errors.phpt | 24 +++----
.../registerNodeClass_abstract_class.phpt | 2 +-
.../tests/registerPhpFunctionNS_errors.phpt | 24 +++----
ext/dom/tests/register_node_class.phpt | 4 +-
.../replaceChild_attribute_validation.phpt | 4 +-
ext/dom/tests/unsetting_properties.phpt | 8 +--
.../xpath_domnamespacenode_advanced.phpt | 12 ++--
194 files changed, 805 insertions(+), 806 deletions(-)
diff --git a/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt b/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt
index cf51c3581a34..56a5d3f24cf4 100644
--- a/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt
+++ b/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt
@@ -19,7 +19,7 @@ function test($method) {
$element->$method($dom2->documentElement->firstChild);
echo "FAIL";
} catch (DOMException $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -29,6 +29,6 @@ test("replaceWith");
?>
--EXPECT--
-Wrong Document Error
-Wrong Document Error
-Wrong Document Error
+DOMException: Wrong Document Error
+DOMException: Wrong Document Error
+DOMException: Wrong Document Error
diff --git a/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt b/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt
index 3890ef08d5b7..2d12af639419 100644
--- a/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt
+++ b/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt
@@ -12,8 +12,8 @@ $element = $dom->createElement('test');
try {
$element->remove();
} catch (DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Not Found Error
+DOMException: Not Found Error
diff --git a/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt b/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt
index 9a823e370a6e..ada2ee8cbc67 100644
--- a/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt
+++ b/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt
@@ -12,8 +12,8 @@ $dom->loadXML('');
try {
$dom->documentElement->append(array());
} catch(TypeError $e) {
- echo "OK! {$e->getMessage()}";
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-OK! DOMElement::append(): Argument #1 must be of type DOMNode|string, array given
+TypeError: DOMElement::append(): Argument #1 must be of type DOMNode|string, array given
diff --git a/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt b/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt
index 701dc1d0944b..0f8057b06ca6 100644
--- a/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt
+++ b/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt
@@ -19,12 +19,12 @@ $element = $dom->documentElement;
try {
$element->append($replacement, $addition);
} catch (DOMException $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveXML();
?>
--EXPECT--
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
diff --git a/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt b/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt
index 9df1603cab0c..c3c2565b6cd3 100644
--- a/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt
+++ b/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt
@@ -19,7 +19,7 @@ function test($method) {
$element->$method($dom2->documentElement->firstChild);
echo "FAIL";
} catch (DOMException $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -27,5 +27,5 @@ test("append");
test("prepend");
?>
--EXPECT--
-Wrong Document Error
-Wrong Document Error
+DOMException: Wrong Document Error
+DOMException: Wrong Document Error
diff --git a/ext/dom/tests/DOMAttr_construct_error_001.phpt b/ext/dom/tests/DOMAttr_construct_error_001.phpt
index 0839587caf46..6e556f28be07 100644
--- a/ext/dom/tests/DOMAttr_construct_error_001.phpt
+++ b/ext/dom/tests/DOMAttr_construct_error_001.phpt
@@ -10,8 +10,8 @@ dom
try {
$attr = new DOMAttr();
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMAttr::__construct() expects at least 1 argument, 0 given
+ArgumentCountError: DOMAttr::__construct() expects at least 1 argument, 0 given
diff --git a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt
index 50aacf05b9bd..90d5dd474be1 100644
--- a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt
+++ b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt
@@ -10,8 +10,8 @@ dom
try {
$section = new DOMCDataSection();
} catch (TypeError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-DOMCdataSection::__construct() expects exactly 1 argument, 0 given
+ArgumentCountError: DOMCdataSection::__construct() expects exactly 1 argument, 0 given
diff --git a/ext/dom/tests/DOMCharacterData_data_error_002.phpt b/ext/dom/tests/DOMCharacterData_data_error_002.phpt
index 71ef411a5cf8..1794e208fe1c 100644
--- a/ext/dom/tests/DOMCharacterData_data_error_002.phpt
+++ b/ext/dom/tests/DOMCharacterData_data_error_002.phpt
@@ -11,8 +11,8 @@ $character_data = new DOMCharacterData();
try {
print $character_data->data;
} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt b/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
index 071ac52abf2b..a8f879963fc7 100644
--- a/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
+++ b/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
@@ -16,8 +16,8 @@ $root->appendChild($cdata);
try {
$cdata->deleteData(5, 1);
} catch (DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Index Size Error
+DOMException: Index Size Error
diff --git a/ext/dom/tests/DOMCharacterData_length_error_001.phpt b/ext/dom/tests/DOMCharacterData_length_error_001.phpt
index 8f0c66a12e72..b2ef2d4617b6 100644
--- a/ext/dom/tests/DOMCharacterData_length_error_001.phpt
+++ b/ext/dom/tests/DOMCharacterData_length_error_001.phpt
@@ -11,8 +11,8 @@ $character_data = new DOMCharacterData();
try {
print $character_data->length;
} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/DOMComment_construct_error_001.phpt b/ext/dom/tests/DOMComment_construct_error_001.phpt
index 573a493827eb..fb73f5d078c7 100644
--- a/ext/dom/tests/DOMComment_construct_error_001.phpt
+++ b/ext/dom/tests/DOMComment_construct_error_001.phpt
@@ -10,8 +10,8 @@ dom
try {
$comment = new DOMComment("comment1", "comment2");
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMComment::__construct() expects at most 1 argument, 2 given
+ArgumentCountError: DOMComment::__construct() expects at most 1 argument, 2 given
diff --git a/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt b/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt
index 85ff6b7667d3..db37f5ebd3a4 100644
--- a/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt
+++ b/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt
@@ -11,8 +11,8 @@ $fragment = new DOMDocumentFragment();
try {
$fragment->appendXML('crankbait');
} catch (DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-No Modification Allowed Error
+DOMException: No Modification Allowed Error
diff --git a/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt b/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt
index b05e1efc5f07..844d2f6196c3 100644
--- a/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt
@@ -10,8 +10,8 @@ dom
try {
$fragment = new DOMDocumentFragment("root");
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMDocumentFragment::__construct() expects exactly 0 arguments, 1 given
+ArgumentCountError: DOMDocumentFragment::__construct() expects exactly 0 arguments, 1 given
diff --git a/ext/dom/tests/DOMDocumentType_entities_error_001.phpt b/ext/dom/tests/DOMDocumentType_entities_error_001.phpt
index 3385a2f4e092..d8e442439ffa 100644
--- a/ext/dom/tests/DOMDocumentType_entities_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_entities_error_001.phpt
@@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$doctype->entities;
} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt b/ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt
index efd00bc3bb1e..b1836dee8fc7 100644
--- a/ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt
@@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$doctype->internalSubset;
} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/DOMDocumentType_name_error_001.phpt b/ext/dom/tests/DOMDocumentType_name_error_001.phpt
index 7714613a0eff..57a4d4a161b6 100644
--- a/ext/dom/tests/DOMDocumentType_name_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_name_error_001.phpt
@@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$doctype->name;
} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/DOMDocumentType_notations_error_001.phpt b/ext/dom/tests/DOMDocumentType_notations_error_001.phpt
index 9fa1c7510a6e..d1dd22b007c6 100644
--- a/ext/dom/tests/DOMDocumentType_notations_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_notations_error_001.phpt
@@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$notations = $doctype->notations;
} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/DOMDocumentType_publicId_error_001.phpt b/ext/dom/tests/DOMDocumentType_publicId_error_001.phpt
index 1a7fcd3feb42..b3e2f4bc7354 100644
--- a/ext/dom/tests/DOMDocumentType_publicId_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_publicId_error_001.phpt
@@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$publicId = $doctype->publicId;
} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/DOMDocumentType_systemId_error_001.phpt b/ext/dom/tests/DOMDocumentType_systemId_error_001.phpt
index 3d5f7827eaad..0c6af6b3dbf2 100644
--- a/ext/dom/tests/DOMDocumentType_systemId_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_systemId_error_001.phpt
@@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$systemId = $doctype->systemId;
} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/DOMDocument_adoptNode.phpt b/ext/dom/tests/DOMDocument_adoptNode.phpt
index 2382cabd5136..16539fc9bb0f 100644
--- a/ext/dom/tests/DOMDocument_adoptNode.phpt
+++ b/ext/dom/tests/DOMDocument_adoptNode.phpt
@@ -21,7 +21,7 @@ echo "-- Trying to append child from other document --\n";
try {
$doc2->firstChild->appendChild($b_tag_element); // Should fail because it's another document
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "-- Adopting --\n";
@@ -48,7 +48,7 @@ echo "-- Adopt a document (strict error on) --\n";
try {
$doc1->adoptNode($doc1);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "-- Adopt a document (strict error off) --\n";
@@ -57,7 +57,7 @@ $doc1->strictErrorChecking = false;
try {
$doc1->adoptNode($doc1);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$doc1->strictErrorChecking = true;
@@ -117,7 +117,7 @@ var_dump($child->nodeName);
bool(true)
bool(false)
-- Trying to append child from other document --
-Wrong Document Error
+DOMException: Wrong Document Error
-- Adopting --
string(3) "hix"
string(35) "
@@ -138,7 +138,7 @@ string(27) "
"
-- Adopt a document (strict error on) --
-Not Supported Error
+DOMException: Not Supported Error
-- Adopt a document (strict error off) --
Warning: DOMDocument::adoptNode(): Not Supported Error in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_createEntityReference_error1.phpt b/ext/dom/tests/DOMDocument_createEntityReference_error1.phpt
index 381dd3d5557f..376687f4846a 100644
--- a/ext/dom/tests/DOMDocument_createEntityReference_error1.phpt
+++ b/ext/dom/tests/DOMDocument_createEntityReference_error1.phpt
@@ -10,9 +10,9 @@ try {
$objDoc->createEntityReference('!');
} catch (DOMException $e) {
var_dump($e->getCode() === DOM_INVALID_CHARACTER_ERR);
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
bool(true)
-Invalid Character Error
+DOMException: Invalid Character Error
diff --git a/ext/dom/tests/DOMDocument_encoding_basic.phpt b/ext/dom/tests/DOMDocument_encoding_basic.phpt
index 8d7f11e1cc2a..42aa4f975e63 100644
--- a/ext/dom/tests/DOMDocument_encoding_basic.phpt
+++ b/ext/dom/tests/DOMDocument_encoding_basic.phpt
@@ -25,7 +25,7 @@ try {
$ret = $dom->encoding = 'NYPHP DOMinatrix';
echo "Adding invalid encoding: $ret\n";
} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
$ret = $dom->encoding = 'ISO-8859-1';
@@ -44,7 +44,7 @@ echo "UTF-16 Encoding Read: {$dom->encoding}\n";
?>
--EXPECT--
Empty Encoding Read: ''
-Invalid document encoding
+ValueError: Invalid document encoding
Adding ISO-8859-1 encoding: ISO-8859-1
ISO-8859-1 Encoding Read: ISO-8859-1
Adding UTF-8 encoding: UTF-8
diff --git a/ext/dom/tests/DOMDocument_loadHTML_error2.phpt b/ext/dom/tests/DOMDocument_loadHTML_error2.phpt
index 6886240e595b..b11d3ea0a2fc 100644
--- a/ext/dom/tests/DOMDocument_loadHTML_error2.phpt
+++ b/ext/dom/tests/DOMDocument_loadHTML_error2.phpt
@@ -10,8 +10,8 @@ $doc = new DOMDocument();
try {
$doc->loadHTML('');
} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMDocument::loadHTML(): Argument #1 ($source) must not be empty
+ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty
diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt
index a5ef58a65656..9db9be91c246 100644
--- a/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt
+++ b/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt
@@ -12,16 +12,16 @@ $doc = new DOMDocument();
try {
$result = $doc->loadHTMLFile("");
} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$doc = new DOMDocument();
try {
$result = $doc->loadHTMLFile("text.html\0something");
} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not be empty
-DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not contain any null bytes
+ValueError: DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not be empty
+ValueError: DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not contain any null bytes
diff --git a/ext/dom/tests/DOMDocument_loadXML_error6.phpt b/ext/dom/tests/DOMDocument_loadXML_error6.phpt
index 748a8eb5dc1d..caac2fcedbb2 100644
--- a/ext/dom/tests/DOMDocument_loadXML_error6.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_error6.phpt
@@ -9,8 +9,8 @@ $dom = new DOMDocument();
try {
$dom->loadXML("");
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-DOMDocument::loadXML(): Argument #1 ($source) must not be empty
+ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty
diff --git a/ext/dom/tests/DOMDocument_load_error6.phpt b/ext/dom/tests/DOMDocument_load_error6.phpt
index a4f9bc4a02a8..23606a37599c 100644
--- a/ext/dom/tests/DOMDocument_load_error6.phpt
+++ b/ext/dom/tests/DOMDocument_load_error6.phpt
@@ -9,19 +9,19 @@ $dom = new DOMDocument();
try {
$dom->load("");
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
$dom->load("/path/with/\0/byte");
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
// Path is too long
var_dump($dom->load(str_repeat(" ", PHP_MAXPATHLEN + 1)));
?>
--EXPECT--
-DOMDocument::load(): Argument #1 ($filename) must not be empty
-DOMDocument::load(): Argument #1 ($filename) must not contain any null bytes
+ValueError: DOMDocument::load(): Argument #1 ($filename) must not be empty
+ValueError: DOMDocument::load(): Argument #1 ($filename) must not contain any null bytes
bool(false)
diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
index 248ed48345ad..080c03b6d57b 100644
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
@@ -10,8 +10,8 @@ dom
try {
DOMDocument::saveHTMLFile();
} catch (Error $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Non-static method DOMDocument::saveHTMLFile() cannot be called statically
+Error: Non-static method DOMDocument::saveHTMLFile() cannot be called statically
diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt
index 8dc89f253012..e915ff1b1a36 100644
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt
@@ -20,8 +20,8 @@ $text = $title->appendChild($text);
try {
$doc->saveHTMLFile($filename);
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-DOMDocument::saveHTMLFile(): Argument #1 ($filename) must not be empty
+ValueError: DOMDocument::saveHTMLFile(): Argument #1 ($filename) must not be empty
diff --git a/ext/dom/tests/DOMDocument_saveHTML_error2.phpt b/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
index 5e6fd0987108..2b8b37ddbbde 100644
--- a/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
@@ -10,8 +10,8 @@ dom
try {
DOMDocument::saveHTML(true);
} catch (Error $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Non-static method DOMDocument::saveHTML() cannot be called statically
+Error: Non-static method DOMDocument::saveHTML() cannot be called statically
diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt
index ec295a55e339..ee0fce546444 100644
--- a/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt
@@ -15,9 +15,9 @@ $doc->load(__DIR__."/book.xml");
try {
$doc->schemaValidateSource('');
} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMDocument::schemaValidateSource(): Argument #1 ($source) must not be empty
+ValueError: DOMDocument::schemaValidateSource(): Argument #1 ($source) must not be empty
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt
index 274463e62e13..eb920a8674bc 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt
@@ -15,9 +15,9 @@ $doc->load(__DIR__."/book.xml");
try {
$doc->schemaValidate('');
} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMDocument::schemaValidate(): Argument #1 ($filename) must not be empty
+ValueError: DOMDocument::schemaValidate(): Argument #1 ($filename) must not be empty
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error6.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error6.phpt
index c5d99b20a3fe..bddf14bad3ec 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_error6.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_error6.phpt
@@ -12,14 +12,14 @@ $doc->load(__DIR__."/book.xml");
try {
$doc->schemaValidate("/path/with/\0/byte");
} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($doc->schemaValidate(str_repeat(" ", PHP_MAXPATHLEN + 1)));
?>
--EXPECTF--
-DOMDocument::schemaValidate(): Argument #1 ($filename) must not contain any null bytes
+ValueError: DOMDocument::schemaValidate(): Argument #1 ($filename) must not contain any null bytes
Warning: DOMDocument::schemaValidate(): Invalid Schema file source in %s on line %d
bool(false)
diff --git a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
index b44d6395c309..bdcfc7f11f57 100644
--- a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
+++ b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
@@ -21,7 +21,7 @@ try {
$attr = $doc->createAttribute(0);
} catch (DOMException $e) {
echo "GOOD. DOMException thrown\n";
- echo $e->getMessage() ."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
} catch (Exception $e) {
echo "OOPS. Other exception thrown\n";
}
@@ -38,7 +38,7 @@ try {
$attr = $doc->createAttribute(0);
} catch (DOMException $e) {
echo "OOPS. DOMException thrown\n";
- echo $e->getMessage() ."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
} catch (Exception $e) {
echo "OOPS. Other exception thrown\n";
}
@@ -50,7 +50,7 @@ See if strictErrorChecking is on
bool(true)
Should throw DOMException when strictErrorChecking is on
GOOD. DOMException thrown
-Invalid Character Error
+DOMException: Invalid Character Error
Turn strictErrorChecking off
See if strictErrorChecking is off
bool(false)
diff --git a/ext/dom/tests/DOMDocument_validate_error2.phpt b/ext/dom/tests/DOMDocument_validate_error2.phpt
index ccf59ddaebea..1e508253574b 100644
--- a/ext/dom/tests/DOMDocument_validate_error2.phpt
+++ b/ext/dom/tests/DOMDocument_validate_error2.phpt
@@ -10,8 +10,8 @@ dom
try {
DOMDocument::validate();
} catch (Error $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Non-static method DOMDocument::validate() cannot be called statically
+Error: Non-static method DOMDocument::validate() cannot be called statically
diff --git a/ext/dom/tests/DOMDocument_version_write.phpt b/ext/dom/tests/DOMDocument_version_write.phpt
index 3f594cb7e4b8..72cf26cb3c9d 100644
--- a/ext/dom/tests/DOMDocument_version_write.phpt
+++ b/ext/dom/tests/DOMDocument_version_write.phpt
@@ -19,7 +19,7 @@ echo $dom->saveXML();
try {
$dom->version = new MyThrowingStringable;
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->version);
echo $dom->saveXML();
@@ -28,6 +28,6 @@ echo $dom->saveXML();
string(3) "1.0"
string(6) "foobar"
-An exception was thrown
+Exception: An exception was thrown
string(6) "foobar"
diff --git a/ext/dom/tests/DOMElement_append_hierarchy_test.phpt b/ext/dom/tests/DOMElement_append_hierarchy_test.phpt
index 63583c05bf53..f24d88cdfb84 100644
--- a/ext/dom/tests/DOMElement_append_hierarchy_test.phpt
+++ b/ext/dom/tests/DOMElement_append_hierarchy_test.phpt
@@ -42,7 +42,7 @@ $b_hello = $dom->firstChild->firstChild;
try {
$b_hello->append($b_hello);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveHTML());
@@ -52,7 +52,7 @@ $b_hello = $dom->firstChild->firstChild;
try {
$b_hello->append($b_hello, "foo");
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveHTML());
@@ -63,7 +63,7 @@ $b_world = $b_hello->nextSibling;
try {
$b_world->firstChild->append($b_world);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveHTML());
@@ -74,7 +74,7 @@ $dom2->loadXML('other
');
try {
$dom->firstChild->firstChild->prepend($dom2->firstChild);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom2->saveHTML());
var_dump($dom->saveHTML());
@@ -94,19 +94,19 @@ string(42) "helloworldfoo
string(39) "worldhello
"
-- Append hello with itself --
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
string(39) "helloworld
"
-- Append hello with itself and text --
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
string(27) "world
"
-- Append world's i tag with the parent --
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
string(39) "helloworld
"
-- Append from another document --
-Wrong Document Error
+DOMException: Wrong Document Error
string(13) "other
"
string(39) "helloworld
diff --git a/ext/dom/tests/DOMElement_className.phpt b/ext/dom/tests/DOMElement_className.phpt
index fb19f0e23021..184726e1f4ed 100644
--- a/ext/dom/tests/DOMElement_className.phpt
+++ b/ext/dom/tests/DOMElement_className.phpt
@@ -28,7 +28,7 @@ var_dump($dom->documentElement->className);
try {
$dom->documentElement->className = new MyStringable();
} catch (Throwable $e) {
- echo "Error: ", $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->documentElement->className);
echo $dom->saveXML();
@@ -41,7 +41,7 @@ string(0) ""
string(2) "é"
string(0) ""
string(5) "12345"
-Error: foo
+Exception: foo
string(5) "12345"
diff --git a/ext/dom/tests/DOMElement_id.phpt b/ext/dom/tests/DOMElement_id.phpt
index b406e3b43231..b810ba0fdb78 100644
--- a/ext/dom/tests/DOMElement_id.phpt
+++ b/ext/dom/tests/DOMElement_id.phpt
@@ -29,7 +29,7 @@ var_dump($div->id);
try {
$div->id = new MyStringable();
} catch (Throwable $e) {
- echo "Error: ", $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($div->id);
echo $dom->saveXML();
@@ -44,7 +44,7 @@ string(0) ""
string(2) "é"
string(0) ""
string(5) "12345"
-Error: foo
+Exception: foo
string(5) "12345"
diff --git a/ext/dom/tests/DOMElement_insertAdjacentElement.phpt b/ext/dom/tests/DOMElement_insertAdjacentElement.phpt
index 1e1eb1efecec..951dbfd945e2 100644
--- a/ext/dom/tests/DOMElement_insertAdjacentElement.phpt
+++ b/ext/dom/tests/DOMElement_insertAdjacentElement.phpt
@@ -18,7 +18,7 @@ var_dump($dom->createElement('free')->insertAdjacentElement("afterend", $dom->cr
try {
var_dump($dom->createElement('free')->insertAdjacentElement("bogus", $dom->createElement('element')));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Hierarchy test ---\n";
@@ -29,7 +29,7 @@ foreach (['beforebegin', 'afterbegin', 'beforeend', 'afterend'] as $where) {
try {
var_dump($child->insertAdjacentElement($where, $element)->tagName);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -84,12 +84,12 @@ echo $dom2->saveXML();
--- Edge cases ---
NULL
NULL
-Syntax Error
+DOMException: Syntax Error
--- Hierarchy test ---
-Hierarchy Request Error
-Hierarchy Request Error
-Hierarchy Request Error
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
--- Normal cases uppercase ---
string(1) "A"
diff --git a/ext/dom/tests/DOMElement_insertAdjacentText.phpt b/ext/dom/tests/DOMElement_insertAdjacentText.phpt
index 937f35f47acb..683df4f0b4ac 100644
--- a/ext/dom/tests/DOMElement_insertAdjacentText.phpt
+++ b/ext/dom/tests/DOMElement_insertAdjacentText.phpt
@@ -13,7 +13,7 @@ echo "--- Edge cases ---\n";
try {
$dom->createElement('free')->insertAdjacentText("bogus", "bogus");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
function testNormalCases($dom, $uppercase) {
@@ -56,7 +56,7 @@ var_dump($AText->textContent);
?>
--EXPECT--
--- Edge cases ---
-Syntax Error
+DOMException: Syntax Error
--- Normal cases uppercase ---
Afoo
diff --git a/ext/dom/tests/DOMElement_prefix_empty.phpt b/ext/dom/tests/DOMElement_prefix_empty.phpt
index 8cd3515889e9..c62146fc723f 100644
--- a/ext/dom/tests/DOMElement_prefix_empty.phpt
+++ b/ext/dom/tests/DOMElement_prefix_empty.phpt
@@ -30,7 +30,7 @@ echo "--- Changing the prefix to that of a conflicting namespace (\"conflict\")
try {
$container->prefix = "conflict";
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveXML();
@@ -46,6 +46,6 @@ echo $dom->saveXML();
--- Changing the prefix to that of a conflicting namespace ("conflict") ---
-Namespace Error
+DOMException: Namespace Error
diff --git a/ext/dom/tests/DOMElement_prepend_hierarchy_test.phpt b/ext/dom/tests/DOMElement_prepend_hierarchy_test.phpt
index b1a9910e0ee1..17010f3f8c85 100644
--- a/ext/dom/tests/DOMElement_prepend_hierarchy_test.phpt
+++ b/ext/dom/tests/DOMElement_prepend_hierarchy_test.phpt
@@ -49,7 +49,7 @@ $b_hello = $dom->firstChild->firstChild;
try {
$b_hello->prepend($b_hello);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveHTML());
@@ -59,7 +59,7 @@ $b_hello = $dom->firstChild->firstChild;
try {
$b_hello->prepend($b_hello, "foo");
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveHTML());
@@ -70,7 +70,7 @@ $b_world = $b_hello->nextSibling;
try {
$b_world->firstChild->prepend($b_world);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveHTML());
@@ -81,7 +81,7 @@ $dom2->loadXML('other
');
try {
$dom->firstChild->firstChild->prepend($dom2->firstChild);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom2->saveHTML());
var_dump($dom->saveHTML());
@@ -104,19 +104,19 @@ string(39) "helloworld
string(42) "hellofooworld
"
-- Prepend hello with itself --
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
string(39) "helloworld
"
-- Prepend hello with itself and text --
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
string(27) "world
"
-- Prepend world's i tag with the parent --
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
string(39) "helloworld
"
-- Append from another document --
-Wrong Document Error
+DOMException: Wrong Document Error
string(13) "other
"
string(39) "helloworld
diff --git a/ext/dom/tests/DOMElement_replaceChildren.phpt b/ext/dom/tests/DOMElement_replaceChildren.phpt
index a28d99934183..ab3b578666ff 100644
--- a/ext/dom/tests/DOMElement_replaceChildren.phpt
+++ b/ext/dom/tests/DOMElement_replaceChildren.phpt
@@ -13,13 +13,13 @@ echo "--- Edge cases ---\n";
try {
$dom->documentElement->replaceChildren($dom->documentElement);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->documentElement->firstElementChild->replaceChildren($dom->documentElement);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Normal cases ---\n";
@@ -60,8 +60,8 @@ echo $dom->saveXML();
?>
--EXPECT--
--- Edge cases ---
-Hierarchy Request Error
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
--- Normal cases ---
diff --git a/ext/dom/tests/DOMElement_toggleAttribute.phpt b/ext/dom/tests/DOMElement_toggleAttribute.phpt
index b9e9989e1fe0..8a1c593066a9 100644
--- a/ext/dom/tests/DOMElement_toggleAttribute.phpt
+++ b/ext/dom/tests/DOMElement_toggleAttribute.phpt
@@ -13,7 +13,7 @@ $xml->loadXML('');
try {
var_dump($html->documentElement->toggleAttribute("\0"));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Selected attribute tests (HTML) ---\n";
@@ -88,7 +88,7 @@ var_dump($dom->documentElement->getAttribute('xmlns:anotheron'));
?>
--EXPECTF--
-Invalid Character Error
+DOMException: Invalid Character Error
--- Selected attribute tests (HTML) ---
bool(false)
diff --git a/ext/dom/tests/DOMEntityReference_error1.phpt b/ext/dom/tests/DOMEntityReference_error1.phpt
index 1f805c1dbc80..e955ba179a83 100644
--- a/ext/dom/tests/DOMEntityReference_error1.phpt
+++ b/ext/dom/tests/DOMEntityReference_error1.phpt
@@ -8,9 +8,9 @@ try {
new DOMEntityReference('!');
} catch (DOMException $e) {
var_dump($e->getCode() === DOM_INVALID_CHARACTER_ERR);
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
bool(true)
-Invalid Character Error
+DOMException: Invalid Character Error
diff --git a/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt b/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt
index 30a961143c77..65067d191564 100644
--- a/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt
+++ b/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt
@@ -14,16 +14,16 @@ var_dump($root->attributes->length);
try {
var_dump($root->attributes[-1]);
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$root->attributes[][] = null;
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
int(1)
-must be between 0 and 2147483647
-Cannot access DOMNamedNodeMap without offset
+ValueError: must be between 0 and 2147483647
+Error: Cannot access DOMNamedNodeMap without offset
diff --git a/ext/dom/tests/DOMNode_C14NFile_basic.phpt b/ext/dom/tests/DOMNode_C14NFile_basic.phpt
index fea039d3ca94..26161815d1fb 100644
--- a/ext/dom/tests/DOMNode_C14NFile_basic.phpt
+++ b/ext/dom/tests/DOMNode_C14NFile_basic.phpt
@@ -28,12 +28,12 @@ var_dump($content);
try {
var_dump($node->C14NFile($output, false, false, []));
} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump($node->C14NFile($output, false, false, ['query' => []]));
} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--CLEAN--
@@ -44,5 +44,5 @@ unlink($output);
--EXPECT--
int(34)
string(34) "The Grapes of Wrath"
-DOMNode::C14NFile(): Argument #4 ($xpath) must have a "query" key
-DOMNode::C14NFile(): Argument #4 ($xpath) "query" option must be a string, array given
+ValueError: DOMNode::C14NFile(): Argument #4 ($xpath) must have a "query" key
+TypeError: DOMNode::C14NFile(): Argument #4 ($xpath) "query" option must be a string, array given
diff --git a/ext/dom/tests/DOMNode_C14N_basic.phpt b/ext/dom/tests/DOMNode_C14N_basic.phpt
index f936f9faa9a6..94488bf8a4dc 100644
--- a/ext/dom/tests/DOMNode_C14N_basic.phpt
+++ b/ext/dom/tests/DOMNode_C14N_basic.phpt
@@ -26,15 +26,15 @@ var_dump($node->C14N());
try {
var_dump($node->C14N(false, false, []));
} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump($node->C14N(false, false, ['query' => []]));
} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
string(34) "The Grapes of Wrath"
-DOMNode::C14N(): Argument #3 ($xpath) must have a "query" key
-DOMNode::C14N(): Argument #3 ($xpath) "query" option must be a string, array given
+ValueError: DOMNode::C14N(): Argument #3 ($xpath) must have a "query" key
+TypeError: DOMNode::C14N(): Argument #3 ($xpath) "query" option must be a string, array given
diff --git a/ext/dom/tests/DOMNode_contains.phpt b/ext/dom/tests/DOMNode_contains.phpt
index 5c18963804cf..dcefe06e85db 100644
--- a/ext/dom/tests/DOMNode_contains.phpt
+++ b/ext/dom/tests/DOMNode_contains.phpt
@@ -35,7 +35,7 @@ var_dump($dom->documentElement->contains(null));
try {
var_dump($dom->contains(new stdClass));
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- True cases ---\n";
@@ -78,7 +78,7 @@ var_dump($dom->contains($main));
--EXPECT--
--- False edge cases ---
bool(false)
-DOMNode::contains(): Argument #1 ($other) must be of type DOMNode|DOMNameSpaceNode|null, stdClass given
+TypeError: DOMNode::contains(): Argument #1 ($other) must be of type DOMNode|DOMNameSpaceNode|null, stdClass given
--- True cases ---
bool(true)
bool(true)
diff --git a/ext/dom/tests/DOMNode_insertBefore_error1.phpt b/ext/dom/tests/DOMNode_insertBefore_error1.phpt
index 9b42ef46c9ef..df194bf1fb2e 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error1.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error1.phpt
@@ -16,9 +16,9 @@ $node_in_doc2 = $doc2->createElement("bar");
try {
$node_in_doc2->insertBefore($node_in_doc1);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Wrong Document Error
+DOMException: Wrong Document Error
diff --git a/ext/dom/tests/DOMNode_insertBefore_error2.phpt b/ext/dom/tests/DOMNode_insertBefore_error2.phpt
index 317eb897919e..d74f4b09bc33 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error2.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error2.phpt
@@ -28,9 +28,9 @@ $ref_node = $dom->getElementsByTagName("book")->item(1);
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Not Found Error
+DOMException: Not Found Error
diff --git a/ext/dom/tests/DOMNode_insertBefore_error3.phpt b/ext/dom/tests/DOMNode_insertBefore_error3.phpt
index 9fa25e3b2acd..1ff00f0d86ae 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error3.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error3.phpt
@@ -29,9 +29,9 @@ assert(!is_null($ref_node));
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Not Found Error
+DOMException: Not Found Error
diff --git a/ext/dom/tests/DOMNode_insertBefore_error4.phpt b/ext/dom/tests/DOMNode_insertBefore_error4.phpt
index 41838bb78a1e..d6a21b29cce5 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error4.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error4.phpt
@@ -28,9 +28,9 @@ $ref_node = $dom->createElement('newnode2');
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Not Found Error
+DOMException: Not Found Error
diff --git a/ext/dom/tests/DOMNode_insertBefore_error5.phpt b/ext/dom/tests/DOMNode_insertBefore_error5.phpt
index 17ac53820662..95e95808890a 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error5.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error5.phpt
@@ -30,9 +30,9 @@ $dom->saveXML();
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Not Found Error
+DOMException: Not Found Error
diff --git a/ext/dom/tests/DOMNode_insertBefore_error6.phpt b/ext/dom/tests/DOMNode_insertBefore_error6.phpt
index a8348791f175..81ddd7202a13 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error6.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error6.phpt
@@ -25,9 +25,9 @@ assert($new_node !== false);
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Not Found Error
+DOMException: Not Found Error
diff --git a/ext/dom/tests/DOMNode_removeChild_error1.phpt b/ext/dom/tests/DOMNode_removeChild_error1.phpt
index 05d3c31624f9..401d87f5c299 100644
--- a/ext/dom/tests/DOMNode_removeChild_error1.phpt
+++ b/ext/dom/tests/DOMNode_removeChild_error1.phpt
@@ -14,7 +14,7 @@ $parent->appendChild($child2);
try {
$parent->removeChild($child1);
} catch (DOMException $e) {
- echo "DOMException: " . $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
diff --git a/ext/dom/tests/DOMNode_replaceChild_error1.phpt b/ext/dom/tests/DOMNode_replaceChild_error1.phpt
index f276fc8d207e..be7d72066d0b 100644
--- a/ext/dom/tests/DOMNode_replaceChild_error1.phpt
+++ b/ext/dom/tests/DOMNode_replaceChild_error1.phpt
@@ -15,7 +15,7 @@ $parent->appendChild($child2);
try {
$parent->replaceChild($child3, $child1);
} catch (DOMException $e) {
- echo "DOMException: " . $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
diff --git a/ext/dom/tests/DOMNode_replaceChild_error2.phpt b/ext/dom/tests/DOMNode_replaceChild_error2.phpt
index 160838a537d1..07450944f4a0 100644
--- a/ext/dom/tests/DOMNode_replaceChild_error2.phpt
+++ b/ext/dom/tests/DOMNode_replaceChild_error2.phpt
@@ -13,7 +13,7 @@ $b->appendChild($c);
try {
$b->replaceChild($a, $c);
} catch (DOMException $e) {
- echo "DOMException: " . $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
diff --git a/ext/dom/tests/DOMProcessingInstruction.phpt b/ext/dom/tests/DOMProcessingInstruction.phpt
index ca79e31966ef..a884ecbbcfb3 100644
--- a/ext/dom/tests/DOMProcessingInstruction.phpt
+++ b/ext/dom/tests/DOMProcessingInstruction.phpt
@@ -16,7 +16,7 @@ echo "--- Test construction ---\n";
try {
$pi = new DOMProcessingInstruction("\0");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$pi = new DOMProcessingInstruction("test");
@@ -30,7 +30,7 @@ var_dump($pi->data);
try {
$pi->data = new FailingStringable;
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($pi->data);
$pi->data = 12345;
@@ -53,28 +53,28 @@ $instance = $class->newInstanceWithoutConstructor();
try {
var_dump($instance->target);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($instance->data);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$instance->data = "hello";
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
--- Test construction ---
-Invalid Character Error
+DOMException: Invalid Character Error
--- Test fields ---
string(4) "test"
string(0) ""
string(2) "ok"
-failed in __toString
+Exception: failed in __toString
string(2) "ok"
string(5) "12345"
string(10) "my data <>"
@@ -82,6 +82,6 @@ string(10) "my data <>"
?>
--- Test construction with __construct by reflection and fields ---
-Invalid State Error
-Invalid State Error
-Invalid State Error
+DOMException: Invalid State Error
+DOMException: Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/DOMXPath_callables.phpt b/ext/dom/tests/DOMXPath_callables.phpt
index 3d20527475da..6cb156a1e273 100644
--- a/ext/dom/tests/DOMXPath_callables.phpt
+++ b/ext/dom/tests/DOMXPath_callables.phpt
@@ -31,7 +31,7 @@ $xpath->registerNamespace("php", "http://php.net/xpath");
try {
$xpath->evaluate("//a[php:function('var_dump', string(@href))]");
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Legit cases: all ---\n";
@@ -55,7 +55,7 @@ $xpath->evaluate("//a[php:function('var_dump', string(@href))]");
try {
$xpath->evaluate("//a[php:function('notinset', string(@href))]");
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Legit cases: set with cycle ---\n";
@@ -73,7 +73,7 @@ $xpath->evaluate("//a[php:function('var_dump', string(@href))]");
?>
--EXPECT--
--- Legit cases: none ---
-No callbacks were registered
+Error: No callbacks were registered
--- Legit cases: all ---
string(15) "https://php.net"
string(15) "https://php.net"
@@ -81,7 +81,7 @@ string(15) "https://php.net"
string(15) "https://php.net"
string(15) "https://php.net"
string(15) "https://php.net"
-No callback handler "notinset" registered
+Error: No callback handler "notinset" registered
--- Legit cases: set with cycle ---
dummy: https://php.net
--- Legit cases: reset to null ---
diff --git a/ext/dom/tests/DOMXPath_callables_errors.phpt b/ext/dom/tests/DOMXPath_callables_errors.phpt
index 10019474e7e7..ef2a26c4802d 100644
--- a/ext/dom/tests/DOMXPath_callables_errors.phpt
+++ b/ext/dom/tests/DOMXPath_callables_errors.phpt
@@ -12,49 +12,49 @@ $xpath = new DOMXPath($doc);
try {
$xpath->registerPhpFunctions("nonexistent");
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctions(function () {});
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctions([function () {}]);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctions([var_dump(...)]);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctions(["nonexistent"]);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctions(["" => var_dump(...)]);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctions(["\0" => var_dump(...)]);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctions("");
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$x = new class {
@@ -67,17 +67,17 @@ try {
$str = str_repeat($classes[count($classes) - 1] . '::dump', random_int(1, 1));
$xpath->registerPhpFunctions([$str]);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a callable, function "nonexistent" not found or invalid function name
-DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be of type array|string|null, Closure given
-Object of class Closure could not be converted to string
-Object of class Closure could not be converted to string
-DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array with valid callbacks as values, function "nonexistent" not found or invalid function name
-DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
-DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
-DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a valid callback name
-DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
+TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a callable, function "nonexistent" not found or invalid function name
+TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be of type array|string|null, Closure given
+Error: Object of class Closure could not be converted to string
+Error: Object of class Closure could not be converted to string
+TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array with valid callbacks as values, function "nonexistent" not found or invalid function name
+ValueError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
+ValueError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
+ValueError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a valid callback name
+ValueError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
diff --git a/ext/dom/tests/DOMXPath_clone.phpt b/ext/dom/tests/DOMXPath_clone.phpt
index 99cf1d4e08ca..f4cb7c0e5d75 100644
--- a/ext/dom/tests/DOMXPath_clone.phpt
+++ b/ext/dom/tests/DOMXPath_clone.phpt
@@ -14,9 +14,9 @@ $xpath = new DOMXPath($dom);
try {
clone $xpath;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Trying to clone an uncloneable object of class DOMXPath
+Error: Trying to clone an uncloneable object of class DOMXPath
diff --git a/ext/dom/tests/bug44648.phpt b/ext/dom/tests/bug44648.phpt
index 9dca0c9d70fb..86bee20eba2b 100644
--- a/ext/dom/tests/bug44648.phpt
+++ b/ext/dom/tests/bug44648.phpt
@@ -14,32 +14,32 @@ try {
$attr = new DOMAttr('@acb', '123');
$root->setAttributeNode($attr);
} catch (DOMException $e) {
- echo $e->getMessage()."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$root->setAttribute('@def', '456');
} catch (DOMException $e) {
- echo $e->getMessage()."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$root->setAttributeNS(NULL, '@ghi', '789');
} catch (DOMException $e) {
- echo $e->getMessage()."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$root->setAttributeNS('urn::test', 'a:g@hi', '789');
} catch (DOMException $e) {
- echo $e->getMessage()."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $doc->saveXML($root);
?>
--EXPECT--
-Invalid Character Error
-Invalid Character Error
-Invalid Character Error
-Namespace Error
+DOMException: Invalid Character Error
+DOMException: Invalid Character Error
+DOMException: Invalid Character Error
+DOMException: Namespace Error
diff --git a/ext/dom/tests/bug47430.phpt b/ext/dom/tests/bug47430.phpt
index f2428f73d3d5..a692c76b8c81 100644
--- a/ext/dom/tests/bug47430.phpt
+++ b/ext/dom/tests/bug47430.phpt
@@ -14,7 +14,7 @@ foreach ($elements as $i) {
try {
$i->previousSibling->nodeValue = '';
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -25,8 +25,8 @@ print_r($arr);
?>
--EXPECT--
-Attempt to assign property "nodeValue" on null
-Attempt to assign property "nodeValue" on null
+Error: Attempt to assign property "nodeValue" on null
+Error: Attempt to assign property "nodeValue" on null
Array
(
[0] => Value
diff --git a/ext/dom/tests/bug66783.phpt b/ext/dom/tests/bug66783.phpt
index a9feba9529a3..c760846f5389 100644
--- a/ext/dom/tests/bug66783.phpt
+++ b/ext/dom/tests/bug66783.phpt
@@ -10,8 +10,8 @@ $e = $doc->createElement('e');
try {
$e->appendChild($doc);
} catch (DOMException $ex) {
- echo $ex->getMessage(), PHP_EOL;
+ echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
diff --git a/ext/dom/tests/bug67949.phpt b/ext/dom/tests/bug67949.phpt
index f087633bdfe6..4dd70608ad37 100644
--- a/ext/dom/tests/bug67949.phpt
+++ b/ext/dom/tests/bug67949.phpt
@@ -46,7 +46,7 @@ echo "--- testing read_dimension with null offset ---\n";
try {
var_dump($nodes[][] = 1);
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- testing attribute access ---\n";
@@ -87,7 +87,7 @@ Warning: Attempt to read property "textContent" on null in %s on line %d
bool(false)
NULL
--- testing read_dimension with null offset ---
-Cannot access DOMNodeList without offset
+Error: Cannot access DOMNodeList without offset
--- testing attribute access ---
string(4) "href"
==DONE==
diff --git a/ext/dom/tests/bug77569.phpt b/ext/dom/tests/bug77569.phpt
index 68e6e87a04d4..9580fe79745d 100644
--- a/ext/dom/tests/bug77569.phpt
+++ b/ext/dom/tests/bug77569.phpt
@@ -9,8 +9,8 @@ $dom = $imp->createDocument("", "");
try {
$dom->encoding = null;
} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Invalid document encoding
+ValueError: Invalid document encoding
diff --git a/ext/dom/tests/c14n_no_nodeset_returned.phpt b/ext/dom/tests/c14n_no_nodeset_returned.phpt
index 66efd8ba2b46..0643416d1ccc 100644
--- a/ext/dom/tests/c14n_no_nodeset_returned.phpt
+++ b/ext/dom/tests/c14n_no_nodeset_returned.phpt
@@ -9,8 +9,8 @@ $dom->loadXML('test');
try {
$dom->documentElement->C14N(true, false, ['query' => 'string(./root/text())']);
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-XPath query did not return a nodeset
+Error: XPath query did not return a nodeset
diff --git a/ext/dom/tests/clone_list_map_collection.phpt b/ext/dom/tests/clone_list_map_collection.phpt
index 1eb91c46069b..a3b82705dea1 100644
--- a/ext/dom/tests/clone_list_map_collection.phpt
+++ b/ext/dom/tests/clone_list_map_collection.phpt
@@ -10,41 +10,41 @@ $dom->loadXML('');
try {
clone $dom->documentElement->attributes;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
clone $dom->documentElement->childNodes;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$dom = Dom\XMLDocument::createFromString(']>');
try {
clone $dom->documentElement->attributes;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
clone $dom->documentElement->childNodes;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
clone $dom->documentElement->children;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
clone $dom->doctype->entities;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Trying to clone an uncloneable object of class DOMNamedNodeMap
-Trying to clone an uncloneable object of class DOMNodeList
-Trying to clone an uncloneable object of class Dom\NamedNodeMap
-Trying to clone an uncloneable object of class Dom\NodeList
-Trying to clone an uncloneable object of class Dom\HTMLCollection
-Trying to clone an uncloneable object of class Dom\DtdNamedNodeMap
+Error: Trying to clone an uncloneable object of class DOMNamedNodeMap
+Error: Trying to clone an uncloneable object of class DOMNodeList
+Error: Trying to clone an uncloneable object of class Dom\NamedNodeMap
+Error: Trying to clone an uncloneable object of class Dom\NodeList
+Error: Trying to clone an uncloneable object of class Dom\HTMLCollection
+Error: Trying to clone an uncloneable object of class Dom\DtdNamedNodeMap
diff --git a/ext/dom/tests/delayed_freeing/direct_construction.phpt b/ext/dom/tests/delayed_freeing/direct_construction.phpt
index 5162d6740177..6ec7bd72d7ec 100644
--- a/ext/dom/tests/delayed_freeing/direct_construction.phpt
+++ b/ext/dom/tests/delayed_freeing/direct_construction.phpt
@@ -9,12 +9,12 @@ function node_alike_test($test) {
var_dump($test->parentNode);
var_dump($test->nodeValue);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($test->appendChild($test));
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -23,12 +23,12 @@ $test = new DOMCharacterData("test");
try {
var_dump($test->textContent);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($test->appendData('test'));
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "-- Test DOMCdataSection --\n";
@@ -42,12 +42,12 @@ try {
var_dump($test->wholeText);
var_dump($test->parentNode);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($test->isWhitespaceInElementContent());
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "-- Test DOMComment --\n";
@@ -63,7 +63,7 @@ var_dump($test->parentNode);
try {
var_dump($test->appendChild($test));
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "-- Test DOMNode --\n";
@@ -81,12 +81,12 @@ try {
var_dump($test->nodeValue);
var_dump($test->parentNode);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($test->appendChild($test));
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "-- Test DOMAttr --\n";
@@ -96,13 +96,13 @@ var_dump($test->parentNode);
try {
var_dump($test->appendChild($test));
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-- Test DOMCharacterData --
-Invalid State Error
-Couldn't fetch DOMCharacterData
+DOMException: Invalid State Error
+Error: Couldn't fetch DOMCharacterData
-- Test DOMCdataSection --
string(4) "test"
bool(true)
@@ -117,21 +117,21 @@ int(0)
-- Test DOMElement --
string(4) "test"
NULL
-No Modification Allowed Error
+DOMException: No Modification Allowed Error
-- Test DOMNode --
-Invalid State Error
-Couldn't fetch DOMNode
+DOMException: Invalid State Error
+Error: Couldn't fetch DOMNode
-- Test DOMNotation --
-Invalid State Error
-Couldn't fetch DOMNotation
+DOMException: Invalid State Error
+Error: Couldn't fetch DOMNotation
-- Test DOMProcessingInstruction --
NULL
string(5) "value"
bool(false)
-- Test DOMEntity --
-Invalid State Error
-Couldn't fetch DOMEntity
+DOMException: Invalid State Error
+Error: Couldn't fetch DOMEntity
-- Test DOMAttr --
string(5) "value"
NULL
-No Modification Allowed Error
+DOMException: No Modification Allowed Error
diff --git a/ext/dom/tests/delayed_freeing/without_contructor.phpt b/ext/dom/tests/delayed_freeing/without_contructor.phpt
index 4a5f63ed9acc..22b1c6cd556c 100644
--- a/ext/dom/tests/delayed_freeing/without_contructor.phpt
+++ b/ext/dom/tests/delayed_freeing/without_contructor.phpt
@@ -11,14 +11,14 @@ $node = $rc->newInstanceWithoutConstructor();
try {
var_dump($node);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Call test
try {
$node->removeChild($node);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Import test
@@ -26,13 +26,13 @@ $doc = new DOMDocument;
try {
$doc->appendChild($doc->importNode($node));
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
object(DOMNode)#2 (0) {
}
-Invalid State Error
-Couldn't fetch DOMNode
-Couldn't fetch DOMNode
+DOMException: Invalid State Error
+Error: Couldn't fetch DOMNode
+Error: Couldn't fetch DOMNode
diff --git a/ext/dom/tests/dom_import_simplexml.phpt b/ext/dom/tests/dom_import_simplexml.phpt
index e761bfa66d85..4a1818541305 100644
--- a/ext/dom/tests/dom_import_simplexml.phpt
+++ b/ext/dom/tests/dom_import_simplexml.phpt
@@ -17,7 +17,7 @@ print $dom->ownerDocument->saveXML();
try {
Dom\import_simplexml($s);
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
@@ -32,4 +32,4 @@ try {
John Steinbeck
-Dom\import_simplexml(): Argument #1 ($node) must not be already imported as a DOMNode
+TypeError: Dom\import_simplexml(): Argument #1 ($node) must not be already imported as a DOMNode
diff --git a/ext/dom/tests/dom_xinclude_errors.phpt b/ext/dom/tests/dom_xinclude_errors.phpt
index fe3addf85916..8df006f630c7 100644
--- a/ext/dom/tests/dom_xinclude_errors.phpt
+++ b/ext/dom/tests/dom_xinclude_errors.phpt
@@ -15,9 +15,9 @@ $dom = Dom\XMLDocument::createEmpty();
try {
$dom->xinclude(PHP_INT_MAX);
} catch (ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Warning: DOMDocument::xinclude(): Invalid flags in %s on line %d
-Dom\XMLDocument::xinclude(): Argument #1 ($options) is too large
+ValueError: Dom\XMLDocument::xinclude(): Argument #1 ($options) is too large
diff --git a/ext/dom/tests/domxpath.phpt b/ext/dom/tests/domxpath.phpt
index cead1f8d5b7c..863978fb932c 100644
--- a/ext/dom/tests/domxpath.phpt
+++ b/ext/dom/tests/domxpath.phpt
@@ -55,13 +55,13 @@ try {
$xpath->registerPHPFunctions('non_existent');
$avg = $xpath->evaluate('number(php:function("non_existent", //def:testnode))');
} catch (\Error $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
$xpath->registerPhpFunctions(['non_existant']);
$avg = $xpath->evaluate('number(php:function("non_existent", //def:testnode))');
} catch (\Error $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
@@ -69,5 +69,5 @@ myval
float(1)
bool(true)
float(4)
-DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a callable, function "non_existent" not found or invalid function name
-DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array with valid callbacks as values, function "non_existant" not found or invalid function name
+TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a callable, function "non_existent" not found or invalid function name
+TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array with valid callbacks as values, function "non_existant" not found or invalid function name
diff --git a/ext/dom/tests/entity_reference_stale_02.phpt b/ext/dom/tests/entity_reference_stale_02.phpt
index 9e25a2c0e94a..3127d543e8ac 100644
--- a/ext/dom/tests/entity_reference_stale_02.phpt
+++ b/ext/dom/tests/entity_reference_stale_02.phpt
@@ -27,7 +27,7 @@ unset($decl);
try {
var_dump($iter->current()->publicId);
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
diff --git a/ext/dom/tests/gh11830/attribute_variation.phpt b/ext/dom/tests/gh11830/attribute_variation.phpt
index 34a6f094f58f..30716d67f8bc 100644
--- a/ext/dom/tests/gh11830/attribute_variation.phpt
+++ b/ext/dom/tests/gh11830/attribute_variation.phpt
@@ -15,41 +15,41 @@ XML);
try {
$doc->documentElement->firstElementChild->prepend($doc->documentElement->attributes[0]);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$doc->documentElement->firstElementChild->append($doc->documentElement->attributes[0]);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$doc->documentElement->firstElementChild->before($doc->documentElement->attributes[0]);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$doc->documentElement->firstElementChild->after($doc->documentElement->attributes[0]);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$doc->documentElement->firstElementChild->replaceWith($doc->documentElement->attributes[0]);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $doc->saveXML();
?>
--EXPECT--
-Hierarchy Request Error
-Hierarchy Request Error
-Hierarchy Request Error
-Hierarchy Request Error
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
diff --git a/ext/dom/tests/gh11830/document_variation.phpt b/ext/dom/tests/gh11830/document_variation.phpt
index 1f291b946878..94f054b59287 100644
--- a/ext/dom/tests/gh11830/document_variation.phpt
+++ b/ext/dom/tests/gh11830/document_variation.phpt
@@ -27,7 +27,7 @@ function test($method) {
try {
$doc->documentElement->firstElementChild->$method($testElement, $otherElement);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $otherDoc->saveXML();
@@ -41,7 +41,7 @@ test("after");
test("replaceWith");
?>
--EXPECT--
-Wrong Document Error
+DOMException: Wrong Document Error
@@ -49,7 +49,7 @@ Wrong Document Error
-Wrong Document Error
+DOMException: Wrong Document Error
@@ -57,7 +57,7 @@ Wrong Document Error
-Wrong Document Error
+DOMException: Wrong Document Error
@@ -65,7 +65,7 @@ Wrong Document Error
-Wrong Document Error
+DOMException: Wrong Document Error
@@ -73,7 +73,7 @@ Wrong Document Error
-Wrong Document Error
+DOMException: Wrong Document Error
diff --git a/ext/dom/tests/gh11830/hierarchy_variation.phpt b/ext/dom/tests/gh11830/hierarchy_variation.phpt
index 443068461874..94dacc69d90e 100644
--- a/ext/dom/tests/gh11830/hierarchy_variation.phpt
+++ b/ext/dom/tests/gh11830/hierarchy_variation.phpt
@@ -21,7 +21,7 @@ function test($method) {
try {
$testElement->$method($alone, $container);
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $doc->saveXML();
@@ -34,13 +34,13 @@ test("after");
test("replaceWith");
?>
--EXPECT--
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
diff --git a/ext/dom/tests/gh11830/type_variation.phpt b/ext/dom/tests/gh11830/type_variation.phpt
index 76732775e6db..f00bd96e7aad 100644
--- a/ext/dom/tests/gh11830/type_variation.phpt
+++ b/ext/dom/tests/gh11830/type_variation.phpt
@@ -18,41 +18,41 @@ $testElement = $doc->documentElement->firstElementChild->nextElementSibling->fir
try {
$doc->documentElement->firstElementChild->prepend($testElement, 0);
} catch (\TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$doc->documentElement->firstElementChild->append($testElement, true);
} catch (\TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$doc->documentElement->firstElementChild->before($testElement, null);
} catch (\TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$doc->documentElement->firstElementChild->after($testElement, new stdClass);
} catch (\TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$doc->documentElement->firstElementChild->replaceWith($testElement, []);
} catch (\TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $doc->saveXML();
?>
--EXPECT--
-DOMElement::prepend(): Argument #2 must be of type DOMNode|string, int given
-DOMElement::append(): Argument #2 must be of type DOMNode|string, bool given
-DOMElement::before(): Argument #2 must be of type DOMNode|string, null given
-DOMElement::after(): Argument #2 must be of type DOMNode|string, stdClass given
-DOMElement::replaceWith(): Argument #2 must be of type DOMNode|string, array given
+TypeError: DOMElement::prepend(): Argument #2 must be of type DOMNode|string, int given
+TypeError: DOMElement::append(): Argument #2 must be of type DOMNode|string, bool given
+TypeError: DOMElement::before(): Argument #2 must be of type DOMNode|string, null given
+TypeError: DOMElement::after(): Argument #2 must be of type DOMNode|string, stdClass given
+TypeError: DOMElement::replaceWith(): Argument #2 must be of type DOMNode|string, array given
diff --git a/ext/dom/tests/gh12002.phpt b/ext/dom/tests/gh12002.phpt
index 7d1ae944646a..410953267bfd 100644
--- a/ext/dom/tests/gh12002.phpt
+++ b/ext/dom/tests/gh12002.phpt
@@ -16,7 +16,7 @@ var_dump($dom->encoding);
try {
$dom->encoding = make_nonconst('foobar');
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->encoding);
$dom->encoding = make_nonconst('utf-16le');
@@ -24,15 +24,15 @@ var_dump($dom->encoding);
try {
$dom->encoding = NULL;
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->encoding);
?>
--EXPECT--
string(5) "utf-8"
-Invalid document encoding
+ValueError: Invalid document encoding
string(5) "utf-8"
string(8) "utf-16le"
-Invalid document encoding
+ValueError: Invalid document encoding
string(8) "utf-16le"
diff --git a/ext/dom/tests/gh13960.phpt b/ext/dom/tests/gh13960.phpt
index fae628f49c07..3327a49fd118 100644
--- a/ext/dom/tests/gh13960.phpt
+++ b/ext/dom/tests/gh13960.phpt
@@ -10,8 +10,8 @@ $xp = new DOMXPath($domd);
try {
$xp->query("//foo[contains(text(), " . $xp->quote("tes\x00t") . ")]");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMXPath::quote(): Argument #1 ($str) must not contain any null bytes
+ValueError: DOMXPath::quote(): Argument #1 ($str) must not contain any null bytes
diff --git a/ext/dom/tests/gh15137.phpt b/ext/dom/tests/gh15137.phpt
index c5ce1aca75be..6013cee2a566 100644
--- a/ext/dom/tests/gh15137.phpt
+++ b/ext/dom/tests/gh15137.phpt
@@ -8,4 +8,3 @@ var_dump(new DOMText()->wholeText);
?>
--EXPECT--
string(0) ""
-
diff --git a/ext/dom/tests/gh15910.phpt b/ext/dom/tests/gh15910.phpt
index c9b14a0b8663..e892bd5df789 100644
--- a/ext/dom/tests/gh15910.phpt
+++ b/ext/dom/tests/gh15910.phpt
@@ -11,8 +11,8 @@ $doc->appendChild($doc->createElement('container'));
try {
$doc->documentElement->setAttributeNodeNS($doc);
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMElement::setAttributeNodeNS(): Argument #1 ($attr) must be of type DOMAttr, DOMDocument given
+TypeError: DOMElement::setAttributeNodeNS(): Argument #1 ($attr) must be of type DOMAttr, DOMDocument given
diff --git a/ext/dom/tests/gh16039.phpt b/ext/dom/tests/gh16039.phpt
index 48a862eda7b2..57763cb3719e 100644
--- a/ext/dom/tests/gh16039.phpt
+++ b/ext/dom/tests/gh16039.phpt
@@ -10,22 +10,22 @@ $element = $dom->appendChild($dom->createElement('root'));
try {
$element->prepend('x', new DOMEntity);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveXML();
$dom->strictErrorChecking = false; // Should not have influence
try {
$element->prepend('x', new DOMEntity);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveXML();
?>
--EXPECT--
-Invalid State Error
+DOMException: Invalid State Error
-Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/gh16151.phpt b/ext/dom/tests/gh16151.phpt
index e11d3df4a56b..5528e4640e21 100644
--- a/ext/dom/tests/gh16151.phpt
+++ b/ext/dom/tests/gh16151.phpt
@@ -14,12 +14,12 @@ $element->setAttributeNodeNS($attr);
try {
$attr->insertBefore(new DOMComment("h"));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$attr->appendChild(new DOMComment("h"));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$attr->insertBefore($doc->createEntityReference('amp'));
@@ -29,7 +29,7 @@ echo $doc->saveXML();
?>
--EXPECT--
-Hierarchy Request Error
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
W
diff --git a/ext/dom/tests/gh16190.phpt b/ext/dom/tests/gh16190.phpt
index d3d83b5eb49d..8755e167dcf4 100644
--- a/ext/dom/tests/gh16190.phpt
+++ b/ext/dom/tests/gh16190.phpt
@@ -10,9 +10,9 @@ $rm = new ReflectionMethod($doc, '__construct');
try {
$rm->invoke($doc);
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot directly construct Dom\XMLDocument, use document methods instead
+Error: Cannot directly construct Dom\XMLDocument, use document methods instead
diff --git a/ext/dom/tests/gh16316.phpt b/ext/dom/tests/gh16316.phpt
index 43368746bc46..e75320eb57f8 100644
--- a/ext/dom/tests/gh16316.phpt
+++ b/ext/dom/tests/gh16316.phpt
@@ -13,13 +13,13 @@ $demo = new Demo;
try {
var_dump($demo);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($demo->document);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -28,5 +28,5 @@ object(Demo)#1 (1) {
["registerNodeNamespaces"]=>
bool(true)
}
-Invalid State Error
-Invalid State Error
+DOMException: Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/gh16465.phpt b/ext/dom/tests/gh16465.phpt
index b09f5de7dcc3..a36227891b58 100644
--- a/ext/dom/tests/gh16465.phpt
+++ b/ext/dom/tests/gh16465.phpt
@@ -9,21 +9,21 @@ $v10 = new DOMElement("a");
try {
$v10->getElementsByTagName("text\0something");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$v10->getElementsByTagNameNS("", "text\0something");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$v10->getElementsByTagNameNS("text\0something", "");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMElement::getElementsByTagName(): Argument #1 ($qualifiedName) must not contain any null bytes
-DOMElement::getElementsByTagNameNS(): Argument #2 ($localName) must not contain any null bytes
-DOMElement::getElementsByTagNameNS(): Argument #1 ($namespace) must not contain any null bytes
+ValueError: DOMElement::getElementsByTagName(): Argument #1 ($qualifiedName) must not contain any null bytes
+ValueError: DOMElement::getElementsByTagNameNS(): Argument #2 ($localName) must not contain any null bytes
+ValueError: DOMElement::getElementsByTagNameNS(): Argument #1 ($namespace) must not contain any null bytes
diff --git a/ext/dom/tests/gh16533.phpt b/ext/dom/tests/gh16533.phpt
index dad40e88b4d1..a1fcb1b9bd68 100644
--- a/ext/dom/tests/gh16533.phpt
+++ b/ext/dom/tests/gh16533.phpt
@@ -9,12 +9,12 @@ $doc = new DOMDocument();
try {
$doc->appendChild($doc->createAttribute('foo'));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $doc->saveXML();
?>
--EXPECT--
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
diff --git a/ext/dom/tests/gh16535.phpt b/ext/dom/tests/gh16535.phpt
index adb1dfa91f20..4ea210b9c60f 100644
--- a/ext/dom/tests/gh16535.phpt
+++ b/ext/dom/tests/gh16535.phpt
@@ -12,14 +12,14 @@ $v4 = $v2->createElement('foo');
try {
$v4->appendChild($v2);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$v2->loadHTML("oU
");
echo $v2->saveXML();
?>
--EXPECT--
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
oU
diff --git a/ext/dom/tests/gh16593.phpt b/ext/dom/tests/gh16593.phpt
index 416d794a4f0d..c220dc406018 100644
--- a/ext/dom/tests/gh16593.phpt
+++ b/ext/dom/tests/gh16593.phpt
@@ -11,12 +11,12 @@ $child = $root->appendChild($doc->createElement('child'));
try {
$root->replaceChild($doc->createAttribute('foo'), $child);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $doc->saveXML();
?>
--EXPECT--
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
diff --git a/ext/dom/tests/gh16594.phpt b/ext/dom/tests/gh16594.phpt
index adfde5948eef..c77a85b7f313 100644
--- a/ext/dom/tests/gh16594.phpt
+++ b/ext/dom/tests/gh16594.phpt
@@ -17,9 +17,9 @@ $v7->appendChild($v1);
try {
$v1->before($v6);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
diff --git a/ext/dom/tests/gh16777_1.phpt b/ext/dom/tests/gh16777_1.phpt
index d821842ace4e..9fdcfc7d1840 100644
--- a/ext/dom/tests/gh16777_1.phpt
+++ b/ext/dom/tests/gh16777_1.phpt
@@ -14,11 +14,11 @@ $dom2 = new DOMDocument();
try {
$dom2->appendChild($text);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
my value
my new value
-Wrong Document Error
+DOMException: Wrong Document Error
diff --git a/ext/dom/tests/gh16777_2.phpt b/ext/dom/tests/gh16777_2.phpt
index a6f3a59621b4..4f66c9ff21b9 100644
--- a/ext/dom/tests/gh16777_2.phpt
+++ b/ext/dom/tests/gh16777_2.phpt
@@ -15,7 +15,7 @@ $dom2 = new DOMDocument();
try {
$dom2->appendChild($el);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($child->ownerDocument === $doc);
?>
@@ -23,5 +23,5 @@ var_dump($child->ownerDocument === $doc);
-Wrong Document Error
+DOMException: Wrong Document Error
bool(true)
diff --git a/ext/dom/tests/gh17847.phpt b/ext/dom/tests/gh17847.phpt
index b2c4caff2fc7..59c37174d7ba 100644
--- a/ext/dom/tests/gh17847.phpt
+++ b/ext/dom/tests/gh17847.phpt
@@ -38,15 +38,15 @@ foreach ($garbage as $node) {
try {
var_dump($node->localName);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
?>
--EXPECT--
-Invalid State Error
-Invalid State Error
-Invalid State Error
-Invalid State Error
-Invalid State Error
-Invalid State Error
-Invalid State Error
+DOMException: Invalid State Error
+DOMException: Invalid State Error
+DOMException: Invalid State Error
+DOMException: Invalid State Error
+DOMException: Invalid State Error
+DOMException: Invalid State Error
+DOMException: Invalid State Error
diff --git a/ext/dom/tests/modern/common/template_rename.phpt b/ext/dom/tests/modern/common/template_rename.phpt
index a71126b21f22..d7e7276f0856 100644
--- a/ext/dom/tests/modern/common/template_rename.phpt
+++ b/ext/dom/tests/modern/common/template_rename.phpt
@@ -20,7 +20,7 @@ var_dump($template->innerHTML);
try {
$template->rename($template->namespaceURI, 'screwthis');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// These shouldn't be changed!
@@ -30,6 +30,6 @@ var_dump($template->innerHTML);
?>
--EXPECT--
string(16) "afoo
b"
-It is not possible to rename the template element because it hosts a document fragment
+DOMException: It is not possible to rename the template element because it hosts a document fragment
string(8) "TEMPLATE"
string(16) "afoo
b"
diff --git a/ext/dom/tests/modern/css_selectors/closest_invalid_selector.phpt b/ext/dom/tests/modern/css_selectors/closest_invalid_selector.phpt
index 81db6a72b686..9e7da22c59a5 100644
--- a/ext/dom/tests/modern/css_selectors/closest_invalid_selector.phpt
+++ b/ext/dom/tests/modern/css_selectors/closest_invalid_selector.phpt
@@ -10,9 +10,9 @@ $dom = DOM\XMLDocument::createFromString("");
try {
var_dump($dom->documentElement->closest('@invalid'));
} catch (DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Invalid selector (Selectors. Unexpected token: @invalid)
+DOMException: Invalid selector (Selectors. Unexpected token: @invalid)
diff --git a/ext/dom/tests/modern/css_selectors/combinators.phpt b/ext/dom/tests/modern/css_selectors/combinators.phpt
index b43b07f59e82..b88ee5d2b6c7 100644
--- a/ext/dom/tests/modern/css_selectors/combinators.phpt
+++ b/ext/dom/tests/modern/css_selectors/combinators.phpt
@@ -57,7 +57,7 @@ test_helper($dom, 'article[title].bar p');
try {
test_helper($dom, 'col.selected||td');
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -110,4 +110,4 @@ try {
--- Selector: article[title].bar p ---
Fifth p
--- Selector: col.selected||td ---
-Dom\Document::querySelectorAll(): Argument #1 ($selectors) contains an unsupported selector
+ValueError: Dom\Document::querySelectorAll(): Argument #1 ($selectors) contains an unsupported selector
diff --git a/ext/dom/tests/modern/css_selectors/matches_invalid_selector.phpt b/ext/dom/tests/modern/css_selectors/matches_invalid_selector.phpt
index 11cc4a942d24..6b3af8152cd4 100644
--- a/ext/dom/tests/modern/css_selectors/matches_invalid_selector.phpt
+++ b/ext/dom/tests/modern/css_selectors/matches_invalid_selector.phpt
@@ -10,9 +10,9 @@ $dom = DOM\XMLDocument::createFromString("");
try {
var_dump($dom->documentElement->matches('@invalid'));
} catch (DOMException $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Invalid selector (Selectors. Unexpected token: @invalid)
+DOMException: Invalid selector (Selectors. Unexpected token: @invalid)
diff --git a/ext/dom/tests/modern/css_selectors/pseudo_classes_blank.phpt b/ext/dom/tests/modern/css_selectors/pseudo_classes_blank.phpt
index b1be7db685d4..1fb303d1a9d1 100644
--- a/ext/dom/tests/modern/css_selectors/pseudo_classes_blank.phpt
+++ b/ext/dom/tests/modern/css_selectors/pseudo_classes_blank.phpt
@@ -14,10 +14,10 @@ XML);
try {
test_helper($dom, ':blank');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
--- Selector: :blank ---
-:blank selector is not implemented because CSSWG has not yet decided its semantics (https://github.com/w3c/csswg-drafts/issues/1967)
+DOMException: :blank selector is not implemented because CSSWG has not yet decided its semantics (https://github.com/w3c/csswg-drafts/issues/1967)
diff --git a/ext/dom/tests/modern/extensions/Element_renaming_html_ns_02.phpt b/ext/dom/tests/modern/extensions/Element_renaming_html_ns_02.phpt
index 76bc6fbd0cf4..36e5d05840c1 100644
--- a/ext/dom/tests/modern/extensions/Element_renaming_html_ns_02.phpt
+++ b/ext/dom/tests/modern/extensions/Element_renaming_html_ns_02.phpt
@@ -10,16 +10,16 @@ $el = $dom->createElementNS("http://www.w3.org/1999/xhtml", "foo:bar");
try {
$el->rename("urn:a", "foo:baz");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$el = $dom->createElementNS("urn:a", "foo:bar");
try {
$el->rename("http://www.w3.org/1999/xhtml", "foo:baz");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-It is not possible to move an element out of the HTML namespace because the HTML namespace is tied to the HTMLElement class
-It is not possible to move an element into the HTML namespace because the HTML namespace is tied to the HTMLElement class
+DOMException: It is not possible to move an element out of the HTML namespace because the HTML namespace is tied to the HTMLElement class
+DOMException: It is not possible to move an element into the HTML namespace because the HTML namespace is tied to the HTMLElement class
diff --git a/ext/dom/tests/modern/extensions/attribute_renaming_conflict.phpt b/ext/dom/tests/modern/extensions/attribute_renaming_conflict.phpt
index a63437ebd80d..3c02f370c8f7 100644
--- a/ext/dom/tests/modern/extensions/attribute_renaming_conflict.phpt
+++ b/ext/dom/tests/modern/extensions/attribute_renaming_conflict.phpt
@@ -20,37 +20,37 @@ $root = $dom->documentElement;
try {
$root->attributes[0]->rename(NULL, 'c');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$root->attributes[0]->rename(NULL, 'c');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$root->attributes[1]->rename(NULL, 'a');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$root->attributes[1]->rename('urn:a', 'foo');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$root->attributes[3]->rename('', 'a');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$root->firstElementChild->attributes[0]->rename(NULL, 'hello');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$root->firstElementChild->attributes[1]->rename(NULL, 'my-attr');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// This is here to validate that nothing actually changed
@@ -58,12 +58,12 @@ echo $dom->saveXML();
?>
--EXPECT--
-An attribute with the given name in the given namespace already exists
-An attribute with the given name in the given namespace already exists
-An attribute with the given name in the given namespace already exists
-An attribute with the given name in the given namespace already exists
-An attribute with the given name in the given namespace already exists
-An attribute with the given name in the given namespace already exists
+DOMException: An attribute with the given name in the given namespace already exists
+DOMException: An attribute with the given name in the given namespace already exists
+DOMException: An attribute with the given name in the given namespace already exists
+DOMException: An attribute with the given name in the given namespace already exists
+DOMException: An attribute with the given name in the given namespace already exists
+DOMException: An attribute with the given name in the given namespace already exists
diff --git a/ext/dom/tests/modern/extensions/node_renaming_validation_errors.phpt b/ext/dom/tests/modern/extensions/node_renaming_validation_errors.phpt
index 5f899c8e814d..49d7131f6b37 100644
--- a/ext/dom/tests/modern/extensions/node_renaming_validation_errors.phpt
+++ b/ext/dom/tests/modern/extensions/node_renaming_validation_errors.phpt
@@ -10,20 +10,20 @@ $dom = Dom\XMLDocument::createFromString('');
try {
$dom->documentElement->rename('', 'a:b');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->documentElement->rename('urn:a', 'a:b:c');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveXML();
?>
--EXPECT--
-Namespace Error
-Invalid Character Error
+DOMException: Namespace Error
+DOMException: Invalid Character Error
diff --git a/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromFile_override_encoding.phpt b/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromFile_override_encoding.phpt
index 6b87f1d4714a..bf2dfa3c9397 100644
--- a/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromFile_override_encoding.phpt
+++ b/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromFile_override_encoding.phpt
@@ -8,7 +8,7 @@ dom
try {
Dom\HTMLDocument::createFromFile(__DIR__ . '/gb18030_without_charset.html', overrideEncoding: 'nonexistent');
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// The override encoding matches with the document encoding attribute
@@ -23,7 +23,7 @@ var_dump($dom->charset);
?>
--EXPECT--
-Dom\HTMLDocument::createFromFile(): Argument #3 ($overrideEncoding) must be a valid document encoding
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #3 ($overrideEncoding) must be a valid document encoding
string(20) "
Héllo, world!
"
diff --git a/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromString_override_encoding.phpt b/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromString_override_encoding.phpt
index 75984d6acd97..a71c7c02c5f8 100644
--- a/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromString_override_encoding.phpt
+++ b/ext/dom/tests/modern/html/encoding/HTMLDocument_createFromString_override_encoding.phpt
@@ -8,7 +8,7 @@ dom
try {
Dom\HTMLDocument::createFromString(file_get_contents(__DIR__ . '/gb18030_without_charset.html'), overrideEncoding: 'nonexistent');
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// The override encoding matches with the document encoding attribute
@@ -23,7 +23,7 @@ var_dump($dom->charset);
?>
--EXPECT--
-Dom\HTMLDocument::createFromString(): Argument #3 ($overrideEncoding) must be a valid document encoding
+ValueError: Dom\HTMLDocument::createFromString(): Argument #3 ($overrideEncoding) must be a valid document encoding
string(20) "
Héllo, world!
"
diff --git a/ext/dom/tests/modern/html/encoding/HTMLDocument_encoding_field_test.phpt b/ext/dom/tests/modern/html/encoding/HTMLDocument_encoding_field_test.phpt
index c4417d804108..6610c88ce71e 100644
--- a/ext/dom/tests/modern/html/encoding/HTMLDocument_encoding_field_test.phpt
+++ b/ext/dom/tests/modern/html/encoding/HTMLDocument_encoding_field_test.phpt
@@ -12,7 +12,7 @@ var_dump($dom->characterSet);
try {
$dom->charset = "nope";
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->charset);
$dom->inputEncoding = "Windows-1251";
@@ -20,7 +20,7 @@ var_dump($dom->characterSet);
try {
$dom->charset = "";
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->inputEncoding);
echo $dom->saveHtml();
@@ -28,16 +28,16 @@ echo $dom->saveHtml();
try {
$dom = Dom\HTMLDocument::createEmpty("bogus");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
string(5) "UTF-8"
string(6) "EUC-KR"
-Invalid document encoding
+ValueError: Invalid document encoding
string(6) "EUC-KR"
string(12) "windows-1251"
-Invalid document encoding
+ValueError: Invalid document encoding
string(12) "windows-1251"
-Dom\HTMLDocument::createEmpty(): Argument #1 ($encoding) must be a valid document encoding
+ValueError: Dom\HTMLDocument::createEmpty(): Argument #1 ($encoding) must be a valid document encoding
diff --git a/ext/dom/tests/modern/html/interactions/Document_body_setter_errors.phpt b/ext/dom/tests/modern/html/interactions/Document_body_setter_errors.phpt
index 1f934fcff890..19eeee216037 100644
--- a/ext/dom/tests/modern/html/interactions/Document_body_setter_errors.phpt
+++ b/ext/dom/tests/modern/html/interactions/Document_body_setter_errors.phpt
@@ -12,7 +12,7 @@ function testNormalReplace($cb)
try {
$dom->body = $cb($dom);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->body?->nodeName);
}
@@ -34,7 +34,7 @@ $dom = DOM\XMLDocument::createEmpty();
try {
$dom->body = $dom->createElementNS("http://www.w3.org/1999/xhtml", "body");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->body?->nodeName);
@@ -42,20 +42,20 @@ var_dump($dom->body?->nodeName);
--EXPECT--
--- Set body to NULL ---
string(4) "BODY"
-The new body must either be a body or a frameset tag
+DOMException: The new body must either be a body or a frameset tag
string(4) "BODY"
--- Wrong element tag in right namespace ---
string(4) "BODY"
-The new body must either be a body or a frameset tag
+DOMException: The new body must either be a body or a frameset tag
string(4) "BODY"
--- Right element tag in wrong namespace ---
string(4) "BODY"
-Cannot assign Dom\Element to property Dom\Document::$body of type ?Dom\HTMLElement
+TypeError: Cannot assign Dom\Element to property Dom\Document::$body of type ?Dom\HTMLElement
string(4) "BODY"
--- Right element tag in no namespace ---
string(4) "BODY"
-Cannot assign Dom\Element to property Dom\Document::$body of type ?Dom\HTMLElement
+TypeError: Cannot assign Dom\Element to property Dom\Document::$body of type ?Dom\HTMLElement
string(4) "BODY"
--- Set body without document element ---
-A body can only be set if there is a document element
+DOMException: A body can only be set if there is a document element
NULL
diff --git a/ext/dom/tests/modern/html/interactions/Dom_Element_insertAdjacentHTML_errors.phpt b/ext/dom/tests/modern/html/interactions/Dom_Element_insertAdjacentHTML_errors.phpt
index b8e13ba436b6..9561ad87af2a 100644
--- a/ext/dom/tests/modern/html/interactions/Dom_Element_insertAdjacentHTML_errors.phpt
+++ b/ext/dom/tests/modern/html/interactions/Dom_Element_insertAdjacentHTML_errors.phpt
@@ -13,7 +13,7 @@ echo "--- BeforeBegin no parent ---\n";
try {
$element->insertAdjacentHTML(Dom\AdjacentPosition::BeforeBegin, "test");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- AfterEnd no parent ---\n";
@@ -21,7 +21,7 @@ echo "--- AfterEnd no parent ---\n";
try {
$element->insertAdjacentHTML(Dom\AdjacentPosition::AfterEnd, "test");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$dom->appendChild($element);
@@ -31,7 +31,7 @@ echo "--- BeforeBegin document parent ---\n";
try {
$element->insertAdjacentHTML(Dom\AdjacentPosition::BeforeBegin, "test");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- AfterEnd document parent ---\n";
@@ -39,16 +39,16 @@ echo "--- AfterEnd document parent ---\n";
try {
$element->insertAdjacentHTML(Dom\AdjacentPosition::AfterEnd, "test");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
--- BeforeBegin no parent ---
-No Modification Allowed Error
+DOMException: No Modification Allowed Error
--- AfterEnd no parent ---
-No Modification Allowed Error
+DOMException: No Modification Allowed Error
--- BeforeBegin document parent ---
-No Modification Allowed Error
+DOMException: No Modification Allowed Error
--- AfterEnd document parent ---
-No Modification Allowed Error
+DOMException: No Modification Allowed Error
diff --git a/ext/dom/tests/modern/html/interactions/HTMLCollection_dimension_errors.phpt b/ext/dom/tests/modern/html/interactions/HTMLCollection_dimension_errors.phpt
index 571f94e4d340..83b4476a233e 100644
--- a/ext/dom/tests/modern/html/interactions/HTMLCollection_dimension_errors.phpt
+++ b/ext/dom/tests/modern/html/interactions/HTMLCollection_dimension_errors.phpt
@@ -10,23 +10,23 @@ $dom = Dom\XMLDocument::createFromString('');
try {
$dom->getElementsByTagName('root')[][1] = 1;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->getElementsByTagName('root')[true];
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
isset($dom->getElementsByTagName('root')[true]);
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot append to Dom\HTMLCollection
-Cannot access offset of type bool on Dom\HTMLCollection
-Cannot access offset of type bool in isset or empty
+Error: Cannot append to Dom\HTMLCollection
+TypeError: Cannot access offset of type bool on Dom\HTMLCollection
+TypeError: Cannot access offset of type bool in isset or empty
diff --git a/ext/dom/tests/modern/html/interactions/HTMLDocument_registerNodeClass_02.phpt b/ext/dom/tests/modern/html/interactions/HTMLDocument_registerNodeClass_02.phpt
index 70be58a906ba..8e6139206b1a 100644
--- a/ext/dom/tests/modern/html/interactions/HTMLDocument_registerNodeClass_02.phpt
+++ b/ext/dom/tests/modern/html/interactions/HTMLDocument_registerNodeClass_02.phpt
@@ -14,7 +14,7 @@ $dom = Dom\HTMLDocument::createEmpty();
try {
$dom->registerNodeClass("Dom\\Document", "Custom");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$element = $dom->appendChild($dom->createElement("foo"));
@@ -27,7 +27,7 @@ $element->ownerDocument->foo();
?>
--EXPECTF--
-Dom\Document::registerNodeClass(): Argument #1 ($baseClass) must not be an abstract class
+ValueError: Dom\Document::registerNodeClass(): Argument #1 ($baseClass) must not be an abstract class
string(16) "Dom\HTMLDocument"
Fatal error: Uncaught Error: Call to undefined method Dom\HTMLDocument::foo() in %s:%d
diff --git a/ext/dom/tests/modern/html/interactions/without_constructor.phpt b/ext/dom/tests/modern/html/interactions/without_constructor.phpt
index 96cd131b0391..cd19fb88a20d 100644
--- a/ext/dom/tests/modern/html/interactions/without_constructor.phpt
+++ b/ext/dom/tests/modern/html/interactions/without_constructor.phpt
@@ -10,11 +10,11 @@ foreach (['Dom\HTMLDocument', 'Dom\XMLDocument'] as $class) {
$rc = new ReflectionClass($class);
$rc->newInstanceWithoutConstructor();
} catch (ReflectionException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
?>
--EXPECT--
-Class Dom\HTMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor
-Class Dom\XMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor
+ReflectionException: Class Dom\HTMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor
+ReflectionException: Class Dom\XMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor
diff --git a/ext/dom/tests/modern/html/parser/HTMLDocument_fromFile_nul_terminator_cases_path.phpt b/ext/dom/tests/modern/html/parser/HTMLDocument_fromFile_nul_terminator_cases_path.phpt
index 37cf161ec045..c664813330d1 100644
--- a/ext/dom/tests/modern/html/parser/HTMLDocument_fromFile_nul_terminator_cases_path.phpt
+++ b/ext/dom/tests/modern/html/parser/HTMLDocument_fromFile_nul_terminator_cases_path.phpt
@@ -8,15 +8,15 @@ dom
try {
Dom\HTMLDocument::createFromFile("\0");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
Dom\HTMLDocument::createFromFile('%00');
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Dom\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain any null bytes
-Dom\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain percent-encoded NUL bytes
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain any null bytes
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain percent-encoded NUL bytes
diff --git a/ext/dom/tests/modern/html/parser/HTMLDocument_parse_options.phpt b/ext/dom/tests/modern/html/parser/HTMLDocument_parse_options.phpt
index f61ef2dec867..4ea6425d4a7e 100644
--- a/ext/dom/tests/modern/html/parser/HTMLDocument_parse_options.phpt
+++ b/ext/dom/tests/modern/html/parser/HTMLDocument_parse_options.phpt
@@ -32,7 +32,7 @@ foreach (["createFromString", "createFromFile"] as $method) {
try {
Dom\HTMLDocument::{$method}("x", $options);
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
@@ -41,67 +41,67 @@ foreach (["createFromString", "createFromFile"] as $method) {
--EXPECTF--
--- Method createFromString ---
int(%d)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(4194304)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(524288)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(8)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(4)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(16)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(4)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(256)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(16384)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(4)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(2)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(1024)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(1)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(2048)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(64)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(128)
-Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
--- Method createFromFile ---
int(%d)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(4194304)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(524288)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(8)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(4)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(16)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(4)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(256)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(16384)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(4)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(2)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(1024)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(1)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(2048)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(64)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
int(128)
-Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
+ValueError: Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\HTML_NO_DEFAULT_NS)
diff --git a/ext/dom/tests/modern/spec/CharacterData_deleteData_negative_in_bounds_length.phpt b/ext/dom/tests/modern/spec/CharacterData_deleteData_negative_in_bounds_length.phpt
index f29a201ca106..a620c7420df7 100644
--- a/ext/dom/tests/modern/spec/CharacterData_deleteData_negative_in_bounds_length.phpt
+++ b/ext/dom/tests/modern/spec/CharacterData_deleteData_negative_in_bounds_length.phpt
@@ -19,7 +19,7 @@ $comment = $dom->createComment("foobarbaz");
try {
$comment->deleteData(3, -1);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
@@ -28,5 +28,5 @@ echo $dom->saveHtml($comment), "\n";
--- Modern behaviour ---
--- Legacy behaviour ---
-Index Size Error
+DOMException: Index Size Error
diff --git a/ext/dom/tests/modern/spec/CharacterData_insertData_edge_cases.phpt b/ext/dom/tests/modern/spec/CharacterData_insertData_edge_cases.phpt
index 9369bdadbffa..b439c221f217 100644
--- a/ext/dom/tests/modern/spec/CharacterData_insertData_edge_cases.phpt
+++ b/ext/dom/tests/modern/spec/CharacterData_insertData_edge_cases.phpt
@@ -12,17 +12,17 @@ $comment = $dom->createComment("foobarbaz");
try {
var_dump($comment->insertData(100, "data"));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($comment->insertData(2**31+1, "data"));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
?>
--EXPECT--
-Index Size Error
-Index Size Error
+DOMException: Index Size Error
+DOMException: Index Size Error
diff --git a/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset.phpt b/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset.phpt
index f00e9aa76aae..eab9a89c4830 100644
--- a/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset.phpt
+++ b/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset.phpt
@@ -10,7 +10,7 @@ $comment = $dom->createComment("foobarbaz");
try {
$comment->insertData(-1, "A");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
$comment->insertData(1, "A");
@@ -18,6 +18,6 @@ echo $dom->saveHtml($comment), "\n";
?>
--EXPECT--
-Index Size Error
+DOMException: Index Size Error
diff --git a/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset_mod32.phpt b/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset_mod32.phpt
index 7c27c3bc8dd5..06999256fda3 100644
--- a/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset_mod32.phpt
+++ b/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset_mod32.phpt
@@ -16,7 +16,7 @@ $comment = $dom->createComment("foobarbaz");
try {
$comment->insertData(-1, "A");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
$comment->insertData(-(2**32 - 1), "A");
@@ -29,24 +29,24 @@ $comment = $dom->createComment("foobarbaz");
try {
$comment->insertData(-1, "A");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
try {
$comment->insertData(-(2**32 - 1), "A");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
?>
--EXPECT--
--- Modern behaviour ---
-Index Size Error
+DOMException: Index Size Error
--- Legacy behaviour ---
-Index Size Error
+DOMException: Index Size Error
-Index Size Error
+DOMException: Index Size Error
diff --git a/ext/dom/tests/modern/spec/CharacterData_replaceData_negative_count_mod32.phpt b/ext/dom/tests/modern/spec/CharacterData_replaceData_negative_count_mod32.phpt
index 64634b099257..35ae5ad80618 100644
--- a/ext/dom/tests/modern/spec/CharacterData_replaceData_negative_count_mod32.phpt
+++ b/ext/dom/tests/modern/spec/CharacterData_replaceData_negative_count_mod32.phpt
@@ -26,13 +26,13 @@ $comment = $dom->createComment("foobarbaz");
try {
$comment->replaceData(0, -1, "A");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
try {
$comment->replaceData(2, -(2**32 - 2), "A");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
@@ -42,7 +42,7 @@ echo $dom->saveHtml($comment), "\n";
--- Legacy behaviour ---
-Index Size Error
+DOMException: Index Size Error
-Index Size Error
+DOMException: Index Size Error
diff --git a/ext/dom/tests/modern/spec/CharacterData_substringData_edge_cases.phpt b/ext/dom/tests/modern/spec/CharacterData_substringData_edge_cases.phpt
index c463c0f7057c..770d6d6ca6e2 100644
--- a/ext/dom/tests/modern/spec/CharacterData_substringData_edge_cases.phpt
+++ b/ext/dom/tests/modern/spec/CharacterData_substringData_edge_cases.phpt
@@ -12,23 +12,23 @@ $comment = $dom->createComment("foobarbaz");
try {
var_dump($comment->substringData(0, 2**31+1));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($comment->substringData(2**31+1, 0));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($comment->substringData(100, 0));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
?>
--EXPECT--
-Index Size Error
-Index Size Error
-Index Size Error
+DOMException: Index Size Error
+DOMException: Index Size Error
+DOMException: Index Size Error
diff --git a/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments.phpt b/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments.phpt
index 28198d94d6d5..3d0941cd82e1 100644
--- a/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments.phpt
+++ b/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments.phpt
@@ -14,7 +14,7 @@ echo $dom->saveHtml($comment), "\n";
try {
var_dump($comment->substringData(-2, 2));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
@@ -24,5 +24,5 @@ string(9) "foobarbaz"
string(7) "obarbaz"
-Index Size Error
+DOMException: Index Size Error
diff --git a/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments_mod32.phpt b/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments_mod32.phpt
index 7d38bd28d441..398327d2cf62 100644
--- a/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments_mod32.phpt
+++ b/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments_mod32.phpt
@@ -27,19 +27,19 @@ $comment = $dom->createComment("foobarbaz");
try {
var_dump($comment->substringData(0, -1));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
try {
var_dump($comment->substringData(2, -(2**32 - 2)));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
try {
var_dump($comment->substringData(-(2**32 - 2), 2));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml($comment), "\n";
@@ -53,9 +53,9 @@ string(2) "ob"
string(2) "ob"
--- Legacy behaviour ---
-Index Size Error
+DOMException: Index Size Error
-Index Size Error
+DOMException: Index Size Error
-Index Size Error
+DOMException: Index Size Error
diff --git a/ext/dom/tests/modern/spec/Document_createAttributeNS.phpt b/ext/dom/tests/modern/spec/Document_createAttributeNS.phpt
index 6441ee60ef4f..b4764f6a95f8 100644
--- a/ext/dom/tests/modern/spec/Document_createAttributeNS.phpt
+++ b/ext/dom/tests/modern/spec/Document_createAttributeNS.phpt
@@ -12,7 +12,7 @@ function testErrorCase($dom, $ns, $qname) {
$dom->createAttributeNS($ns, $qname);
} catch (DOMException $e) {
$ns_readable = is_null($ns) ? 'null' : "\"$ns\"";
- echo "($ns_readable, \"$qname\"): {$e->getMessage()}\n";
+ echo "($ns_readable, \"$qname\"): ", $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -68,13 +68,13 @@ echo $dom->saveHtml(), "\n";
?>
--EXPECT--
--- Error cases ---
-("", "bar:bar"): Namespace Error
-(null, "bar:bar"): Namespace Error
-("urn:a", "@"): Invalid Character Error
-("urn:a", "foo:bar:baz"): Invalid Character Error
-("http://www.w3.org/2000/xmlns", "xmlns"): Namespace Error
-("http://www.w3.org/2000/xmlns", "xmlns:bar"): Namespace Error
-("http://www.w3.org/2000/xmlns", "xml:foo"): Namespace Error
+("", "bar:bar"): DOMException: Namespace Error
+(null, "bar:bar"): DOMException: Namespace Error
+("urn:a", "@"): DOMException: Invalid Character Error
+("urn:a", "foo:bar:baz"): DOMException: Invalid Character Error
+("http://www.w3.org/2000/xmlns", "xmlns"): DOMException: Namespace Error
+("http://www.w3.org/2000/xmlns", "xmlns:bar"): DOMException: Namespace Error
+("http://www.w3.org/2000/xmlns", "xml:foo"): DOMException: Namespace Error
--- Normal cases ---
Attr: xmlns:foo
diff --git a/ext/dom/tests/modern/spec/Document_createElementNS.phpt b/ext/dom/tests/modern/spec/Document_createElementNS.phpt
index cbdbe5dfd983..b08ea8c7a5d3 100644
--- a/ext/dom/tests/modern/spec/Document_createElementNS.phpt
+++ b/ext/dom/tests/modern/spec/Document_createElementNS.phpt
@@ -33,7 +33,7 @@ function testError($dom, $namespaceURI, $qualifiedName)
try {
$dom->createElementNS($namespaceURI, $qualifiedName);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -89,8 +89,8 @@ namespaceURI: string(36) "http://www.w3.org/XML/1998/namespace"
&hello
--- Error cases ---
-(NULL, "prefix:name"): Namespace Error
-("", "prefix:name"): Namespace Error
-("urn:foo", "@"): Invalid Character Error
-("http://www.w3.org/2000/xmlns/", "svg"): Namespace Error
-("urn:foo", "xml:xml"): Namespace Error
+(NULL, "prefix:name"): DOMException: Namespace Error
+("", "prefix:name"): DOMException: Namespace Error
+("urn:foo", "@"): DOMException: Invalid Character Error
+("http://www.w3.org/2000/xmlns/", "svg"): DOMException: Namespace Error
+("urn:foo", "xml:xml"): DOMException: Namespace Error
diff --git a/ext/dom/tests/modern/spec/Document_createElement_edge_cases.phpt b/ext/dom/tests/modern/spec/Document_createElement_edge_cases.phpt
index 6d8fc878b6ce..e36c99013047 100644
--- a/ext/dom/tests/modern/spec/Document_createElement_edge_cases.phpt
+++ b/ext/dom/tests/modern/spec/Document_createElement_edge_cases.phpt
@@ -9,15 +9,15 @@ $dom = Dom\HTMLDocument::createEmpty();
try {
$dom->createElement('');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->createElement('$');
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid Character Error
-Invalid Character Error
+DOMException: Invalid Character Error
+DOMException: Invalid Character Error
diff --git a/ext/dom/tests/modern/spec/Document_implementation_createDocumentType_errors.phpt b/ext/dom/tests/modern/spec/Document_implementation_createDocumentType_errors.phpt
index 74e17fb5a4f0..4731bf309afe 100644
--- a/ext/dom/tests/modern/spec/Document_implementation_createDocumentType_errors.phpt
+++ b/ext/dom/tests/modern/spec/Document_implementation_createDocumentType_errors.phpt
@@ -9,21 +9,21 @@ $dom = Dom\XMLDocument::createEmpty();
try {
$dom->implementation->createDocumentType("invalid name", "public", "system");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->implementation->createDocumentType("", "public", "system");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->implementation->createDocumentType("@", "", "");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Namespace Error
-Namespace Error
-Namespace Error
+DOMException: Namespace Error
+DOMException: Namespace Error
+DOMException: Namespace Error
diff --git a/ext/dom/tests/modern/spec/Document_implementation_createDocument_errors.phpt b/ext/dom/tests/modern/spec/Document_implementation_createDocument_errors.phpt
index 673aed3ef556..0634df25f28e 100644
--- a/ext/dom/tests/modern/spec/Document_implementation_createDocument_errors.phpt
+++ b/ext/dom/tests/modern/spec/Document_implementation_createDocument_errors.phpt
@@ -10,16 +10,16 @@ $dom = Dom\XMLDocument::createEmpty();
try {
$dom->implementation->createDocument("urn:a", "@");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->implementation->createDocument("", "foo:bar");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid Character Error
-Namespace Error
+DOMException: Invalid Character Error
+DOMException: Namespace Error
diff --git a/ext/dom/tests/modern/spec/Document_implementation_same_object.phpt b/ext/dom/tests/modern/spec/Document_implementation_same_object.phpt
index 690b2bf63584..e8e3cb25d876 100644
--- a/ext/dom/tests/modern/spec/Document_implementation_same_object.phpt
+++ b/ext/dom/tests/modern/spec/Document_implementation_same_object.phpt
@@ -18,7 +18,7 @@ var_dump($implementation);
try {
clone $implementation;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -28,4 +28,4 @@ bool(true)
bool(false)
object(Dom\Implementation)#2 (0) {
}
-Trying to clone an uncloneable object of class Dom\Implementation
+Error: Trying to clone an uncloneable object of class Dom\Implementation
diff --git a/ext/dom/tests/modern/spec/Document_importNode_not_supported.phpt b/ext/dom/tests/modern/spec/Document_importNode_not_supported.phpt
index 9f02411fd8bb..090fb4e20ae2 100644
--- a/ext/dom/tests/modern/spec/Document_importNode_not_supported.phpt
+++ b/ext/dom/tests/modern/spec/Document_importNode_not_supported.phpt
@@ -14,11 +14,11 @@ $dom = Dom\HTMLDocument::createEmpty();
try {
$dom->importNode($dom);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: DOMDocument::importNode(): Cannot import: Node Type Not Supported in %s on line %d
bool(false)
-Not Supported Error
+DOMException: Not Supported Error
diff --git a/ext/dom/tests/modern/spec/Element_insertAdjacentText.phpt b/ext/dom/tests/modern/spec/Element_insertAdjacentText.phpt
index ef466817de89..ac015604ae20 100644
--- a/ext/dom/tests/modern/spec/Element_insertAdjacentText.phpt
+++ b/ext/dom/tests/modern/spec/Element_insertAdjacentText.phpt
@@ -10,7 +10,7 @@ $foo = $dom->appendChild($dom->createElement("foo"));
try {
$foo->insertAdjacentText(Dom\AdjacentPosition::BeforeBegin, "bar");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo->insertAdjacentText(Dom\AdjacentPosition::AfterBegin, "bar");
@@ -23,7 +23,7 @@ var_dump($foo->firstChild->nextSibling->textContent);
?>
--EXPECT--
-Cannot insert text as a child of a document
+DOMException: Cannot insert text as a child of a document
barbaz
string(3) "bar"
string(3) "baz"
diff --git a/ext/dom/tests/modern/spec/Element_prefix_readonly.phpt b/ext/dom/tests/modern/spec/Element_prefix_readonly.phpt
index cb623f702983..0b4d1d31ee30 100644
--- a/ext/dom/tests/modern/spec/Element_prefix_readonly.phpt
+++ b/ext/dom/tests/modern/spec/Element_prefix_readonly.phpt
@@ -9,10 +9,10 @@ $div = $dom->createElement('div');
try {
$div->prefix = "foo";
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveXml();
?>
--EXPECT--
-Cannot modify private(set) property Dom\Element::$prefix from global scope
+Error: Cannot modify private(set) property Dom\Element::$prefix from global scope
diff --git a/ext/dom/tests/modern/spec/Element_removeAttribute_edge_cases.phpt b/ext/dom/tests/modern/spec/Element_removeAttribute_edge_cases.phpt
index e50ef36e31fa..51c274b5e698 100644
--- a/ext/dom/tests/modern/spec/Element_removeAttribute_edge_cases.phpt
+++ b/ext/dom/tests/modern/spec/Element_removeAttribute_edge_cases.phpt
@@ -9,9 +9,9 @@ $dom = Dom\XMLDocument::createFromString('');
try {
$dom->documentElement->removeAttributeNode($dom->createAttribute('test'));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Not Found Error
+DOMException: Not Found Error
diff --git a/ext/dom/tests/modern/spec/Element_setAttributeNS.phpt b/ext/dom/tests/modern/spec/Element_setAttributeNS.phpt
index a38048a47ce9..6091ac339a06 100644
--- a/ext/dom/tests/modern/spec/Element_setAttributeNS.phpt
+++ b/ext/dom/tests/modern/spec/Element_setAttributeNS.phpt
@@ -21,7 +21,7 @@ echo "--- name validation ---\n";
try {
$container->setAttributeNS("urn:a", "a:b:c", "");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- ns attributes with same namespace but different prefix ---\n";
@@ -53,7 +53,7 @@ string(5) "xmlns"
string(9) "xmlns:foo"
string(29) "http://www.w3.org/2000/xmlns/"
--- name validation ---
-Invalid Character Error
+DOMException: Invalid Character Error
--- ns attributes with same namespace but different prefix ---
Attr: y:foo
diff --git a/ext/dom/tests/modern/spec/Element_setAttributeNode_inuse.phpt b/ext/dom/tests/modern/spec/Element_setAttributeNode_inuse.phpt
index ddbfbde7e616..e23e4960a27b 100644
--- a/ext/dom/tests/modern/spec/Element_setAttributeNode_inuse.phpt
+++ b/ext/dom/tests/modern/spec/Element_setAttributeNode_inuse.phpt
@@ -14,11 +14,11 @@ $element = $container->appendChild($dom1->createElement("element"));
try {
$element->setAttributeNode($attr1);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom1->saveHtml(), "\n";
?>
--EXPECT--
-Inuse Attribute Error
+DOMException: Inuse Attribute Error
diff --git a/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt b/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt
index 1787ae29f95d..2ec04e209a75 100644
--- a/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt
+++ b/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt
@@ -9,13 +9,13 @@ try {
$dom->createCDATASection("foo");
} catch (DOMException $e) {
var_dump($e->getCode());
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->createCDATASection("]]>");
} catch (DOMException $e) {
var_dump($e->getCode());
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$dom = Dom\XMLDocument::createEmpty();
@@ -23,14 +23,14 @@ try {
$dom->createCDATASection("]]>");
} catch (DOMException $e) {
var_dump($e->getCode());
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$dom->createCDATASection("]>");
?>
--EXPECT--
int(9)
-This operation is not supported for HTML documents
+DOMException: This operation is not supported for HTML documents
int(9)
-This operation is not supported for HTML documents
+DOMException: This operation is not supported for HTML documents
int(5)
-Invalid character sequence "]]>" in CDATA section
+DOMException: Invalid character sequence "]]>" in CDATA section
diff --git a/ext/dom/tests/modern/spec/HTMLDocument_createProcessingInstruction.phpt b/ext/dom/tests/modern/spec/HTMLDocument_createProcessingInstruction.phpt
index f1a60b875b1d..8281ee4676e9 100644
--- a/ext/dom/tests/modern/spec/HTMLDocument_createProcessingInstruction.phpt
+++ b/ext/dom/tests/modern/spec/HTMLDocument_createProcessingInstruction.phpt
@@ -9,19 +9,19 @@ try {
$dom->createProcessingInstruction("?>", "");
} catch (DOMException $e) {
var_dump($e->getCode());
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->createProcessingInstruction("?>", "?>");
} catch (DOMException $e) {
var_dump($e->getCode());
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->createProcessingInstruction("target", "?>");
} catch (DOMException $e) {
var_dump($e->getCode());
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$dom->appendChild($dom->createProcessingInstruction("foo", ""));
$dom->appendChild($dom->createProcessingInstruction("foo", "bar"));
@@ -29,9 +29,9 @@ echo $dom->saveHtml();
?>
--EXPECT--
int(5)
-Invalid Character Error
+DOMException: Invalid Character Error
int(5)
-Invalid Character Error
+DOMException: Invalid Character Error
int(5)
-Invalid character sequence "?>" in processing instruction
+DOMException: Invalid character sequence "?>" in processing instruction
diff --git a/ext/dom/tests/modern/spec/NamedNodeMap_dimensions.phpt b/ext/dom/tests/modern/spec/NamedNodeMap_dimensions.phpt
index cf446881559b..e95288e21c85 100644
--- a/ext/dom/tests/modern/spec/NamedNodeMap_dimensions.phpt
+++ b/ext/dom/tests/modern/spec/NamedNodeMap_dimensions.phpt
@@ -15,7 +15,7 @@ foreach ($test_values as $value) {
try {
var_dump($attributes[$value] ? $attributes[$value]->nodeName : "N/A", isset($attributes[$value]), empty($attributes[$value]));
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -58,9 +58,9 @@ string(1) "b"
bool(true)
bool(false)
--- true ---
-Cannot access offset of type bool on Dom\NamedNodeMap
+TypeError: Cannot access offset of type bool on Dom\NamedNodeMap
--- null ---
-Cannot access offset of type null on Dom\NamedNodeMap
+TypeError: Cannot access offset of type null on Dom\NamedNodeMap
--- "0" ---
string(1) "a"
bool(true)
diff --git a/ext/dom/tests/modern/spec/NamedNodeMap_dimensions_errors.phpt b/ext/dom/tests/modern/spec/NamedNodeMap_dimensions_errors.phpt
index 848b1a2c0b02..7833fb02e286 100644
--- a/ext/dom/tests/modern/spec/NamedNodeMap_dimensions_errors.phpt
+++ b/ext/dom/tests/modern/spec/NamedNodeMap_dimensions_errors.phpt
@@ -11,9 +11,9 @@ $attributes = $dom->documentElement->attributes;
try {
$attributes[][0] = 1;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot append to Dom\NamedNodeMap
+Error: Cannot append to Dom\NamedNodeMap
diff --git a/ext/dom/tests/modern/spec/NodeList_dimensions.phpt b/ext/dom/tests/modern/spec/NodeList_dimensions.phpt
index f5fe6480e641..56c0ebfbcaa2 100644
--- a/ext/dom/tests/modern/spec/NodeList_dimensions.phpt
+++ b/ext/dom/tests/modern/spec/NodeList_dimensions.phpt
@@ -15,7 +15,7 @@ foreach ($test_values as $value) {
try {
var_dump($children[$value] ? $children[$value]->nodeName : "N/A", isset($children[$value]), empty($children[$value]));
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -58,9 +58,9 @@ string(1) "b"
bool(true)
bool(false)
--- true ---
-Cannot access offset of type bool on Dom\NodeList
+TypeError: Cannot access offset of type bool on Dom\NodeList
--- null ---
-Cannot access offset of type null on Dom\NodeList
+TypeError: Cannot access offset of type null on Dom\NodeList
--- "0" ---
string(1) "a"
bool(true)
@@ -70,6 +70,6 @@ string(1) "b"
bool(true)
bool(false)
--- "" ---
-Cannot access offset of type string on Dom\NodeList
+TypeError: Cannot access offset of type string on Dom\NodeList
--- "foo" ---
-Cannot access offset of type string on Dom\NodeList
+TypeError: Cannot access offset of type string on Dom\NodeList
diff --git a/ext/dom/tests/modern/spec/NodeList_dimensions_errors.phpt b/ext/dom/tests/modern/spec/NodeList_dimensions_errors.phpt
index bfb882823b78..058f043c27fe 100644
--- a/ext/dom/tests/modern/spec/NodeList_dimensions_errors.phpt
+++ b/ext/dom/tests/modern/spec/NodeList_dimensions_errors.phpt
@@ -11,9 +11,9 @@ $children = $dom->documentElement->childNodes;
try {
$children[][0] = 1;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot append to Dom\NodeList
+Error: Cannot append to Dom\NodeList
diff --git a/ext/dom/tests/modern/spec/Node_appendChild_attribute.phpt b/ext/dom/tests/modern/spec/Node_appendChild_attribute.phpt
index 3e3a5674c6a6..72bb8b81fafa 100644
--- a/ext/dom/tests/modern/spec/Node_appendChild_attribute.phpt
+++ b/ext/dom/tests/modern/spec/Node_appendChild_attribute.phpt
@@ -13,12 +13,12 @@ $attr->value = "hello";
try {
$element->appendChild($attr);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($attr->value);
?>
--EXPECT--
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
string(5) "hello"
diff --git a/ext/dom/tests/modern/spec/Node_appendChild_fragment_multiple_elements.phpt b/ext/dom/tests/modern/spec/Node_appendChild_fragment_multiple_elements.phpt
index fc62d89811b5..bf74b83b355e 100644
--- a/ext/dom/tests/modern/spec/Node_appendChild_fragment_multiple_elements.phpt
+++ b/ext/dom/tests/modern/spec/Node_appendChild_fragment_multiple_elements.phpt
@@ -14,12 +14,12 @@ $fragment->appendChild($dom->createElement('bar'));
try {
$dom->appendChild($fragment);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveXml($fragment), "\n";
?>
--EXPECT--
-Cannot have more than one element child in a document
+DOMException: Cannot have more than one element child in a document
diff --git a/ext/dom/tests/modern/spec/Node_appendChild_invalid_parent.phpt b/ext/dom/tests/modern/spec/Node_appendChild_invalid_parent.phpt
index af99bfc38057..bb29ba33cf44 100644
--- a/ext/dom/tests/modern/spec/Node_appendChild_invalid_parent.phpt
+++ b/ext/dom/tests/modern/spec/Node_appendChild_invalid_parent.phpt
@@ -15,30 +15,30 @@ $attr = $dom->createAttribute('Hello');
try {
$text->appendChild($dom->createElement('br'));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$cdata->appendChild($dom->createElement('br'));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$pi->appendChild($dom->createElement('br'));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$attr->appendChild($dom->createElement('br'));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Hierarchy Request Error
-Hierarchy Request Error
-Hierarchy Request Error
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
diff --git a/ext/dom/tests/modern/spec/Node_cloneNode_copy_document_properties.phpt b/ext/dom/tests/modern/spec/Node_cloneNode_copy_document_properties.phpt
index 7894aa0a3131..55d0b065ae1b 100644
--- a/ext/dom/tests/modern/spec/Node_cloneNode_copy_document_properties.phpt
+++ b/ext/dom/tests/modern/spec/Node_cloneNode_copy_document_properties.phpt
@@ -13,9 +13,9 @@ $dom->appendChild($dom->createElement("foo"));
try {
$dom->prepend($dom->createElement("bar"));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot have more than one element child in a document
+DOMException: Cannot have more than one element child in a document
diff --git a/ext/dom/tests/modern/spec/Node_insertBefore_01.phpt b/ext/dom/tests/modern/spec/Node_insertBefore_01.phpt
index 967334bbeba2..3813fbee61c8 100644
--- a/ext/dom/tests/modern/spec/Node_insertBefore_01.phpt
+++ b/ext/dom/tests/modern/spec/Node_insertBefore_01.phpt
@@ -14,12 +14,12 @@ $fragment->appendChild($dom->createElement('a'));
try {
$dom->insertBefore($fragment, $dom->doctype);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml(), "\n";
?>
--EXPECT--
-Document types must be the first child in a document
+DOMException: Document types must be the first child in a document
diff --git a/ext/dom/tests/modern/spec/Node_insertBefore_02.phpt b/ext/dom/tests/modern/spec/Node_insertBefore_02.phpt
index 390dba0f176a..9984ec9a1284 100644
--- a/ext/dom/tests/modern/spec/Node_insertBefore_02.phpt
+++ b/ext/dom/tests/modern/spec/Node_insertBefore_02.phpt
@@ -13,12 +13,12 @@ $fragment->appendChild($dom->createElement('a'));
try {
$dom->insertBefore($fragment, $dom->documentElement);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveHtml(), "\n";
?>
--EXPECT--
-Cannot have more than one element child in a document
+DOMException: Cannot have more than one element child in a document
diff --git a/ext/dom/tests/modern/spec/Node_replaceChild_edge_cases.phpt b/ext/dom/tests/modern/spec/Node_replaceChild_edge_cases.phpt
index afa6d1e8a815..4ba1777ef054 100644
--- a/ext/dom/tests/modern/spec/Node_replaceChild_edge_cases.phpt
+++ b/ext/dom/tests/modern/spec/Node_replaceChild_edge_cases.phpt
@@ -18,7 +18,7 @@ $comment = $dom->createComment('This is a comment');
try {
$comment->replaceChild($comment, $dom->createElement("old-child"));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Node is an inclusive ancestor of parent ---\n";
@@ -26,13 +26,13 @@ echo "--- Node is an inclusive ancestor of parent ---\n";
try {
$parent->replaceChild($parent, $child);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$parent->replaceChild($dom, $child);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Child's parent is not parent ---\n";
@@ -40,7 +40,7 @@ echo "--- Child's parent is not parent ---\n";
try {
$parent->replaceChild($dom->createElement("new-child"), $dom->createElement("old-child"));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Invalid child to replace with ---\n";
@@ -49,7 +49,7 @@ try {
$entityReference = $dom->importNode(Dom\XMLDocument::createEmpty()->createEntityReference("foo"));
$parent->replaceChild($entityReference, $child);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Replace element with text in document root ---\n";
@@ -57,7 +57,7 @@ echo "--- Replace element with text in document root ---\n";
try {
$dom->replaceChild($dom->createTextNode("text"), $parent);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Replace child element with doctype inside element ---\n";
@@ -65,7 +65,7 @@ echo "--- Replace child element with doctype inside element ---\n";
try {
$parent->replaceChild($dom->doctype, $child);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Replace element with fragment containing multiple elements ---\n";
@@ -77,7 +77,7 @@ $fragment->appendChild($dom->createElement("new-child2"));
try {
$dom->replaceChild($fragment, $parent);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Replace comment in document causing more than two elements ---\n";
@@ -86,7 +86,7 @@ $comment = $dom->appendChild($dom->createComment("comment"));
try {
$dom->replaceChild($dom->createElement("new-child"), $comment);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Replace dtd with element ---\n";
@@ -94,7 +94,7 @@ echo "--- Replace dtd with element ---\n";
try {
$dom->replaceChild($dom->createElement("new-child"), $dom->doctype);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Replace element with another dtd ---\n";
@@ -102,7 +102,7 @@ echo "--- Replace element with another dtd ---\n";
try {
$dom->replaceChild($dom->doctype, $parent);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Replace parent with itself ---\n";
@@ -120,26 +120,26 @@ echo $dom->saveHtml(), "\n";
?>
--EXPECT--
--- Wrong parent node type ---
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
--- Node is an inclusive ancestor of parent ---
-Hierarchy Request Error
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
+DOMException: Hierarchy Request Error
--- Child's parent is not parent ---
-Not Found Error
+DOMException: Not Found Error
--- Invalid child to replace with ---
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
--- Replace element with text in document root ---
-Cannot insert text as a child of a document
+DOMException: Cannot insert text as a child of a document
--- Replace child element with doctype inside element ---
-Cannot insert a document type into anything other than a document
+DOMException: Cannot insert a document type into anything other than a document
--- Replace element with fragment containing multiple elements ---
-Cannot have more than one element child in a document
+DOMException: Cannot have more than one element child in a document
--- Replace comment in document causing more than two elements ---
-Cannot have more than one element child in a document
+DOMException: Cannot have more than one element child in a document
--- Replace dtd with element ---
-Cannot have more than one element child in a document
+DOMException: Cannot have more than one element child in a document
--- Replace element with another dtd ---
-Document types must be the first child in a document
+DOMException: Document types must be the first child in a document
--- Replace parent with itself ---
--- Replace parent with single-child fragment ---
diff --git a/ext/dom/tests/modern/spec/ParentNode_append_exception_consistency.phpt b/ext/dom/tests/modern/spec/ParentNode_append_exception_consistency.phpt
index a88b4fc808b0..a013070c2f9c 100644
--- a/ext/dom/tests/modern/spec/ParentNode_append_exception_consistency.phpt
+++ b/ext/dom/tests/modern/spec/ParentNode_append_exception_consistency.phpt
@@ -11,13 +11,13 @@ $fragment->append($dom->createElement("bar"));
try {
$dom->append($fragment);
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($element->parentNode);
?>
--EXPECT--
-Exception: Cannot have more than one element child in a document
+DOMException: Cannot have more than one element child in a document
object(Dom\DocumentFragment)#2 (18) {
["children"]=>
string(22) "(object value omitted)"
diff --git a/ext/dom/tests/modern/spec/ParentNode_edge_case.phpt b/ext/dom/tests/modern/spec/ParentNode_edge_case.phpt
index 367f1437c67d..e3eaaac880a2 100644
--- a/ext/dom/tests/modern/spec/ParentNode_edge_case.phpt
+++ b/ext/dom/tests/modern/spec/ParentNode_edge_case.phpt
@@ -10,9 +10,9 @@ $container = $dom->createElement('container');
try {
$container->append($dom);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
diff --git a/ext/dom/tests/modern/spec/ParentNode_hierarchy_text_nodes.phpt b/ext/dom/tests/modern/spec/ParentNode_hierarchy_text_nodes.phpt
index f81450ca261e..fea13e5f4cfd 100644
--- a/ext/dom/tests/modern/spec/ParentNode_hierarchy_text_nodes.phpt
+++ b/ext/dom/tests/modern/spec/ParentNode_hierarchy_text_nodes.phpt
@@ -10,20 +10,20 @@ $dom = Dom\HTMLDocument::createEmpty();
try {
$dom->append("bar");
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->append($dom->createTextNode("bar"));
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$text = $dom->createTextNode("bar");
try {
$dom->append($text);
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($text->parentNode);
@@ -34,14 +34,14 @@ $text = $element->appendChild($dom->createTextNode("text"));
try {
$dom->append($text);
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Exception: Cannot insert text as a child of a document
-Exception: Cannot insert text as a child of a document
-Exception: Cannot insert text as a child of a document
+DOMException: Cannot insert text as a child of a document
+DOMException: Cannot insert text as a child of a document
+DOMException: Cannot insert text as a child of a document
NULL
string(3) "bar"
-Exception: Cannot insert text as a child of a document
+DOMException: Cannot insert text as a child of a document
diff --git a/ext/dom/tests/modern/spec/Text_splitText_edge_case.phpt b/ext/dom/tests/modern/spec/Text_splitText_edge_case.phpt
index 4bd79b9b4a8b..862a5529147d 100644
--- a/ext/dom/tests/modern/spec/Text_splitText_edge_case.phpt
+++ b/ext/dom/tests/modern/spec/Text_splitText_edge_case.phpt
@@ -10,15 +10,15 @@ var_dump($text->splitText(5)->wholeText);
try {
var_dump($text->splitText(-1));
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($text->splitText(200));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
string(7) " World!"
-Dom\Text::splitText(): Argument #1 ($offset) must be greater than or equal to 0
-Index Size Error
+ValueError: Dom\Text::splitText(): Argument #1 ($offset) must be greater than or equal to 0
+DOMException: Index Size Error
diff --git a/ext/dom/tests/modern/spec/XMLDocument_version.phpt b/ext/dom/tests/modern/spec/XMLDocument_version.phpt
index 82f38839ea27..0c8f32c4cf4b 100644
--- a/ext/dom/tests/modern/spec/XMLDocument_version.phpt
+++ b/ext/dom/tests/modern/spec/XMLDocument_version.phpt
@@ -12,7 +12,7 @@ foreach (['0.1', '1.0', '1.1', '', 'foo'] as $version) {
try {
$dom->xmlVersion = $version;
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->xmlVersion);
}
@@ -20,11 +20,11 @@ foreach (['0.1', '1.0', '1.1', '', 'foo'] as $version) {
?>
--EXPECT--
string(3) "1.0"
-Invalid XML version
+ValueError: Invalid XML version
string(3) "1.0"
string(3) "1.0"
string(3) "1.1"
-Invalid XML version
+ValueError: Invalid XML version
string(3) "1.1"
-Invalid XML version
+ValueError: Invalid XML version
string(3) "1.1"
diff --git a/ext/dom/tests/modern/spec/appendChild_dtd_legacy.phpt b/ext/dom/tests/modern/spec/appendChild_dtd_legacy.phpt
index 20a69b3b545d..c365795043d5 100644
--- a/ext/dom/tests/modern/spec/appendChild_dtd_legacy.phpt
+++ b/ext/dom/tests/modern/spec/appendChild_dtd_legacy.phpt
@@ -25,14 +25,14 @@ $other->appendChild($doctype);
try {
$other->appendChild($other->implementation->createDocumentType('doc', '', ''));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $other->saveXml();
?>
--EXPECT--
Found entity: foo
-A document may only contain one document type
+DOMException: A document may only contain one document type
diff --git a/ext/dom/tests/modern/spec/append_text_nodes_invalid_hierarchy.phpt b/ext/dom/tests/modern/spec/append_text_nodes_invalid_hierarchy.phpt
index ea530d675c3c..6852e389e7c6 100644
--- a/ext/dom/tests/modern/spec/append_text_nodes_invalid_hierarchy.phpt
+++ b/ext/dom/tests/modern/spec/append_text_nodes_invalid_hierarchy.phpt
@@ -10,19 +10,19 @@ $dom = Dom\HTMLDocument::createEmpty();
try {
$dom->append("foo", "bar", "baz", $dom);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->append("foo", "bar", "baz");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveHtml());
?>
--EXPECT--
-Hierarchy Request Error
-Cannot insert text as a child of a document
+DOMException: Hierarchy Request Error
+DOMException: Cannot insert text as a child of a document
string(0) ""
diff --git a/ext/dom/tests/modern/spec/documentURI_URL.phpt b/ext/dom/tests/modern/spec/documentURI_URL.phpt
index 3e5a797eae67..51a275498daf 100644
--- a/ext/dom/tests/modern/spec/documentURI_URL.phpt
+++ b/ext/dom/tests/modern/spec/documentURI_URL.phpt
@@ -14,7 +14,7 @@ try {
var_dump($dom->documentURI);
var_dump($dom->URL);
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$dom->URL = "";
@@ -29,7 +29,7 @@ var_dump($dom->URL);
--EXPECTF--
string(%d) "%s"
string(%d) "%s"
-Cannot assign null to property Dom\Document::$URL of type string
+TypeError: Cannot assign null to property Dom\Document::$URL of type string
string(0) ""
string(0) ""
string(%d) "%s"
diff --git a/ext/dom/tests/modern/spec/pre_insertion_validation.phpt b/ext/dom/tests/modern/spec/pre_insertion_validation.phpt
index d16e3ffad9d9..0d6b4f9f69ef 100644
--- a/ext/dom/tests/modern/spec/pre_insertion_validation.phpt
+++ b/ext/dom/tests/modern/spec/pre_insertion_validation.phpt
@@ -13,17 +13,17 @@ echo "--- Trying to insert text node into the document ---\n";
try {
$dom->append("foo", "bar", "baz");
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->append($dom->createTextNode("text node"));
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$dom->append($dom->createCDATASection("text node"));
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Trying to insert doctype into not a document ---\n";
@@ -32,7 +32,7 @@ $element = $dom->createElement("foo");
try {
$element->append($doctype);
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Trying to insert doctype at the wrong place in a document ---\n";
@@ -40,7 +40,7 @@ echo "--- Trying to insert doctype at the wrong place in a document ---\n";
try {
$dom->append($doctype);
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Prepend doctype in a document should work ---\n";
@@ -52,7 +52,7 @@ echo "--- Trying to create multiple document roots ---\n";
try {
$dom->append($dom->createElement("foo"));
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Trying to insert an element before a document type ---\n";
@@ -61,7 +61,7 @@ $dom->documentElement->remove();
try {
$dom->prepend($element);
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Document output ---\n";
@@ -77,7 +77,7 @@ $fragment->append($dom->createElement("bar"));
try {
$dom->append($fragment);
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- Document fragment edge cases with text ---\n";
@@ -89,29 +89,29 @@ $fragment->append($dom->createCDATASection("bar"));
try {
$dom->append($fragment);
} catch (DOMException $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
--- Trying to insert text node into the document ---
-Exception: Cannot insert text as a child of a document
-Exception: Cannot insert text as a child of a document
-Exception: Cannot insert text as a child of a document
+DOMException: Cannot insert text as a child of a document
+DOMException: Cannot insert text as a child of a document
+DOMException: Cannot insert text as a child of a document
--- Trying to insert doctype into not a document ---
-Exception: Cannot insert a document type into anything other than a document
+DOMException: Cannot insert a document type into anything other than a document
--- Trying to insert doctype at the wrong place in a document ---
-Exception: Document types must be the first child in a document
+DOMException: Document types must be the first child in a document
--- Prepend doctype in a document should work ---
--- Trying to create multiple document roots ---
-Exception: Cannot have more than one element child in a document
+DOMException: Cannot have more than one element child in a document
--- Trying to insert an element before a document type ---
-Exception: Document types must be the first child in a document
+DOMException: Document types must be the first child in a document
--- Document output ---
--- Document fragment edge cases with multiple elements ---
-Exception: Cannot have more than one element child in a document
+DOMException: Cannot have more than one element child in a document
--- Document fragment edge cases with text ---
-Exception: Cannot insert text as a child of a document
+DOMException: Cannot insert text as a child of a document
diff --git a/ext/dom/tests/modern/spec/textContent_edge_cases.phpt b/ext/dom/tests/modern/spec/textContent_edge_cases.phpt
index 2252013c7a3f..a5022e647877 100644
--- a/ext/dom/tests/modern/spec/textContent_edge_cases.phpt
+++ b/ext/dom/tests/modern/spec/textContent_edge_cases.phpt
@@ -12,7 +12,7 @@ var_dump($dom->textContent);
try {
$dom->textContent = "foo";
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$container = $dom->documentElement;
@@ -39,7 +39,7 @@ echo $dom->saveXml(), "\n";
?>
--EXPECT--
document text content: NULL
-Cannot modify readonly property Dom\XMLDocument::$textContent
+Error: Cannot modify readonly property Dom\XMLDocument::$textContent
text node text content: string(4) "text"
pi node text content: string(5) "value"
text node text content: string(0) ""
diff --git a/ext/dom/tests/modern/token_list/add_errors.phpt b/ext/dom/tests/modern/token_list/add_errors.phpt
index 94db0d293114..4d571d9cd493 100644
--- a/ext/dom/tests/modern/token_list/add_errors.phpt
+++ b/ext/dom/tests/modern/token_list/add_errors.phpt
@@ -11,31 +11,31 @@ $list = $dom->documentElement->classList;
try {
$list->add("");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$list->add(" ");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$list->add("\0");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$list->add(0);
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveXML(), "\n";
?>
--EXPECT--
-The empty string is not a valid token
-The token must not contain any ASCII whitespace
-Dom\TokenList::add(): Argument #1 must not contain any null bytes
-Dom\TokenList::add(): Argument #1 must be of type string, int given
+DOMException: The empty string is not a valid token
+DOMException: The token must not contain any ASCII whitespace
+ValueError: Dom\TokenList::add(): Argument #1 must not contain any null bytes
+TypeError: Dom\TokenList::add(): Argument #1 must be of type string, int given
diff --git a/ext/dom/tests/modern/token_list/clone.phpt b/ext/dom/tests/modern/token_list/clone.phpt
index e0c71e9fd791..73ae99582f17 100644
--- a/ext/dom/tests/modern/token_list/clone.phpt
+++ b/ext/dom/tests/modern/token_list/clone.phpt
@@ -10,7 +10,7 @@ $element = $dom->documentElement;
try {
clone $element->classList;
} catch (Throwable $e) {
- echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
diff --git a/ext/dom/tests/modern/token_list/contains_error.phpt b/ext/dom/tests/modern/token_list/contains_error.phpt
index 9f402e685f4d..d373e1b8f52c 100644
--- a/ext/dom/tests/modern/token_list/contains_error.phpt
+++ b/ext/dom/tests/modern/token_list/contains_error.phpt
@@ -12,9 +12,9 @@ $list = $element->classList;
try {
$list->contains("\0");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Dom\TokenList::contains(): Argument #1 ($token) must not contain any null bytes
+ValueError: Dom\TokenList::contains(): Argument #1 ($token) must not contain any null bytes
diff --git a/ext/dom/tests/modern/token_list/dimensions.phpt b/ext/dom/tests/modern/token_list/dimensions.phpt
index e1507d61b08a..6a3e9b971482 100644
--- a/ext/dom/tests/modern/token_list/dimensions.phpt
+++ b/ext/dom/tests/modern/token_list/dimensions.phpt
@@ -20,7 +20,7 @@ echo "--- \"foo\" ---\n";
try {
var_dump($list["foo"], isset($list["foo"]), empty($list["foo"]));
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "--- 1.1 ---\n";
@@ -68,7 +68,7 @@ string(1) "A"
bool(true)
bool(false)
--- "foo" ---
-Cannot access offset of type string on Dom\TokenList
+TypeError: Cannot access offset of type string on Dom\TokenList
--- 1.1 ---
Deprecated: Implicit conversion from float 1.1 to int loses precision in %s on line %d
diff --git a/ext/dom/tests/modern/token_list/dimensions_error.phpt b/ext/dom/tests/modern/token_list/dimensions_error.phpt
index c29fc058ef94..ba1cec9d7a76 100644
--- a/ext/dom/tests/modern/token_list/dimensions_error.phpt
+++ b/ext/dom/tests/modern/token_list/dimensions_error.phpt
@@ -18,40 +18,40 @@ foreach ($testOffsets as $offset) {
try {
$list[$offset];
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
isset($list[$offset]);
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
empty($list[$offset]);
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
try {
$list[][0] = 1;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-Cannot access offset of type stdClass on Dom\TokenList
-Cannot access offset of type stdClass in isset or empty
-Cannot access offset of type stdClass in isset or empty
-Cannot access offset of type array on Dom\TokenList
-Cannot access offset of type array in isset or empty
-Cannot access offset of type array in isset or empty
+TypeError: Cannot access offset of type stdClass on Dom\TokenList
+TypeError: Cannot access offset of type stdClass in isset or empty
+TypeError: Cannot access offset of type stdClass in isset or empty
+TypeError: Cannot access offset of type array on Dom\TokenList
+TypeError: Cannot access offset of type array in isset or empty
+TypeError: Cannot access offset of type array in isset or empty
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Cannot append to Dom\TokenList
+Error: Cannot append to Dom\TokenList
diff --git a/ext/dom/tests/modern/token_list/foreach_by_ref.phpt b/ext/dom/tests/modern/token_list/foreach_by_ref.phpt
index b13b4c51c7c0..a06b94b8e7ef 100644
--- a/ext/dom/tests/modern/token_list/foreach_by_ref.phpt
+++ b/ext/dom/tests/modern/token_list/foreach_by_ref.phpt
@@ -11,9 +11,9 @@ try {
foreach ($dom->documentElement->classList as &$class) {
}
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-An iterator cannot be used with foreach by reference
+Error: An iterator cannot be used with foreach by reference
diff --git a/ext/dom/tests/modern/token_list/remove_errors.phpt b/ext/dom/tests/modern/token_list/remove_errors.phpt
index fe0e58c334c9..67231de408c3 100644
--- a/ext/dom/tests/modern/token_list/remove_errors.phpt
+++ b/ext/dom/tests/modern/token_list/remove_errors.phpt
@@ -11,31 +11,31 @@ $list = $dom->documentElement->classList;
try {
$list->remove("");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$list->remove(" ");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$list->remove("\0");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$list->remove(0);
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $dom->saveXML(), "\n";
?>
--EXPECT--
-The empty string is not a valid token
-The token must not contain any ASCII whitespace
-Dom\TokenList::remove(): Argument #1 must not contain any null bytes
-Dom\TokenList::remove(): Argument #1 must be of type string, int given
+DOMException: The empty string is not a valid token
+DOMException: The token must not contain any ASCII whitespace
+ValueError: Dom\TokenList::remove(): Argument #1 must not contain any null bytes
+TypeError: Dom\TokenList::remove(): Argument #1 must be of type string, int given
diff --git a/ext/dom/tests/modern/token_list/replace_error.phpt b/ext/dom/tests/modern/token_list/replace_error.phpt
index 14b02373d57d..9ff5a13c3e2b 100644
--- a/ext/dom/tests/modern/token_list/replace_error.phpt
+++ b/ext/dom/tests/modern/token_list/replace_error.phpt
@@ -12,23 +12,23 @@ $list = $element->classList;
try {
$list->replace("\0", "X");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$list->replace("X", "\0");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$list->replace("a b", "X");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Dom\TokenList::replace(): Argument #1 ($token) must not contain any null bytes
-Dom\TokenList::replace(): Argument #2 ($newToken) must not contain any null bytes
-The token must not contain any ASCII whitespace
+ValueError: Dom\TokenList::replace(): Argument #1 ($token) must not contain any null bytes
+ValueError: Dom\TokenList::replace(): Argument #2 ($newToken) must not contain any null bytes
+DOMException: The token must not contain any ASCII whitespace
diff --git a/ext/dom/tests/modern/token_list/supports.phpt b/ext/dom/tests/modern/token_list/supports.phpt
index 6fc1d7f22549..d26bf8d48ebd 100644
--- a/ext/dom/tests/modern/token_list/supports.phpt
+++ b/ext/dom/tests/modern/token_list/supports.phpt
@@ -10,9 +10,9 @@ $element = $dom->documentElement;
try {
$element->classList->supports('a');
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Attribute "class" does not define any supported tokens
+TypeError: Attribute "class" does not define any supported tokens
diff --git a/ext/dom/tests/modern/token_list/toggle_error.phpt b/ext/dom/tests/modern/token_list/toggle_error.phpt
index 7e3cfd462023..b9dabfa5f6ce 100644
--- a/ext/dom/tests/modern/token_list/toggle_error.phpt
+++ b/ext/dom/tests/modern/token_list/toggle_error.phpt
@@ -12,16 +12,16 @@ $list = $element->classList;
try {
$list->toggle("\0");
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$list->toggle("a b");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Dom\TokenList::toggle(): Argument #1 ($token) must not contain any null bytes
-The token must not contain any ASCII whitespace
+ValueError: Dom\TokenList::toggle(): Argument #1 ($token) must not contain any null bytes
+DOMException: The token must not contain any ASCII whitespace
diff --git a/ext/dom/tests/modern/token_list/value_edge_cases.phpt b/ext/dom/tests/modern/token_list/value_edge_cases.phpt
index af32d84180ba..b9a4f5156eef 100644
--- a/ext/dom/tests/modern/token_list/value_edge_cases.phpt
+++ b/ext/dom/tests/modern/token_list/value_edge_cases.phpt
@@ -13,7 +13,7 @@ var_dump($list->value);
try {
$list->value = "\0";
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($list->value);
@@ -21,5 +21,5 @@ var_dump($list->value);
?>
--EXPECT--
string(0) ""
-Value must not contain any null bytes
+ValueError: Value must not contain any null bytes
string(0) ""
diff --git a/ext/dom/tests/modern/xml/DtdNamedNodeMap_dimension_index_overflow_64.phpt b/ext/dom/tests/modern/xml/DtdNamedNodeMap_dimension_index_overflow_64.phpt
index cc2d7a06a2ca..4804d78c94b9 100644
--- a/ext/dom/tests/modern/xml/DtdNamedNodeMap_dimension_index_overflow_64.phpt
+++ b/ext/dom/tests/modern/xml/DtdNamedNodeMap_dimension_index_overflow_64.phpt
@@ -24,7 +24,7 @@ function dump_access(Closure $callback): void {
try {
var_dump($callback()?->nodeName);
} catch (ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
}
@@ -36,6 +36,6 @@ dump_access(fn() => $doc->doctype->notations[$overflow]);
?>
--EXPECT--
NULL
-must be between 0 and 2147483647
+ValueError: must be between 0 and 2147483647
NULL
-must be between 0 and 2147483647
+ValueError: must be between 0 and 2147483647
diff --git a/ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt b/ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt
index 0316ac88439f..49a7c739d6e0 100644
--- a/ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt
+++ b/ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt
@@ -19,7 +19,7 @@ function test($child, $html) {
try {
$child->innerHTML = $html;
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveXML() === $original);
}
@@ -33,15 +33,15 @@ test($child, '');
?>
--EXPECT--
-XML fragment is not well-formed
+DOMException: XML fragment is not well-formed
bool(true)
-XML fragment is not well-formed
+DOMException: XML fragment is not well-formed
bool(true)
-XML fragment is not well-formed
+DOMException: XML fragment is not well-formed
bool(true)
-XML fragment is not well-formed
+DOMException: XML fragment is not well-formed
bool(true)
-XML fragment is not well-formed
+DOMException: XML fragment is not well-formed
bool(true)
-XML fragment is not well-formed
+DOMException: XML fragment is not well-formed
bool(true)
diff --git a/ext/dom/tests/modern/xml/Element_innerOuterHTML_reading_errors.phpt b/ext/dom/tests/modern/xml/Element_innerOuterHTML_reading_errors.phpt
index 585c9c5fd875..770cc1157af1 100644
--- a/ext/dom/tests/modern/xml/Element_innerOuterHTML_reading_errors.phpt
+++ b/ext/dom/tests/modern/xml/Element_innerOuterHTML_reading_errors.phpt
@@ -17,12 +17,12 @@ function test($container) {
try {
var_dump($container->innerHTML);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($container->outerHTML);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -96,33 +96,33 @@ test($container);
?>
--EXPECT--
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
-The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
diff --git a/ext/dom/tests/modern/xml/Element_insertAdjacentHTML_errors.phpt b/ext/dom/tests/modern/xml/Element_insertAdjacentHTML_errors.phpt
index 0ecd1d487360..c26374b7ff10 100644
--- a/ext/dom/tests/modern/xml/Element_insertAdjacentHTML_errors.phpt
+++ b/ext/dom/tests/modern/xml/Element_insertAdjacentHTML_errors.phpt
@@ -9,9 +9,9 @@ $dom = Dom\XMLDocument::createFromString('');
try {
$dom->documentElement->insertAdjacentHTML(Dom\AdjacentPosition::AfterBegin, "");
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-XML fragment is not well-formed
+DOMException: XML fragment is not well-formed
diff --git a/ext/dom/tests/modern/xml/Element_outerHTML_writing_errors.phpt b/ext/dom/tests/modern/xml/Element_outerHTML_writing_errors.phpt
index f7602539acac..c4ef3adf3aa2 100644
--- a/ext/dom/tests/modern/xml/Element_outerHTML_writing_errors.phpt
+++ b/ext/dom/tests/modern/xml/Element_outerHTML_writing_errors.phpt
@@ -9,17 +9,17 @@ $dom = Dom\XMLDocument::createFromString('');
try {
$dom->documentElement->outerHTML = '';
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$dom = Dom\XMLDocument::createFromString('');
try {
$dom->documentElement->firstChild->outerHTML = '';
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid Modification Error
-XML fragment is not well-formed
+DOMException: Invalid Modification Error
+DOMException: XML fragment is not well-formed
diff --git a/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt b/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt
index eae3c97dbf00..dcb280be0566 100644
--- a/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt
+++ b/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt
@@ -12,9 +12,9 @@ $child = $comment->nextSibling;
try {
$comment->removeChild($child);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Not Found Error
+DOMException: Not Found Error
diff --git a/ext/dom/tests/modern/xml/XMLDocument_createFromFile_override_encoding.phpt b/ext/dom/tests/modern/xml/XMLDocument_createFromFile_override_encoding.phpt
index f48c5f7f5a14..c97a1db1bfcc 100644
--- a/ext/dom/tests/modern/xml/XMLDocument_createFromFile_override_encoding.phpt
+++ b/ext/dom/tests/modern/xml/XMLDocument_createFromFile_override_encoding.phpt
@@ -8,7 +8,7 @@ dom
try {
Dom\XMLDocument::createFromFile(__DIR__ . '/dummy.xml', overrideEncoding: 'nonexistent');
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// The override encoding matches with the document encoding attribute
@@ -23,7 +23,7 @@ var_dump($dom->charset);
?>
--EXPECT--
-Dom\XMLDocument::createFromFile(): Argument #3 ($overrideEncoding) must be a valid document encoding
+ValueError: Dom\XMLDocument::createFromFile(): Argument #3 ($overrideEncoding) must be a valid document encoding
string(2) "é"
string(5) "UTF-8"
string(4) "é"
diff --git a/ext/dom/tests/modern/xml/XMLDocument_createFromString_override_encoding.phpt b/ext/dom/tests/modern/xml/XMLDocument_createFromString_override_encoding.phpt
index e45f74847dd1..19834045f3db 100644
--- a/ext/dom/tests/modern/xml/XMLDocument_createFromString_override_encoding.phpt
+++ b/ext/dom/tests/modern/xml/XMLDocument_createFromString_override_encoding.phpt
@@ -8,7 +8,7 @@ dom
try {
Dom\XMLDocument::createFromString(file_get_contents(__DIR__ . '/dummy.xml'), overrideEncoding: 'nonexistent');
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// The override encoding matches with the document encoding attribute
@@ -23,7 +23,7 @@ var_dump($dom->charset);
?>
--EXPECT--
-Dom\XMLDocument::createFromString(): Argument #3 ($overrideEncoding) must be a valid document encoding
+ValueError: Dom\XMLDocument::createFromString(): Argument #3 ($overrideEncoding) must be a valid document encoding
string(2) "é"
string(5) "UTF-8"
string(4) "é"
diff --git a/ext/dom/tests/modern/xml/XMLDocument_fromFile_03.phpt b/ext/dom/tests/modern/xml/XMLDocument_fromFile_03.phpt
index 73c1b0d22356..15684fb22723 100644
--- a/ext/dom/tests/modern/xml/XMLDocument_fromFile_03.phpt
+++ b/ext/dom/tests/modern/xml/XMLDocument_fromFile_03.phpt
@@ -8,9 +8,9 @@ dom
try {
Dom\XMLDocument::createFromFile("%00");
} catch (ValueError $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-Dom\XMLDocument::createFromFile(): Argument #1 ($path) must not contain percent-encoded NUL bytes
+ValueError: Dom\XMLDocument::createFromFile(): Argument #1 ($path) must not contain percent-encoded NUL bytes
diff --git a/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt b/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt
index 16db09547bff..0691fc4b382e 100644
--- a/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt
+++ b/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt
@@ -12,7 +12,7 @@ $flags = [
try {
Dom\XMLDocument::createFromString('', -1);
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
foreach ($flags as $flag) {
@@ -21,7 +21,7 @@ foreach ($flags as $flag) {
?>
--EXPECTF--
-Dom\XMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: %s)
+ValueError: Dom\XMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: %s)
bool(true)
bool(true)
bool(true)
diff --git a/ext/dom/tests/modern/xml/XMLDocument_xpath.phpt b/ext/dom/tests/modern/xml/XMLDocument_xpath.phpt
index b42c21ed9ab1..8e3afe9ef6fb 100644
--- a/ext/dom/tests/modern/xml/XMLDocument_xpath.phpt
+++ b/ext/dom/tests/modern/xml/XMLDocument_xpath.phpt
@@ -46,7 +46,7 @@ echo "--- Get a namespace node ---\n";
try {
var_dump($xpath->evaluate("//*/namespace::*"));
} catch (DOMException $e) {
- echo $e->getCode(), ": ", $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getCode(), ': ', $e->getMessage(), "\n";
}
?>
@@ -71,4 +71,4 @@ string(4) "data"
string(11) "Dom\Comment"
string(9) " comment "
--- Get a namespace node ---
-9: The namespace axis is not well-defined in the living DOM specification. Use Dom\Element::getInScopeNamespaces() or Dom\Element::getDescendantNamespaces() instead.
+DOMException: 9: The namespace axis is not well-defined in the living DOM specification. Use Dom\Element::getInScopeNamespaces() or Dom\Element::getDescendantNamespaces() instead.
diff --git a/ext/dom/tests/modern/xml/XMLDocument_xpath_errors.phpt b/ext/dom/tests/modern/xml/XMLDocument_xpath_errors.phpt
index 1ef52b50961f..027905bf20b1 100644
--- a/ext/dom/tests/modern/xml/XMLDocument_xpath_errors.phpt
+++ b/ext/dom/tests/modern/xml/XMLDocument_xpath_errors.phpt
@@ -12,10 +12,10 @@ $xpath = new Dom\XPath($dom);
try {
var_dump($xpath->evaluate('-'));
} catch (Error $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: Dom\XPath::evaluate(): Invalid expression in %s on line %d
-string(35) "Could not evaluate XPath expression"
+Error: Could not evaluate XPath expression
diff --git a/ext/dom/tests/modern/xml/canonicalize_unattached.phpt b/ext/dom/tests/modern/xml/canonicalize_unattached.phpt
index cec5f1085757..b7326af0ca6a 100644
--- a/ext/dom/tests/modern/xml/canonicalize_unattached.phpt
+++ b/ext/dom/tests/modern/xml/canonicalize_unattached.phpt
@@ -12,9 +12,9 @@ $child->remove();
try {
$child->C14N();
} catch (Dom\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Canonicalization can only happen on nodes attached to a document.
+DOMException: Canonicalization can only happen on nodes attached to a document.
diff --git a/ext/dom/tests/modern/xml/gh22570.phpt b/ext/dom/tests/modern/xml/gh22570.phpt
index 3d648aac5e4d..816fba04637a 100644
--- a/ext/dom/tests/modern/xml/gh22570.phpt
+++ b/ext/dom/tests/modern/xml/gh22570.phpt
@@ -28,13 +28,13 @@ $doc->appendChild($node);
try {
$doc->saveXml();
} catch (\Error $e) {
- echo "saveXml: ", $e::class, ": ", $e->getMessage(), "\n";
+ echo 'saveXml: ', $e::class, ': ', $e->getMessage(), "\n";
}
try {
$doc->documentElement->innerHTML;
} catch (\Error $e) {
- echo "innerHTML: ", $e::class, ": ", $e->getMessage(), "\n";
+ echo 'innerHTML: ', $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
diff --git a/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt b/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt
index 7770143b2248..b4d35b8560e6 100644
--- a/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt
+++ b/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt
@@ -16,10 +16,10 @@ $x->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:a', '');
try {
var_dump($dom->documentElement->innerHTML);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
string(13) ""
-The resulting XML serialization is not well-formed
+DOMException: The resulting XML serialization is not well-formed
diff --git a/ext/dom/tests/modern/xml/simplexml_interop.phpt b/ext/dom/tests/modern/xml/simplexml_interop.phpt
index a1b02b7bdd83..9c5df6051dfe 100644
--- a/ext/dom/tests/modern/xml/simplexml_interop.phpt
+++ b/ext/dom/tests/modern/xml/simplexml_interop.phpt
@@ -22,7 +22,7 @@ echo $element->ownerDocument->saveXml($element), "\n";
try {
dom_import_simplexml($sxe);
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Import again and compare
@@ -37,5 +37,5 @@ object(Dom\NamedNodeMap)#3 (1) {
foo
foo
foovalue
-dom_import_simplexml(): Argument #1 ($node) must not be already imported as a Dom\Node
+TypeError: dom_import_simplexml(): Argument #1 ($node) must not be already imported as a Dom\Node
bool(true)
diff --git a/ext/dom/tests/not_serializable.phpt b/ext/dom/tests/not_serializable.phpt
index 36053070f400..33f7761930d7 100644
--- a/ext/dom/tests/not_serializable.phpt
+++ b/ext/dom/tests/not_serializable.phpt
@@ -10,48 +10,48 @@ $doc->loadXML('');
try {
serialize($doc);
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$node = $doc->documentElement;
try {
serialize($node);
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$xpath = new DOMXPath($doc);
try {
serialize($xpath);
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$ns = $xpath->query('//namespace::*')->item(0);
try {
serialize($ns);
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$dom = Dom\XMLDocument::createEmpty();
try {
serialize($dom);
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
serialize(new Dom\XPath($dom));
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Serialization of 'DOMDocument' is not allowed, unless serialization methods are implemented in a subclass
-Serialization of 'DOMElement' is not allowed, unless serialization methods are implemented in a subclass
-Serialization of 'DOMXPath' is not allowed
-Serialization of 'DOMNameSpaceNode' is not allowed, unless serialization methods are implemented in a subclass
-Serialization of 'Dom\XMLDocument' is not allowed, unless serialization methods are implemented in a subclass
-Serialization of 'Dom\XPath' is not allowed
+Exception: Serialization of 'DOMDocument' is not allowed, unless serialization methods are implemented in a subclass
+Exception: Serialization of 'DOMElement' is not allowed, unless serialization methods are implemented in a subclass
+Exception: Serialization of 'DOMXPath' is not allowed
+Exception: Serialization of 'DOMNameSpaceNode' is not allowed, unless serialization methods are implemented in a subclass
+Exception: Serialization of 'Dom\XMLDocument' is not allowed, unless serialization methods are implemented in a subclass
+Exception: Serialization of 'Dom\XPath' is not allowed
diff --git a/ext/dom/tests/not_unserializable.phpt b/ext/dom/tests/not_unserializable.phpt
index a25a2737e852..389110ce8b7e 100644
--- a/ext/dom/tests/not_unserializable.phpt
+++ b/ext/dom/tests/not_unserializable.phpt
@@ -17,13 +17,13 @@ foreach ($classes as $class)
try {
unserialize('O:' . strlen($class) . ':"' . $class . '":0:{}');
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
?>
--EXPECT--
-Unserialization of 'DOMXPath' is not allowed
-Unserialization of 'DOMDocument' is not allowed, unless unserialization methods are implemented in a subclass
-Unserialization of 'DOMNode' is not allowed, unless unserialization methods are implemented in a subclass
-Unserialization of 'DOMNameSpaceNode' is not allowed, unless unserialization methods are implemented in a subclass
+Exception: Unserialization of 'DOMXPath' is not allowed
+Exception: Unserialization of 'DOMDocument' is not allowed, unless unserialization methods are implemented in a subclass
+Exception: Unserialization of 'DOMNode' is not allowed, unless unserialization methods are implemented in a subclass
+Exception: Unserialization of 'DOMNameSpaceNode' is not allowed, unless unserialization methods are implemented in a subclass
diff --git a/ext/dom/tests/null_text_content_manipulation.phpt b/ext/dom/tests/null_text_content_manipulation.phpt
index 9b1e35d60f76..28523ae0d979 100644
--- a/ext/dom/tests/null_text_content_manipulation.phpt
+++ b/ext/dom/tests/null_text_content_manipulation.phpt
@@ -8,26 +8,26 @@ $text = new DOMText();
try {
var_dump($text->substringData(1, 0));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($text->insertData(1, ""));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($text->deleteData(1, 1));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($text->replaceData(1, 1, ""));
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Index Size Error
-Index Size Error
-Index Size Error
-Index Size Error
+DOMException: Index Size Error
+DOMException: Index Size Error
+DOMException: Index Size Error
+DOMException: Index Size Error
diff --git a/ext/dom/tests/php_function_edge_cases.phpt b/ext/dom/tests/php_function_edge_cases.phpt
index 1091b50ce19b..f78472ace464 100644
--- a/ext/dom/tests/php_function_edge_cases.phpt
+++ b/ext/dom/tests/php_function_edge_cases.phpt
@@ -13,15 +13,15 @@ $xpath->registerPHPFunctions();
try {
$xpath->query("//a[php:function(3)]");
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->query("//a[php:function()]");
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Handler name must be a string
-Function name must be passed as the first argument
+TypeError: Handler name must be a string
+Error: Function name must be passed as the first argument
diff --git a/ext/dom/tests/property_write_errors.phpt b/ext/dom/tests/property_write_errors.phpt
index 7d2af3b10555..9f583931ea58 100644
--- a/ext/dom/tests/property_write_errors.phpt
+++ b/ext/dom/tests/property_write_errors.phpt
@@ -11,19 +11,19 @@ $dom = new DOMDocument();
try {
$dom->nodeValue = [];
} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
$dom->nodeType += 1;
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
$dom->xmlEncoding = null;
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
$entity = new DOMEntity();
@@ -31,26 +31,26 @@ $entity = new DOMEntity();
try {
$entity->actualEncoding = null;
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
$entity->encoding = null;
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
$entity->version = null;
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign array to property DOMNode::$nodeValue of type ?string
-Cannot modify private(set) property DOMNode::$nodeType from global scope
-Cannot modify private(set) property DOMDocument::$xmlEncoding from global scope
-Cannot modify private(set) property DOMEntity::$actualEncoding from global scope
-Cannot modify private(set) property DOMEntity::$encoding from global scope
-Cannot modify private(set) property DOMEntity::$version from global scope
+TypeError: Cannot assign array to property DOMNode::$nodeValue of type ?string
+Error: Cannot modify private(set) property DOMNode::$nodeType from global scope
+Error: Cannot modify private(set) property DOMDocument::$xmlEncoding from global scope
+Error: Cannot modify private(set) property DOMEntity::$actualEncoding from global scope
+Error: Cannot modify private(set) property DOMEntity::$encoding from global scope
+Error: Cannot modify private(set) property DOMEntity::$version from global scope
diff --git a/ext/dom/tests/registerNodeClass_abstract_class.phpt b/ext/dom/tests/registerNodeClass_abstract_class.phpt
index 24124d712ea0..2848326206c2 100644
--- a/ext/dom/tests/registerNodeClass_abstract_class.phpt
+++ b/ext/dom/tests/registerNodeClass_abstract_class.phpt
@@ -14,7 +14,7 @@ $dom = new DOMDocument;
try {
$dom->registerNodeClass("DOMElement", "Test");
} catch (ValueError $e) {
- echo "ValueError: ", $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$dom->createElement("foo");
diff --git a/ext/dom/tests/registerPhpFunctionNS_errors.phpt b/ext/dom/tests/registerPhpFunctionNS_errors.phpt
index 5098d8f7a84f..77ab58777a04 100644
--- a/ext/dom/tests/registerPhpFunctionNS_errors.phpt
+++ b/ext/dom/tests/registerPhpFunctionNS_errors.phpt
@@ -18,44 +18,44 @@ $xpath = new DOMXPath($doc);
try {
$xpath->registerPhpFunctionNS('http://php.net/xpath', 'strtolower', strtolower(...));
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctionNS('http://php.net/xpath', 'test', [new TrampolineClass, 'test']);
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctionNS('urn:foo', '$$$', [new TrampolineClass, 'test']);
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctionNS('urn:foo', 'x:a', strtolower(...));
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctionNS("urn:foo", "\0", strtolower(...));
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$xpath->registerPhpFunctionNS("\0", 'strtolower', strtolower(...));
} catch (ValueError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not be "http://php.net/xpath" because it is reserved by PHP
-DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not be "http://php.net/xpath" because it is reserved by PHP
-DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must be a valid callback name
-DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must be a valid callback name
-DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must not contain any null bytes
-DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not contain any null bytes
+ValueError: DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not be "http://php.net/xpath" because it is reserved by PHP
+ValueError: DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not be "http://php.net/xpath" because it is reserved by PHP
+ValueError: DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must be a valid callback name
+ValueError: DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must be a valid callback name
+ValueError: DOMXPath::registerPhpFunctionNS(): Argument #2 ($name) must not contain any null bytes
+ValueError: DOMXPath::registerPhpFunctionNS(): Argument #1 ($namespaceURI) must not contain any null bytes
diff --git a/ext/dom/tests/register_node_class.phpt b/ext/dom/tests/register_node_class.phpt
index 7482ec27bfa0..313e4218748c 100644
--- a/ext/dom/tests/register_node_class.phpt
+++ b/ext/dom/tests/register_node_class.phpt
@@ -30,7 +30,7 @@ echo get_class($attr), "\n";
try {
print $attr->testit()."\n";
} catch (Error $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
@@ -39,4 +39,4 @@ HELLO Element
myAttribute
HELLO Attribute
DOMAttr
-Call to undefined method DOMAttr::testit()
+Error: Call to undefined method DOMAttr::testit()
diff --git a/ext/dom/tests/replaceChild_attribute_validation.phpt b/ext/dom/tests/replaceChild_attribute_validation.phpt
index 32d5990f75e3..95e4389d86c3 100644
--- a/ext/dom/tests/replaceChild_attribute_validation.phpt
+++ b/ext/dom/tests/replaceChild_attribute_validation.phpt
@@ -12,7 +12,7 @@ $attr->textContent = "test";
try {
$attr->replaceChild($dom->createProcessingInstruction('pi'), $attr->firstChild);
} catch (DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$root = $dom->appendChild($dom->createElement('root'));
@@ -22,6 +22,6 @@ echo $dom->saveXML();
?>
--EXPECT--
-Hierarchy Request Error
+DOMException: Hierarchy Request Error
diff --git a/ext/dom/tests/unsetting_properties.phpt b/ext/dom/tests/unsetting_properties.phpt
index ec309c18bf58..966e8567de29 100644
--- a/ext/dom/tests/unsetting_properties.phpt
+++ b/ext/dom/tests/unsetting_properties.phpt
@@ -18,15 +18,15 @@ unset($root->myProp);
try {
$root->myProp;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
unset($root->textContent);
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Typed property MyElement::$myProp must not be accessed before initialization
-Cannot unset MyElement::$textContent
+Error: Typed property MyElement::$myProp must not be accessed before initialization
+Error: Cannot unset MyElement::$textContent
diff --git a/ext/dom/tests/xpath_domnamespacenode_advanced.phpt b/ext/dom/tests/xpath_domnamespacenode_advanced.phpt
index bbc49dc54652..ac00f3dda8e6 100644
--- a/ext/dom/tests/xpath_domnamespacenode_advanced.phpt
+++ b/ext/dom/tests/xpath_domnamespacenode_advanced.phpt
@@ -30,7 +30,7 @@ foreach ($xpath->query($query) as $attribute) {
try {
$attribute->parentNode->remove();
} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// However, it should not cause a use-after-free
echo "After: ", $attribute->parentNode->tagName, "\n";
@@ -57,19 +57,19 @@ string(5) "child"
Before: root
After: root
Before: root
-Not Found Error
+DOMException: Not Found Error
After: root
Before: root
-Not Found Error
+DOMException: Not Found Error
After: root
Before: child
After: child
Before: child
-Not Found Error
+DOMException: Not Found Error
After: child
Before: child
-Not Found Error
+DOMException: Not Found Error
After: child
Before: child
-Not Found Error
+DOMException: Not Found Error
After: child