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"