diff --git a/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt b/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt
index cf51c3581a34..5942a4cf75fa 100644
--- a/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt
+++ b/ext/dom/tests/DOM4_ChildNode_wrong_document.phpt
@@ -18,8 +18,8 @@ function test($method) {
try {
$element->$method($dom2->documentElement->firstChild);
echo "FAIL";
- } catch (DOMException $e) {
- echo $e->getMessage() . "\n";
+ } catch (Throwable $e) {
+ 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..b1db57e4f31a 100644
--- a/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt
+++ b/ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt
@@ -11,9 +11,9 @@ $element = $dom->createElement('test');
try {
$element->remove();
-} catch (DOMException $e) {
- echo $e->getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--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..2583bbe3178e 100644
--- a/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt
+++ b/ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt
@@ -11,9 +11,9 @@ $dom->loadXML('');
try {
$dom->documentElement->append(array());
-} catch(TypeError $e) {
- echo "OK! {$e->getMessage()}";
+} catch(Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--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..75c6bc44d904 100644
--- a/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt
+++ b/ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt
@@ -18,13 +18,13 @@ $element = $dom->documentElement;
try {
$element->append($replacement, $addition);
-} catch (DOMException $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ 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..ec30546b8b54 100644
--- a/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt
+++ b/ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt
@@ -18,8 +18,8 @@ function test($method) {
try {
$element->$method($dom2->documentElement->firstChild);
echo "FAIL";
- } catch (DOMException $e) {
- echo $e->getMessage() . "\n";
+ } catch (Throwable $e) {
+ 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..1f4f73806d01 100644
--- a/ext/dom/tests/DOMAttr_construct_error_001.phpt
+++ b/ext/dom/tests/DOMAttr_construct_error_001.phpt
@@ -9,9 +9,9 @@ dom
getMessage(), "\n";
+} catch (Throwable $e) {
+ 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..9a3ba6448894 100644
--- a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt
+++ b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt
@@ -9,9 +9,9 @@ dom
getMessage();
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--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..f6fce4cc9c90 100644
--- a/ext/dom/tests/DOMCharacterData_data_error_002.phpt
+++ b/ext/dom/tests/DOMCharacterData_data_error_002.phpt
@@ -10,9 +10,9 @@ dom
$character_data = new DOMCharacterData();
try {
print $character_data->data;
-} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..0da7f7b5e414 100644
--- a/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
+++ b/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
@@ -15,9 +15,9 @@ $cdata = $document->createCDATASection('test');
$root->appendChild($cdata);
try {
$cdata->deleteData(5, 1);
-} catch (DOMException $e) {
- echo $e->getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--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..7c446c1fc660 100644
--- a/ext/dom/tests/DOMCharacterData_length_error_001.phpt
+++ b/ext/dom/tests/DOMCharacterData_length_error_001.phpt
@@ -10,9 +10,9 @@ dom
$character_data = new DOMCharacterData();
try {
print $character_data->length;
-} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..eddb88e2be71 100644
--- a/ext/dom/tests/DOMComment_construct_error_001.phpt
+++ b/ext/dom/tests/DOMComment_construct_error_001.phpt
@@ -9,9 +9,9 @@ dom
getMessage(), "\n";
+} catch (Throwable $e) {
+ 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..ec8663836078 100644
--- a/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt
+++ b/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt
@@ -10,9 +10,9 @@ dom
$fragment = new DOMDocumentFragment();
try {
$fragment->appendXML('crankbait');
-} catch (DOMException $e) {
- echo $e->getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--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..d025a7951cbc 100644
--- a/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt
@@ -9,9 +9,9 @@ dom
getMessage(), "\n";
+} catch (Throwable $e) {
+ 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..5b1eada08653 100644
--- a/ext/dom/tests/DOMDocumentType_entities_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_entities_error_001.phpt
@@ -10,9 +10,9 @@ dom
$doctype = new DOMDocumentType();
try {
$doctype->entities;
-} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..0de4fb21e9ad 100644
--- a/ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt
@@ -10,9 +10,9 @@ dom
$doctype = new DOMDocumentType();
try {
$doctype->internalSubset;
-} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..ab64a425a5fc 100644
--- a/ext/dom/tests/DOMDocumentType_name_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_name_error_001.phpt
@@ -10,9 +10,9 @@ dom
$doctype = new DOMDocumentType();
try {
$doctype->name;
-} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..080fb85522fa 100644
--- a/ext/dom/tests/DOMDocumentType_notations_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_notations_error_001.phpt
@@ -10,9 +10,9 @@ dom
$doctype = new DOMDocumentType();
try {
$notations = $doctype->notations;
-} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..f798f4191da8 100644
--- a/ext/dom/tests/DOMDocumentType_publicId_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_publicId_error_001.phpt
@@ -10,9 +10,9 @@ dom
$doctype = new DOMDocumentType();
try {
$publicId = $doctype->publicId;
-} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..fa41a8098a5f 100644
--- a/ext/dom/tests/DOMDocumentType_systemId_error_001.phpt
+++ b/ext/dom/tests/DOMDocumentType_systemId_error_001.phpt
@@ -10,9 +10,9 @@ dom
$doctype = new DOMDocumentType();
try {
$systemId = $doctype->systemId;
-} catch (DOMException $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..5ecaef0083ad 100644
--- a/ext/dom/tests/DOMDocument_adoptNode.phpt
+++ b/ext/dom/tests/DOMDocument_adoptNode.phpt
@@ -20,8 +20,8 @@ var_dump($i_tag_element->ownerDocument === $doc2);
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";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "-- Adopting --\n";
@@ -47,8 +47,8 @@ echo "-- Adopt a document (strict error on) --\n";
try {
$doc1->adoptNode($doc1);
-} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "-- Adopt a document (strict error off) --\n";
@@ -56,8 +56,8 @@ echo "-- Adopt a document (strict error off) --\n";
$doc1->strictErrorChecking = false;
try {
$doc1->adoptNode($doc1);
-} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ 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..736687080e5e 100644
--- a/ext/dom/tests/DOMDocument_createEntityReference_error1.phpt
+++ b/ext/dom/tests/DOMDocument_createEntityReference_error1.phpt
@@ -8,11 +8,11 @@ $objDoc = new DomDocument();
try {
$objDoc->createEntityReference('!');
-} catch (DOMException $e) {
+} catch (Throwable $e) {
var_dump($e->getCode() === DOM_INVALID_CHARACTER_ERR);
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--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..30237c395120 100644
--- a/ext/dom/tests/DOMDocument_encoding_basic.phpt
+++ b/ext/dom/tests/DOMDocument_encoding_basic.phpt
@@ -24,8 +24,8 @@ echo "Empty Encoding Read: '{$dom->encoding}'\n";
try {
$ret = $dom->encoding = 'NYPHP DOMinatrix';
echo "Adding invalid encoding: $ret\n";
-} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$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..6d194309b588 100644
--- a/ext/dom/tests/DOMDocument_loadHTML_error2.phpt
+++ b/ext/dom/tests/DOMDocument_loadHTML_error2.phpt
@@ -9,9 +9,9 @@ dom
$doc = new DOMDocument();
try {
$doc->loadHTML('');
-} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ 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..b508c3deb5da 100644
--- a/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt
+++ b/ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt
@@ -11,17 +11,17 @@ dom
$doc = new DOMDocument();
try {
$result = $doc->loadHTMLFile("");
-} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$doc = new DOMDocument();
try {
$result = $doc->loadHTMLFile("text.html\0something");
-} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ 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..04a01530a0c7 100644
--- a/ext/dom/tests/DOMDocument_loadXML_error6.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_error6.phpt
@@ -8,9 +8,9 @@ dom
$dom = new DOMDocument();
try {
$dom->loadXML("");
-} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..05da066d4e8a 100644
--- a/ext/dom/tests/DOMDocument_load_error6.phpt
+++ b/ext/dom/tests/DOMDocument_load_error6.phpt
@@ -8,20 +8,20 @@ dom
$dom = new DOMDocument();
try {
$dom->load("");
-} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
$dom->load("/path/with/\0/byte");
-} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..5288864e6e18 100644
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
@@ -9,9 +9,9 @@ dom
getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--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..a4fec56433c8 100644
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTMLFile_invalid_filename.phpt
@@ -19,9 +19,9 @@ $text = $doc->createTextNode('This is the title');
$text = $title->appendChild($text);
try {
$doc->saveHTMLFile($filename);
-} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ 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..6f7093d61024 100644
--- a/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
@@ -9,9 +9,9 @@ dom
getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--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..0aa33d74d7f2 100644
--- a/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidateSource_error3.phpt
@@ -14,10 +14,10 @@ $doc->load(__DIR__."/book.xml");
try {
$doc->schemaValidateSource('');
-} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ 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..686952b197c3 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_error3.phpt
@@ -14,10 +14,10 @@ $doc->load(__DIR__."/book.xml");
try {
$doc->schemaValidate('');
-} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ 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..3407640c66b6 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_error6.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_error6.phpt
@@ -11,15 +11,15 @@ $doc->load(__DIR__."/book.xml");
try {
$doc->schemaValidate("/path/with/\0/byte");
-} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ 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..3b2d3c8fc4f9 100644
--- a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
+++ b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
@@ -19,9 +19,9 @@ var_dump($doc->strictErrorChecking);
echo "Should throw DOMException when strictErrorChecking is on\n";
try {
$attr = $doc->createAttribute(0);
-} catch (DOMException $e) {
+} catch (Throwable $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";
}
@@ -36,9 +36,9 @@ var_dump($doc->strictErrorChecking);
echo "Should raise PHP error because strictErrorChecking is off\n";
try {
$attr = $doc->createAttribute(0);
-} catch (DOMException $e) {
+} catch (Throwable $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..bfd952d8149e 100644
--- a/ext/dom/tests/DOMDocument_validate_error2.phpt
+++ b/ext/dom/tests/DOMDocument_validate_error2.phpt
@@ -9,9 +9,9 @@ dom
getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--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..ca6f88f8ac51 100644
--- a/ext/dom/tests/DOMDocument_version_write.phpt
+++ b/ext/dom/tests/DOMDocument_version_write.phpt
@@ -18,8 +18,8 @@ echo $dom->saveXML();
try {
$dom->version = new MyThrowingStringable;
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ 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..2c17d887e0af 100644
--- a/ext/dom/tests/DOMElement_append_hierarchy_test.phpt
+++ b/ext/dom/tests/DOMElement_append_hierarchy_test.phpt
@@ -41,8 +41,8 @@ $dom = clone $dom_original;
$b_hello = $dom->firstChild->firstChild;
try {
$b_hello->append($b_hello);
-} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveHTML());
@@ -51,8 +51,8 @@ $dom = clone $dom_original;
$b_hello = $dom->firstChild->firstChild;
try {
$b_hello->append($b_hello, "foo");
-} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveHTML());
@@ -62,8 +62,8 @@ $b_hello = $dom->firstChild->firstChild;
$b_world = $b_hello->nextSibling;
try {
$b_world->firstChild->append($b_world);
-} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($dom->saveHTML());
@@ -73,8 +73,8 @@ $dom2 = new DOMDocument;
$dom2->loadXML('other
');
try {
$dom->firstChild->firstChild->prepend($dom2->firstChild);
-} catch (\DOMException $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ 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"