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" 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..a82458abafec 100644 --- a/ext/dom/tests/DOMElement_insertAdjacentElement.phpt +++ b/ext/dom/tests/DOMElement_insertAdjacentElement.phpt @@ -17,8 +17,8 @@ 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"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Hierarchy test ---\n"; @@ -28,8 +28,8 @@ $child = $element->appendChild($dom->createElement('child')); foreach (['beforebegin', 'afterbegin', 'beforeend', 'afterend'] as $where) { try { var_dump($child->insertAdjacentElement($where, $element)->tagName); - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..659ae53587a9 100644 --- a/ext/dom/tests/DOMElement_insertAdjacentText.phpt +++ b/ext/dom/tests/DOMElement_insertAdjacentText.phpt @@ -12,8 +12,8 @@ echo "--- Edge cases ---\n"; try { $dom->createElement('free')->insertAdjacentText("bogus", "bogus"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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 --- A

foo

diff --git a/ext/dom/tests/DOMElement_prefix_empty.phpt b/ext/dom/tests/DOMElement_prefix_empty.phpt index 8cd3515889e9..a5150218a97e 100644 --- a/ext/dom/tests/DOMElement_prefix_empty.phpt +++ b/ext/dom/tests/DOMElement_prefix_empty.phpt @@ -29,8 +29,8 @@ echo "--- Changing the prefix to that of a conflicting namespace (\"conflict\") try { $container->prefix = "conflict"; -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..1dc34ffc4737 100644 --- a/ext/dom/tests/DOMElement_prepend_hierarchy_test.phpt +++ b/ext/dom/tests/DOMElement_prepend_hierarchy_test.phpt @@ -48,8 +48,8 @@ $dom = clone $dom_original; $b_hello = $dom->firstChild->firstChild; try { $b_hello->prepend($b_hello); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveHTML()); @@ -58,8 +58,8 @@ $dom = clone $dom_original; $b_hello = $dom->firstChild->firstChild; try { $b_hello->prepend($b_hello, "foo"); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveHTML()); @@ -69,8 +69,8 @@ $b_hello = $dom->firstChild->firstChild; $b_world = $b_hello->nextSibling; try { $b_world->firstChild->prepend($b_world); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->saveHTML()); @@ -80,8 +80,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()); @@ -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..3244462dc44e 100644 --- a/ext/dom/tests/DOMElement_replaceChildren.phpt +++ b/ext/dom/tests/DOMElement_replaceChildren.phpt @@ -12,14 +12,14 @@ echo "--- Edge cases ---\n"; try { $dom->documentElement->replaceChildren($dom->documentElement); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->documentElement->firstElementChild->replaceChildren($dom->documentElement); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..3fe061b2cdd1 100644 --- a/ext/dom/tests/DOMElement_toggleAttribute.phpt +++ b/ext/dom/tests/DOMElement_toggleAttribute.phpt @@ -12,8 +12,8 @@ $xml->loadXML(''); try { var_dump($html->documentElement->toggleAttribute("\0")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..eaf118a0b1d9 100644 --- a/ext/dom/tests/DOMEntityReference_error1.phpt +++ b/ext/dom/tests/DOMEntityReference_error1.phpt @@ -6,11 +6,11 @@ dom 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/DOMNamedNodeMap_edge_case_offset.phpt b/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt index 30a961143c77..4538112b4d6a 100644 --- a/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt +++ b/ext/dom/tests/DOMNamedNodeMap_edge_case_offset.phpt @@ -13,17 +13,17 @@ var_dump($root->attributes->length); // Consistent with the method call try { var_dump($root->attributes[-1]); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..11d9874e42bb 100644 --- a/ext/dom/tests/DOMNode_C14NFile_basic.phpt +++ b/ext/dom/tests/DOMNode_C14NFile_basic.phpt @@ -27,13 +27,13 @@ $content = file_get_contents($output); var_dump($content); try { var_dump($node->C14NFile($output, false, false, [])); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($node->C14NFile($output, false, false, ['query' => []])); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --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..f624070efcd4 100644 --- a/ext/dom/tests/DOMNode_C14N_basic.phpt +++ b/ext/dom/tests/DOMNode_C14N_basic.phpt @@ -25,16 +25,16 @@ var_dump($node->C14N()); try { var_dump($node->C14N(false, false, [])); -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($node->C14N(false, false, ['query' => []])); -} catch (\TypeError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --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..35a5240b1249 100644 --- a/ext/dom/tests/DOMNode_contains.phpt +++ b/ext/dom/tests/DOMNode_contains.phpt @@ -34,8 +34,8 @@ var_dump($dom->documentElement->contains(null)); try { var_dump($dom->contains(new stdClass)); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..1cc2d7568362 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error1.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error1.phpt @@ -15,10 +15,10 @@ $node_in_doc2 = $doc2->createElement("bar"); try { $node_in_doc2->insertBefore($node_in_doc1); -} catch(DOMException $e) { - echo $e->getMessage(); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --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..761baf2c04c0 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error2.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error2.phpt @@ -27,10 +27,10 @@ $ref_node = $dom->getElementsByTagName("book")->item(1); try { $parent_node->insertBefore($new_node, $ref_node); -} 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/DOMNode_insertBefore_error3.phpt b/ext/dom/tests/DOMNode_insertBefore_error3.phpt index 9fa25e3b2acd..6daf1046edaf 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error3.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error3.phpt @@ -28,10 +28,10 @@ assert(!is_null($ref_node)); try { $parent_node->insertBefore($new_node, $ref_node); -} 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/DOMNode_insertBefore_error4.phpt b/ext/dom/tests/DOMNode_insertBefore_error4.phpt index 41838bb78a1e..003c126a087c 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error4.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error4.phpt @@ -27,10 +27,10 @@ $ref_node = $dom->createElement('newnode2'); try { $parent_node->insertBefore($new_node, $ref_node); -} 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/DOMNode_insertBefore_error5.phpt b/ext/dom/tests/DOMNode_insertBefore_error5.phpt index 17ac53820662..ae127b17e584 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error5.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error5.phpt @@ -29,10 +29,10 @@ $dom->saveXML(); try { $parent_node->insertBefore($new_node, $ref_node); -} 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/DOMNode_insertBefore_error6.phpt b/ext/dom/tests/DOMNode_insertBefore_error6.phpt index a8348791f175..ff0ae450f893 100644 --- a/ext/dom/tests/DOMNode_insertBefore_error6.phpt +++ b/ext/dom/tests/DOMNode_insertBefore_error6.phpt @@ -24,10 +24,10 @@ assert($new_node !== false); try { $parent_node->insertBefore($new_node, $ref_node); -} 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/DOMNode_removeChild_error1.phpt b/ext/dom/tests/DOMNode_removeChild_error1.phpt index 05d3c31624f9..5f8cf1ab5198 100644 --- a/ext/dom/tests/DOMNode_removeChild_error1.phpt +++ b/ext/dom/tests/DOMNode_removeChild_error1.phpt @@ -13,8 +13,8 @@ $real_parent->appendChild($child1); $parent->appendChild($child2); try { $parent->removeChild($child1); -} catch (DOMException $e) { - echo "DOMException: " . $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/dom/tests/DOMNode_replaceChild_error1.phpt b/ext/dom/tests/DOMNode_replaceChild_error1.phpt index f276fc8d207e..2e050707c70e 100644 --- a/ext/dom/tests/DOMNode_replaceChild_error1.phpt +++ b/ext/dom/tests/DOMNode_replaceChild_error1.phpt @@ -14,8 +14,8 @@ $real_parent->appendChild($child1); $parent->appendChild($child2); try { $parent->replaceChild($child3, $child1); -} catch (DOMException $e) { - echo "DOMException: " . $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/dom/tests/DOMNode_replaceChild_error2.phpt b/ext/dom/tests/DOMNode_replaceChild_error2.phpt index 160838a537d1..bf608b181513 100644 --- a/ext/dom/tests/DOMNode_replaceChild_error2.phpt +++ b/ext/dom/tests/DOMNode_replaceChild_error2.phpt @@ -12,8 +12,8 @@ $a->appendChild($b); $b->appendChild($c); try { $b->replaceChild($a, $c); -} catch (DOMException $e) { - echo "DOMException: " . $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/dom/tests/DOMProcessingInstruction.phpt b/ext/dom/tests/DOMProcessingInstruction.phpt index ca79e31966ef..2602c0f92b3b 100644 --- a/ext/dom/tests/DOMProcessingInstruction.phpt +++ b/ext/dom/tests/DOMProcessingInstruction.phpt @@ -15,8 +15,8 @@ echo "--- Test construction ---\n"; try { $pi = new DOMProcessingInstruction("\0"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..402d7b285a16 100644 --- a/ext/dom/tests/DOMXPath_callables.phpt +++ b/ext/dom/tests/DOMXPath_callables.phpt @@ -30,8 +30,8 @@ $xpath = new DOMXPath($doc); $xpath->registerNamespace("php", "http://php.net/xpath"); try { $xpath->evaluate("//a[php:function('var_dump', string(@href))]"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..a34427ebefd8 100644 --- a/ext/dom/tests/DOMXPath_callables_errors.phpt +++ b/ext/dom/tests/DOMXPath_callables_errors.phpt @@ -11,50 +11,50 @@ $doc->loadHTML('hello'); $xpath = new DOMXPath($doc); try { $xpath->registerPhpFunctions("nonexistent"); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctions(function () {}); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..3d29b23cb81c 100644 --- a/ext/dom/tests/DOMXPath_clone.phpt +++ b/ext/dom/tests/DOMXPath_clone.phpt @@ -13,10 +13,10 @@ $dom = new DOMDocument; $xpath = new DOMXPath($dom); try { clone $xpath; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..d9ac8b0ae5f1 100644 --- a/ext/dom/tests/bug44648.phpt +++ b/ext/dom/tests/bug44648.phpt @@ -13,33 +13,33 @@ $root = $doc->documentElement; try { $attr = new DOMAttr('@acb', '123'); $root->setAttributeNode($attr); -} catch (DOMException $e) { - echo $e->getMessage()."\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->setAttribute('@def', '456'); -} catch (DOMException $e) { - echo $e->getMessage()."\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->setAttributeNS(NULL, '@ghi', '789'); -} catch (DOMException $e) { - echo $e->getMessage()."\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->setAttributeNS('urn::test', 'a:g@hi', '789'); -} catch (DOMException $e) { - echo $e->getMessage()."\n"; +} catch (Throwable $e) { + 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..30c4b8703fbe 100644 --- a/ext/dom/tests/bug47430.phpt +++ b/ext/dom/tests/bug47430.phpt @@ -13,8 +13,8 @@ $elements = $dom->getElementsByTagName('i'); foreach ($elements as $i) { try { $i->previousSibling->nodeValue = ''; - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..06649464ed7f 100644 --- a/ext/dom/tests/bug66783.phpt +++ b/ext/dom/tests/bug66783.phpt @@ -9,9 +9,9 @@ $doc->loadXML(''); $e = $doc->createElement('e'); try { $e->appendChild($doc); -} catch (DOMException $ex) { - echo $ex->getMessage(), PHP_EOL; +} catch (Throwable $ex) { + echo $ex::class, ': ', $ex->getMessage(), "\n"; } ?> --EXPECT-- -Hierarchy Request Error +DOMException: Hierarchy Request Error diff --git a/ext/dom/tests/bug67949.phpt b/ext/dom/tests/bug67949.phpt index f087633bdfe6..8f1bd99ea094 100644 --- a/ext/dom/tests/bug67949.phpt +++ b/ext/dom/tests/bug67949.phpt @@ -45,8 +45,8 @@ var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent); echo "--- testing read_dimension with null offset ---\n"; try { var_dump($nodes[][] = 1); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..0ebf39f59464 100644 --- a/ext/dom/tests/bug77569.phpt +++ b/ext/dom/tests/bug77569.phpt @@ -8,9 +8,9 @@ $imp = new DOMImplementation; $dom = $imp->createDocument("", ""); try { $dom->encoding = null; -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --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..2fe203f3ecd4 100644 --- a/ext/dom/tests/c14n_no_nodeset_returned.phpt +++ b/ext/dom/tests/c14n_no_nodeset_returned.phpt @@ -8,9 +8,9 @@ $dom = new DOMDocument; $dom->loadXML('test'); try { $dom->documentElement->C14N(true, false, ['query' => 'string(./root/text())']); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..a093abe56fe8 100644 --- a/ext/dom/tests/clone_list_map_collection.phpt +++ b/ext/dom/tests/clone_list_map_collection.phpt @@ -9,42 +9,42 @@ $dom = new DOMDocument; $dom->loadXML(''); try { clone $dom->documentElement->attributes; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone $dom->documentElement->childNodes; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom = Dom\XMLDocument::createFromString(']>'); try { clone $dom->documentElement->attributes; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone $dom->documentElement->childNodes; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone $dom->documentElement->children; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { clone $dom->doctype->entities; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..179ed7e65b58 100644 --- a/ext/dom/tests/dom_import_simplexml.phpt +++ b/ext/dom/tests/dom_import_simplexml.phpt @@ -16,8 +16,8 @@ print $dom->ownerDocument->saveXML(); // This should fail because it has been imported already above in legacy DOM try { Dom\import_simplexml($s); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..3c7b96993a30 100644 --- a/ext/dom/tests/dom_xinclude_errors.phpt +++ b/ext/dom/tests/dom_xinclude_errors.phpt @@ -14,10 +14,10 @@ $dom->xinclude(PHP_INT_MAX); $dom = Dom\XMLDocument::createEmpty(); try { $dom->xinclude(PHP_INT_MAX); -} catch (ValueError $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --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..19ee76332134 100644 --- a/ext/dom/tests/domxpath.phpt +++ b/ext/dom/tests/domxpath.phpt @@ -54,14 +54,14 @@ var_dump($avg); try { $xpath->registerPHPFunctions('non_existent'); $avg = $xpath->evaluate('number(php:function("non_existent", //def:testnode))'); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctions(['non_existant']); $avg = $xpath->evaluate('number(php:function("non_existent", //def:testnode))'); -} catch (\Error $e) { - echo $e->getMessage() . \PHP_EOL; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --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..95abfb07ef56 100644 --- a/ext/dom/tests/entity_reference_stale_02.phpt +++ b/ext/dom/tests/entity_reference_stale_02.phpt @@ -26,8 +26,8 @@ unset($decl); try { var_dump($iter->current()->publicId); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..7c5281e1044b 100644 --- a/ext/dom/tests/gh11830/attribute_variation.phpt +++ b/ext/dom/tests/gh11830/attribute_variation.phpt @@ -14,42 +14,42 @@ XML); try { $doc->documentElement->firstElementChild->prepend($doc->documentElement->attributes[0]); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->append($doc->documentElement->attributes[0]); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->before($doc->documentElement->attributes[0]); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->after($doc->documentElement->attributes[0]); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->replaceWith($doc->documentElement->attributes[0]); -} catch (\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + 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..be7056d999c4 100644 --- a/ext/dom/tests/gh11830/document_variation.phpt +++ b/ext/dom/tests/gh11830/document_variation.phpt @@ -26,8 +26,8 @@ function test($method) { try { $doc->documentElement->firstElementChild->$method($testElement, $otherElement); - } catch (\DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + 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..7a8322e1fd19 100644 --- a/ext/dom/tests/gh11830/hierarchy_variation.phpt +++ b/ext/dom/tests/gh11830/hierarchy_variation.phpt @@ -20,8 +20,8 @@ function test($method) { try { $testElement->$method($alone, $container); - } catch (\DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + 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..d2366b678a5e 100644 --- a/ext/dom/tests/gh11830/type_variation.phpt +++ b/ext/dom/tests/gh11830/type_variation.phpt @@ -17,42 +17,42 @@ $testElement = $doc->documentElement->firstElementChild->nextElementSibling->fir try { $doc->documentElement->firstElementChild->prepend($testElement, 0); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->append($testElement, true); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->before($testElement, null); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->after($testElement, new stdClass); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $doc->documentElement->firstElementChild->replaceWith($testElement, []); -} catch (\TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (\Throwable $e) { + 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..2512aa7d23fb 100644 --- a/ext/dom/tests/gh12002.phpt +++ b/ext/dom/tests/gh12002.phpt @@ -15,24 +15,24 @@ $dom->encoding = make_nonconst('utf-8'); var_dump($dom->encoding); try { $dom->encoding = make_nonconst('foobar'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->encoding); $dom->encoding = make_nonconst('utf-16le'); var_dump($dom->encoding); try { $dom->encoding = NULL; -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..0094c84eafb0 100644 --- a/ext/dom/tests/gh13960.phpt +++ b/ext/dom/tests/gh13960.phpt @@ -9,9 +9,9 @@ $domd = new DOMDocument(); $xp = new DOMXPath($domd); try { $xp->query("//foo[contains(text(), " . $xp->quote("tes\x00t") . ")]"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..249795c5a12e 100644 --- a/ext/dom/tests/gh15910.phpt +++ b/ext/dom/tests/gh15910.phpt @@ -10,9 +10,9 @@ $doc = new DOMDocument(); $doc->appendChild($doc->createElement('container')); try { $doc->documentElement->setAttributeNodeNS($doc); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..fc3f519e72c8 100644 --- a/ext/dom/tests/gh16039.phpt +++ b/ext/dom/tests/gh16039.phpt @@ -9,23 +9,23 @@ $dom = new DOMDocument; $element = $dom->appendChild($dom->createElement('root')); try { $element->prepend('x', new DOMEntity); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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"; +} catch (Throwable $e) { + 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..d2fd5d2915f1 100644 --- a/ext/dom/tests/gh16151.phpt +++ b/ext/dom/tests/gh16151.phpt @@ -13,13 +13,13 @@ $element->setAttributeNodeNS($attr); try { $attr->insertBefore(new DOMComment("h")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $attr->appendChild(new DOMComment("h")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..2e1877862a54 100644 --- a/ext/dom/tests/gh16190.phpt +++ b/ext/dom/tests/gh16190.phpt @@ -9,10 +9,10 @@ $doc = Dom\XMLDocument::createEmpty(); $rm = new ReflectionMethod($doc, '__construct'); try { $rm->invoke($doc); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..1ddf969ef598 100644 --- a/ext/dom/tests/gh16316.phpt +++ b/ext/dom/tests/gh16316.phpt @@ -12,14 +12,14 @@ class Demo extends DOMXPath { $demo = new Demo; try { var_dump($demo); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($demo->document); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..492f86833a73 100644 --- a/ext/dom/tests/gh16465.phpt +++ b/ext/dom/tests/gh16465.phpt @@ -8,22 +8,22 @@ dom $v10 = new DOMElement("a"); try { $v10->getElementsByTagName("text\0something"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $v10->getElementsByTagNameNS("", "text\0something"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $v10->getElementsByTagNameNS("text\0something", ""); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..45850f00b4f8 100644 --- a/ext/dom/tests/gh16533.phpt +++ b/ext/dom/tests/gh16533.phpt @@ -8,13 +8,13 @@ dom $doc = new DOMDocument(); try { $doc->appendChild($doc->createAttribute('foo')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..0e743dd70c03 100644 --- a/ext/dom/tests/gh16535.phpt +++ b/ext/dom/tests/gh16535.phpt @@ -11,15 +11,15 @@ $v2->loadHTML("t"); $v4 = $v2->createElement('foo'); try { $v4->appendChild($v2); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..ed108513dce4 100644 --- a/ext/dom/tests/gh16593.phpt +++ b/ext/dom/tests/gh16593.phpt @@ -10,13 +10,13 @@ $root = $doc->appendChild($doc->createElement('root')); $child = $root->appendChild($doc->createElement('child')); try { $root->replaceChild($doc->createAttribute('foo'), $child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..aef53dd83f69 100644 --- a/ext/dom/tests/gh16594.phpt +++ b/ext/dom/tests/gh16594.phpt @@ -16,10 +16,10 @@ $v7->appendChild($v1); try { $v1->before($v6); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..be2dc88a0f46 100644 --- a/ext/dom/tests/gh16777_1.phpt +++ b/ext/dom/tests/gh16777_1.phpt @@ -13,12 +13,12 @@ echo $doc->saveXML(); $dom2 = new DOMDocument(); try { $dom2->appendChild($text); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..b0f1506c8551 100644 --- a/ext/dom/tests/gh16777_2.phpt +++ b/ext/dom/tests/gh16777_2.phpt @@ -14,8 +14,8 @@ echo $doc->saveXML(); $dom2 = new DOMDocument(); try { $dom2->appendChild($el); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..625a041ce7d1 100644 --- a/ext/dom/tests/gh17847.phpt +++ b/ext/dom/tests/gh17847.phpt @@ -37,16 +37,16 @@ foreach ($xpath->query('//p') as $entry) { foreach ($garbage as $node) { try { var_dump($node->localName); - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..04e1d8a00af3 100644 --- a/ext/dom/tests/modern/common/template_rename.phpt +++ b/ext/dom/tests/modern/common/template_rename.phpt @@ -19,8 +19,8 @@ var_dump($template->innerHTML); try { $template->rename($template->namespaceURI, 'screwthis'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } // These shouldn't be changed! @@ -30,6 +30,6 @@ var_dump($template->innerHTML); ?> --EXPECT-- string(16) "a
foo
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) "a
foo
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..83940435a53d 100644 --- a/ext/dom/tests/modern/css_selectors/closest_invalid_selector.phpt +++ b/ext/dom/tests/modern/css_selectors/closest_invalid_selector.phpt @@ -9,10 +9,10 @@ $dom = DOM\XMLDocument::createFromString(""); try { var_dump($dom->documentElement->closest('@invalid')); -} catch (DOMException $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --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..02e026da7e52 100644 --- a/ext/dom/tests/modern/css_selectors/combinators.phpt +++ b/ext/dom/tests/modern/css_selectors/combinators.phpt @@ -56,8 +56,8 @@ test_helper($dom, 'article[title].bar p'); try { test_helper($dom, 'col.selected||td'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..936b9d541acd 100644 --- a/ext/dom/tests/modern/css_selectors/matches_invalid_selector.phpt +++ b/ext/dom/tests/modern/css_selectors/matches_invalid_selector.phpt @@ -9,10 +9,10 @@ $dom = DOM\XMLDocument::createFromString(""); try { var_dump($dom->documentElement->matches('@invalid')); -} catch (DOMException $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --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..acecf6903fe9 100644 --- a/ext/dom/tests/modern/css_selectors/pseudo_classes_blank.phpt +++ b/ext/dom/tests/modern/css_selectors/pseudo_classes_blank.phpt @@ -13,11 +13,11 @@ XML); try { test_helper($dom, ':blank'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..9a545dd767a0 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 @@ -9,17 +9,17 @@ $dom = DOM\XMLDocument::createEmpty(); $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"; +} catch (Throwable $e) { + 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"; +} catch (Throwable $e) { + 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..4a7d5007ea4c 100644 --- a/ext/dom/tests/modern/extensions/attribute_renaming_conflict.phpt +++ b/ext/dom/tests/modern/extensions/attribute_renaming_conflict.phpt @@ -19,38 +19,38 @@ XML, LIBXML_DTDATTR); $root = $dom->documentElement; try { $root->attributes[0]->rename(NULL, 'c'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->attributes[0]->rename(NULL, 'c'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->attributes[1]->rename(NULL, 'a'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->attributes[1]->rename('urn:a', 'foo'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->attributes[3]->rename('', 'a'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->firstElementChild->attributes[0]->rename(NULL, 'hello'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $root->firstElementChild->attributes[1]->rename(NULL, 'my-attr'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..2dcd71d25547 100644 --- a/ext/dom/tests/modern/extensions/node_renaming_validation_errors.phpt +++ b/ext/dom/tests/modern/extensions/node_renaming_validation_errors.phpt @@ -9,21 +9,21 @@ $dom = Dom\XMLDocument::createFromString(''); try { $dom->documentElement->rename('', 'a:b'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->documentElement->rename('urn:a', 'a:b:c'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..12115e2e16a9 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 @@ -7,8 +7,8 @@ dom try { Dom\HTMLDocument::createFromFile(__DIR__ . '/gb18030_without_charset.html', overrideEncoding: 'nonexistent'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..43be0bcea45f 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 @@ -7,8 +7,8 @@ dom try { Dom\HTMLDocument::createFromString(file_get_contents(__DIR__ . '/gb18030_without_charset.html'), overrideEncoding: 'nonexistent'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..b2869676c7a6 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 @@ -11,33 +11,33 @@ $dom->inputEncoding = "CSeuckr"; var_dump($dom->characterSet); try { $dom->charset = "nope"; -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->charset); $dom->inputEncoding = "Windows-1251"; var_dump($dom->characterSet); try { $dom->charset = ""; -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($dom->inputEncoding); echo $dom->saveHtml(); try { $dom = Dom\HTMLDocument::createEmpty("bogus"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..b978eddf1da9 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); } @@ -33,8 +33,8 @@ echo "--- Set body without document element ---\n"; $dom = DOM\XMLDocument::createEmpty(); try { $dom->body = $dom->createElementNS("http://www.w3.org/1999/xhtml", "body"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..a0b03df695c8 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 @@ -12,16 +12,16 @@ echo "--- BeforeBegin no parent ---\n"; try { $element->insertAdjacentHTML(Dom\AdjacentPosition::BeforeBegin, "test"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- AfterEnd no parent ---\n"; try { $element->insertAdjacentHTML(Dom\AdjacentPosition::AfterEnd, "test"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom->appendChild($element); @@ -30,25 +30,25 @@ echo "--- BeforeBegin document parent ---\n"; try { $element->insertAdjacentHTML(Dom\AdjacentPosition::BeforeBegin, "test"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- AfterEnd document parent ---\n"; try { $element->insertAdjacentHTML(Dom\AdjacentPosition::AfterEnd, "test"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..1554e9e582fa 100644 --- a/ext/dom/tests/modern/html/interactions/HTMLCollection_dimension_errors.phpt +++ b/ext/dom/tests/modern/html/interactions/HTMLCollection_dimension_errors.phpt @@ -9,24 +9,24 @@ $dom = Dom\XMLDocument::createFromString(''); try { $dom->getElementsByTagName('root')[][1] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->getElementsByTagName('root')[true]; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { isset($dom->getElementsByTagName('root')[true]); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..04eceb443455 100644 --- a/ext/dom/tests/modern/html/interactions/HTMLDocument_registerNodeClass_02.phpt +++ b/ext/dom/tests/modern/html/interactions/HTMLDocument_registerNodeClass_02.phpt @@ -13,8 +13,8 @@ class Custom extends Dom\Document { $dom = Dom\HTMLDocument::createEmpty(); try { $dom->registerNodeClass("Dom\\Document", "Custom"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..be491c66fbbc 100644 --- a/ext/dom/tests/modern/html/interactions/without_constructor.phpt +++ b/ext/dom/tests/modern/html/interactions/without_constructor.phpt @@ -9,12 +9,12 @@ foreach (['Dom\HTMLDocument', 'Dom\XMLDocument'] as $class) { try { $rc = new ReflectionClass($class); $rc->newInstanceWithoutConstructor(); - } catch (ReflectionException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..398a927ad177 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 @@ -7,16 +7,16 @@ dom try { Dom\HTMLDocument::createFromFile("\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { Dom\HTMLDocument::createFromFile('%00'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..f3f00b581718 100644 --- a/ext/dom/tests/modern/html/parser/HTMLDocument_parse_options.phpt +++ b/ext/dom/tests/modern/html/parser/HTMLDocument_parse_options.phpt @@ -31,8 +31,8 @@ foreach (["createFromString", "createFromFile"] as $method) { var_dump($options); try { Dom\HTMLDocument::{$method}("x", $options); - } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..0cefe145ead1 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 @@ -18,8 +18,8 @@ $dom = new DOMDocument; $comment = $dom->createComment("foobarbaz"); try { $comment->deleteData(3, -1); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..1aaf24a8969e 100644 --- a/ext/dom/tests/modern/spec/CharacterData_insertData_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_insertData_edge_cases.phpt @@ -11,18 +11,18 @@ $dom = Dom\HTMLDocument::createEmpty(); $comment = $dom->createComment("foobarbaz"); try { var_dump($comment->insertData(100, "data")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($comment->insertData(2**31+1, "data")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..c024c876dc7b 100644 --- a/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_insertData_negative_offset.phpt @@ -9,8 +9,8 @@ $dom = Dom\HTMLDocument::createEmpty(); $comment = $dom->createComment("foobarbaz"); try { $comment->insertData(-1, "A"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..c2feefd45ab0 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 @@ -15,8 +15,8 @@ $dom = Dom\HTMLDocument::createEmpty(); $comment = $dom->createComment("foobarbaz"); try { $comment->insertData(-1, "A"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom->saveHtml($comment), "\n"; $comment->insertData(-(2**32 - 1), "A"); @@ -28,25 +28,25 @@ $dom = new DOMDocument; $comment = $dom->createComment("foobarbaz"); try { $comment->insertData(-1, "A"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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"; +} catch (Throwable $e) { + 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..a85587c7d262 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 @@ -25,14 +25,14 @@ $dom = new DOMDocument; $comment = $dom->createComment("foobarbaz"); try { $comment->replaceData(0, -1, "A"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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"; +} catch (Throwable $e) { + 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..e7f81f765dbe 100644 --- a/ext/dom/tests/modern/spec/CharacterData_substringData_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_substringData_edge_cases.phpt @@ -11,24 +11,24 @@ $dom = Dom\HTMLDocument::createEmpty(); $comment = $dom->createComment("foobarbaz"); try { var_dump($comment->substringData(0, 2**31+1)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($comment->substringData(2**31+1, 0)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($comment->substringData(100, 0)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..5e980a1521b6 100644 --- a/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments.phpt +++ b/ext/dom/tests/modern/spec/CharacterData_substringData_negative_arguments.phpt @@ -13,8 +13,8 @@ var_dump($comment->substringData(2, -2)); echo $dom->saveHtml($comment), "\n"; try { var_dump($comment->substringData(-2, 2)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..ef85193c35cb 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 @@ -26,20 +26,20 @@ $dom = new DOMDocument; $comment = $dom->createComment("foobarbaz"); try { var_dump($comment->substringData(0, -1)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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"; +} catch (Throwable $e) { + 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"; +} catch (Throwable $e) { + 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..58f8b3e3e910 100644 --- a/ext/dom/tests/modern/spec/Document_createAttributeNS.phpt +++ b/ext/dom/tests/modern/spec/Document_createAttributeNS.phpt @@ -10,9 +10,9 @@ require __DIR__ . '/dump_attr.inc'; function testErrorCase($dom, $ns, $qname) { try { $dom->createAttributeNS($ns, $qname); - } catch (DOMException $e) { + } catch (Throwable $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..050b46d03e2b 100644 --- a/ext/dom/tests/modern/spec/Document_createElementNS.phpt +++ b/ext/dom/tests/modern/spec/Document_createElementNS.phpt @@ -32,8 +32,8 @@ function testError($dom, $namespaceURI, $qualifiedName) echo "($ns_readable, \"$qualifiedName\"): "; try { $dom->createElementNS($namespaceURI, $qualifiedName); - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..ac31650f03fb 100644 --- a/ext/dom/tests/modern/spec/Document_createElement_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/Document_createElement_edge_cases.phpt @@ -8,16 +8,16 @@ dom $dom = Dom\HTMLDocument::createEmpty(); try { $dom->createElement(''); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->createElement('$'); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..bddf79c395c0 100644 --- a/ext/dom/tests/modern/spec/Document_implementation_createDocumentType_errors.phpt +++ b/ext/dom/tests/modern/spec/Document_implementation_createDocumentType_errors.phpt @@ -8,22 +8,22 @@ dom $dom = Dom\XMLDocument::createEmpty(); try { $dom->implementation->createDocumentType("invalid name", "public", "system"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->implementation->createDocumentType("", "public", "system"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->implementation->createDocumentType("@", "", ""); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..b43762459883 100644 --- a/ext/dom/tests/modern/spec/Document_implementation_createDocument_errors.phpt +++ b/ext/dom/tests/modern/spec/Document_implementation_createDocument_errors.phpt @@ -9,17 +9,17 @@ $dom = Dom\XMLDocument::createEmpty(); try { $dom->implementation->createDocument("urn:a", "@"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->implementation->createDocument("", "foo:bar"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..bcc735ab7c29 100644 --- a/ext/dom/tests/modern/spec/Document_implementation_same_object.phpt +++ b/ext/dom/tests/modern/spec/Document_implementation_same_object.phpt @@ -17,8 +17,8 @@ var_dump($implementation); try { clone $implementation; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..7367e9fdcfd8 100644 --- a/ext/dom/tests/modern/spec/Document_importNode_not_supported.phpt +++ b/ext/dom/tests/modern/spec/Document_importNode_not_supported.phpt @@ -13,12 +13,12 @@ var_dump($dom->importNode($dom)); $dom = Dom\HTMLDocument::createEmpty(); try { $dom->importNode($dom); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..90eb1570b420 100644 --- a/ext/dom/tests/modern/spec/Element_insertAdjacentText.phpt +++ b/ext/dom/tests/modern/spec/Element_insertAdjacentText.phpt @@ -9,8 +9,8 @@ $dom = Dom\HTMLDocument::createEmpty(); $foo = $dom->appendChild($dom->createElement("foo")); try { $foo->insertAdjacentText(Dom\AdjacentPosition::BeforeBegin, "bar"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..79119f19769f 100644 --- a/ext/dom/tests/modern/spec/Element_prefix_readonly.phpt +++ b/ext/dom/tests/modern/spec/Element_prefix_readonly.phpt @@ -8,11 +8,11 @@ $dom = Dom\HTMLDocument::createEmpty(); $div = $dom->createElement('div'); try { $div->prefix = "foo"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..9a5661b967f8 100644 --- a/ext/dom/tests/modern/spec/Element_removeAttribute_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/Element_removeAttribute_edge_cases.phpt @@ -8,10 +8,10 @@ dom $dom = Dom\XMLDocument::createFromString(''); try { $dom->documentElement->removeAttributeNode($dom->createAttribute('test')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..1baacee26136 100644 --- a/ext/dom/tests/modern/spec/Element_setAttributeNS.phpt +++ b/ext/dom/tests/modern/spec/Element_setAttributeNS.phpt @@ -20,8 +20,8 @@ echo "--- name validation ---\n"; try { $container->setAttributeNS("urn:a", "a:b:c", ""); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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 f6509c07a192..a83c09b0c70a 100644 --- a/ext/dom/tests/modern/spec/Element_setAttributeNode_inuse.phpt +++ b/ext/dom/tests/modern/spec/Element_setAttributeNode_inuse.phpt @@ -13,12 +13,12 @@ $container->setAttributeNode($attr1); $element = $container->appendChild($dom1->createElement("element")); try { $element->setAttributeNode($attr1); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo $dom1->saveHtml(), "\n"; ?> --EXPECT-- -In Use Attribute Error +DOMException: In Use Attribute Error diff --git a/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt b/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt index 1787ae29f95d..fb02c20c7596 100644 --- a/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt +++ b/ext/dom/tests/modern/spec/HTMLDocument_createCDATASection.phpt @@ -7,30 +7,30 @@ dom $dom = Dom\HTMLDocument::createEmpty(); try { $dom->createCDATASection("foo"); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode()); - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->createCDATASection("]]>"); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode()); - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom = Dom\XMLDocument::createEmpty(); try { $dom->createCDATASection("]]>"); -} catch (DOMException $e) { +} catch (Throwable $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..23c8e0a0d7bc 100644 --- a/ext/dom/tests/modern/spec/HTMLDocument_createProcessingInstruction.phpt +++ b/ext/dom/tests/modern/spec/HTMLDocument_createProcessingInstruction.phpt @@ -7,21 +7,21 @@ dom $dom = Dom\HTMLDocument::createEmpty(); try { $dom->createProcessingInstruction("?>", ""); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode()); - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->createProcessingInstruction("?>", "?>"); -} catch (DOMException $e) { +} catch (Throwable $e) { var_dump($e->getCode()); - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->createProcessingInstruction("target", "?>"); -} catch (DOMException $e) { +} catch (Throwable $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..c2f8f4ba5556 100644 --- a/ext/dom/tests/modern/spec/NamedNodeMap_dimensions.phpt +++ b/ext/dom/tests/modern/spec/NamedNodeMap_dimensions.phpt @@ -14,8 +14,8 @@ foreach ($test_values as $value) { echo "--- ", json_encode($value), " ---\n"; try { var_dump($attributes[$value] ? $attributes[$value]->nodeName : "N/A", isset($attributes[$value]), empty($attributes[$value])); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..c6a18db43730 100644 --- a/ext/dom/tests/modern/spec/NamedNodeMap_dimensions_errors.phpt +++ b/ext/dom/tests/modern/spec/NamedNodeMap_dimensions_errors.phpt @@ -10,10 +10,10 @@ $attributes = $dom->documentElement->attributes; try { $attributes[][0] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..710a48b6069b 100644 --- a/ext/dom/tests/modern/spec/NodeList_dimensions.phpt +++ b/ext/dom/tests/modern/spec/NodeList_dimensions.phpt @@ -14,8 +14,8 @@ foreach ($test_values as $value) { echo "--- ", json_encode($value), " ---\n"; try { var_dump($children[$value] ? $children[$value]->nodeName : "N/A", isset($children[$value]), empty($children[$value])); - } catch (Error $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..d5c84550b825 100644 --- a/ext/dom/tests/modern/spec/NodeList_dimensions_errors.phpt +++ b/ext/dom/tests/modern/spec/NodeList_dimensions_errors.phpt @@ -10,10 +10,10 @@ $children = $dom->documentElement->childNodes; try { $children[][0] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..d0b422cb4f7b 100644 --- a/ext/dom/tests/modern/spec/Node_appendChild_attribute.phpt +++ b/ext/dom/tests/modern/spec/Node_appendChild_attribute.phpt @@ -12,13 +12,13 @@ $attr = $dom->createAttribute('bar'); $attr->value = "hello"; try { $element->appendChild($attr); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..3a1cd004bcbf 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 @@ -13,13 +13,13 @@ $fragment->appendChild($dom->createElement('bar')); try { $dom->appendChild($fragment); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..d62df916f3c5 100644 --- a/ext/dom/tests/modern/spec/Node_appendChild_invalid_parent.phpt +++ b/ext/dom/tests/modern/spec/Node_appendChild_invalid_parent.phpt @@ -14,31 +14,31 @@ $attr = $dom->createAttribute('Hello'); try { $text->appendChild($dom->createElement('br')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $cdata->appendChild($dom->createElement('br')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $pi->appendChild($dom->createElement('br')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $attr->appendChild($dom->createElement('br')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..e9352b028254 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 @@ -12,10 +12,10 @@ $dom->appendChild($dom->createElement("foo")); try { $dom->prepend($dom->createElement("bar")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..85527ad89e83 100644 --- a/ext/dom/tests/modern/spec/Node_insertBefore_01.phpt +++ b/ext/dom/tests/modern/spec/Node_insertBefore_01.phpt @@ -13,13 +13,13 @@ $fragment->appendChild($dom->createElement('a')); try { $dom->insertBefore($fragment, $dom->doctype); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..df616b940353 100644 --- a/ext/dom/tests/modern/spec/Node_insertBefore_02.phpt +++ b/ext/dom/tests/modern/spec/Node_insertBefore_02.phpt @@ -12,13 +12,13 @@ $fragment->appendChild($dom->createElement('a')); try { $dom->insertBefore($fragment, $dom->documentElement); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..b35b5f0d7d57 100644 --- a/ext/dom/tests/modern/spec/Node_replaceChild_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/Node_replaceChild_edge_cases.phpt @@ -17,30 +17,30 @@ echo "--- Wrong parent node type ---\n"; $comment = $dom->createComment('This is a comment'); try { $comment->replaceChild($comment, $dom->createElement("old-child")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Node is an inclusive ancestor of parent ---\n"; try { $parent->replaceChild($parent, $child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $parent->replaceChild($dom, $child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } 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"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Invalid child to replace with ---\n"; @@ -48,24 +48,24 @@ echo "--- Invalid child to replace with ---\n"; try { $entityReference = $dom->importNode(Dom\XMLDocument::createEmpty()->createEntityReference("foo")); $parent->replaceChild($entityReference, $child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace element with text in document root ---\n"; try { $dom->replaceChild($dom->createTextNode("text"), $parent); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace child element with doctype inside element ---\n"; try { $parent->replaceChild($dom->doctype, $child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace element with fragment containing multiple elements ---\n"; @@ -76,8 +76,8 @@ $fragment->appendChild($dom->createElement("new-child2")); try { $dom->replaceChild($fragment, $parent); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace comment in document causing more than two elements ---\n"; @@ -85,24 +85,24 @@ echo "--- Replace comment in document causing more than two elements ---\n"; $comment = $dom->appendChild($dom->createComment("comment")); try { $dom->replaceChild($dom->createElement("new-child"), $comment); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace dtd with element ---\n"; try { $dom->replaceChild($dom->createElement("new-child"), $dom->doctype); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Replace element with another dtd ---\n"; try { $dom->replaceChild($dom->doctype, $parent); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..3a2af3d44780 100644 --- a/ext/dom/tests/modern/spec/ParentNode_append_exception_consistency.phpt +++ b/ext/dom/tests/modern/spec/ParentNode_append_exception_consistency.phpt @@ -10,14 +10,14 @@ $fragment->append($element = $dom->createElement("foo")); $fragment->append($dom->createElement("bar")); try { $dom->append($fragment); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + 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..302b9a8032c6 100644 --- a/ext/dom/tests/modern/spec/ParentNode_edge_case.phpt +++ b/ext/dom/tests/modern/spec/ParentNode_edge_case.phpt @@ -9,10 +9,10 @@ $dom = Dom\HTMLDocument::createEmpty(); $container = $dom->createElement('container'); try { $container->append($dom); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..1e58ad9afa95 100644 --- a/ext/dom/tests/modern/spec/ParentNode_hierarchy_text_nodes.phpt +++ b/ext/dom/tests/modern/spec/ParentNode_hierarchy_text_nodes.phpt @@ -9,21 +9,21 @@ $dom = Dom\HTMLDocument::createEmpty(); try { $dom->append("bar"); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->append($dom->createTextNode("bar")); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $text = $dom->createTextNode("bar"); try { $dom->append($text); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($text->parentNode); @@ -33,15 +33,15 @@ $element = $dom->createElement("container"); $text = $element->appendChild($dom->createTextNode("text")); try { $dom->append($text); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + 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..41785ee7b9c2 100644 --- a/ext/dom/tests/modern/spec/Text_splitText_edge_case.phpt +++ b/ext/dom/tests/modern/spec/Text_splitText_edge_case.phpt @@ -9,16 +9,16 @@ $text = $dom->createTextNode('Hello World!'); var_dump($text->splitText(5)->wholeText); try { var_dump($text->splitText(-1)); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($text->splitText(200)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..125c8027ba76 100644 --- a/ext/dom/tests/modern/spec/XMLDocument_version.phpt +++ b/ext/dom/tests/modern/spec/XMLDocument_version.phpt @@ -11,8 +11,8 @@ var_dump($dom->xmlVersion); foreach (['0.1', '1.0', '1.1', '', 'foo'] as $version) { try { $dom->xmlVersion = $version; - } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..673d2b3519b9 100644 --- a/ext/dom/tests/modern/spec/appendChild_dtd_legacy.phpt +++ b/ext/dom/tests/modern/spec/appendChild_dtd_legacy.phpt @@ -24,15 +24,15 @@ $other->appendChild($doctype); $other->appendChild($doctype); try { $other->appendChild($other->implementation->createDocumentType('doc', '', '')); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..ffa90a3bd9d2 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 @@ -9,20 +9,20 @@ $dom = Dom\HTMLDocument::createEmpty(); try { $dom->append("foo", "bar", "baz", $dom); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->append("foo", "bar", "baz"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..3ec21156b44d 100644 --- a/ext/dom/tests/modern/spec/documentURI_URL.phpt +++ b/ext/dom/tests/modern/spec/documentURI_URL.phpt @@ -13,8 +13,8 @@ try { $dom->URL = NULL; var_dump($dom->documentURI); var_dump($dom->URL); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..67c464a3bddf 100644 --- a/ext/dom/tests/modern/spec/pre_insertion_validation.phpt +++ b/ext/dom/tests/modern/spec/pre_insertion_validation.phpt @@ -12,18 +12,18 @@ echo "--- Trying to insert text node into the document ---\n"; try { $dom->append("foo", "bar", "baz"); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->append($dom->createTextNode("text node")); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $dom->append($dom->createCDATASection("text node")); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Trying to insert doctype into not a document ---\n"; @@ -31,16 +31,16 @@ echo "--- Trying to insert doctype into not a document ---\n"; $element = $dom->createElement("foo"); try { $element->append($doctype); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } 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"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Prepend doctype in a document should work ---\n"; @@ -51,8 +51,8 @@ echo "--- Trying to create multiple document roots ---\n"; try { $dom->append($dom->createElement("foo")); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Trying to insert an element before a document type ---\n"; @@ -60,8 +60,8 @@ echo "--- Trying to insert an element before a document type ---\n"; $dom->documentElement->remove(); try { $dom->prepend($element); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Document output ---\n"; @@ -76,8 +76,8 @@ $fragment->append($dom->createElement("foo")); $fragment->append($dom->createElement("bar")); try { $dom->append($fragment); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Document fragment edge cases with text ---\n"; @@ -88,30 +88,30 @@ $fragment->append("foo"); $fragment->append($dom->createCDATASection("bar")); try { $dom->append($fragment); -} catch (DOMException $e) { - echo "Exception: " . $e->getMessage() . "\n"; +} catch (Throwable $e) { + 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..cc26feea8fe7 100644 --- a/ext/dom/tests/modern/spec/textContent_edge_cases.phpt +++ b/ext/dom/tests/modern/spec/textContent_edge_cases.phpt @@ -11,8 +11,8 @@ echo "document text content: "; var_dump($dom->textContent); try { $dom->textContent = "foo"; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..070558edc4c8 100644 --- a/ext/dom/tests/modern/token_list/add_errors.phpt +++ b/ext/dom/tests/modern/token_list/add_errors.phpt @@ -10,32 +10,32 @@ $list = $dom->documentElement->classList; try { $list->add(""); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->add(" "); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->add("\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->add(0); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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/contains_error.phpt b/ext/dom/tests/modern/token_list/contains_error.phpt index 9f402e685f4d..c2bc0865f7b4 100644 --- a/ext/dom/tests/modern/token_list/contains_error.phpt +++ b/ext/dom/tests/modern/token_list/contains_error.phpt @@ -11,10 +11,10 @@ $list = $element->classList; try { $list->contains("\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..e012dfca7aa8 100644 --- a/ext/dom/tests/modern/token_list/dimensions.phpt +++ b/ext/dom/tests/modern/token_list/dimensions.phpt @@ -19,8 +19,8 @@ var_dump($list["0"], isset($list["0"]), empty($list["0"])); echo "--- \"foo\" ---\n"; try { var_dump($list["foo"], isset($list["foo"]), empty($list["foo"])); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..d727a3f434ed 100644 --- a/ext/dom/tests/modern/token_list/dimensions_error.phpt +++ b/ext/dom/tests/modern/token_list/dimensions_error.phpt @@ -17,41 +17,41 @@ $testOffsets = [ foreach ($testOffsets as $offset) { try { $list[$offset]; - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { isset($list[$offset]); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { empty($list[$offset]); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } try { $list[][0] = 1; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..6a1d9f58a5ca 100644 --- a/ext/dom/tests/modern/token_list/foreach_by_ref.phpt +++ b/ext/dom/tests/modern/token_list/foreach_by_ref.phpt @@ -10,10 +10,10 @@ $dom = DOM\XMLDocument::createFromString(''); try { foreach ($dom->documentElement->classList as &$class) { } -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..e14bf249dd43 100644 --- a/ext/dom/tests/modern/token_list/remove_errors.phpt +++ b/ext/dom/tests/modern/token_list/remove_errors.phpt @@ -10,32 +10,32 @@ $list = $dom->documentElement->classList; try { $list->remove(""); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->remove(" "); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->remove("\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->remove(0); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..21fce149b96d 100644 --- a/ext/dom/tests/modern/token_list/replace_error.phpt +++ b/ext/dom/tests/modern/token_list/replace_error.phpt @@ -11,24 +11,24 @@ $list = $element->classList; try { $list->replace("\0", "X"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->replace("X", "\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->replace("a b", "X"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..3c42a1190be7 100644 --- a/ext/dom/tests/modern/token_list/supports.phpt +++ b/ext/dom/tests/modern/token_list/supports.phpt @@ -9,10 +9,10 @@ $dom = DOM\XMLDocument::createFromString(''); $element = $dom->documentElement; try { $element->classList->supports('a'); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..22ef1ed5eaef 100644 --- a/ext/dom/tests/modern/token_list/toggle_error.phpt +++ b/ext/dom/tests/modern/token_list/toggle_error.phpt @@ -11,17 +11,17 @@ $list = $element->classList; try { $list->toggle("\0"); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $list->toggle("a b"); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..ce030dad9f90 100644 --- a/ext/dom/tests/modern/token_list/value_edge_cases.phpt +++ b/ext/dom/tests/modern/token_list/value_edge_cases.phpt @@ -12,8 +12,8 @@ var_dump($list->value); try { $list->value = "\0"; -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..6ac1de9e955e 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 @@ -23,8 +23,8 @@ $overflow = 4294967296; function dump_access(Closure $callback): void { try { var_dump($callback()?->nodeName); - } catch (ValueError $e) { - echo $e->getMessage(), PHP_EOL; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } } @@ -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..53d61facc6bd 100644 --- a/ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt +++ b/ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt @@ -18,8 +18,8 @@ function test($child, $html) { global $dom, $original; try { $child->innerHTML = $html; - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..9e71a18caf09 100644 --- a/ext/dom/tests/modern/xml/Element_innerOuterHTML_reading_errors.phpt +++ b/ext/dom/tests/modern/xml/Element_innerOuterHTML_reading_errors.phpt @@ -16,13 +16,13 @@ function createContainer() { function test($container) { try { var_dump($container->innerHTML); - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($container->outerHTML); - } catch (DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..2f056375b51a 100644 --- a/ext/dom/tests/modern/xml/Element_insertAdjacentHTML_errors.phpt +++ b/ext/dom/tests/modern/xml/Element_insertAdjacentHTML_errors.phpt @@ -8,10 +8,10 @@ dom $dom = Dom\XMLDocument::createFromString(''); try { $dom->documentElement->insertAdjacentHTML(Dom\AdjacentPosition::AfterBegin, ""); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..bdcbfafccedd 100644 --- a/ext/dom/tests/modern/xml/Element_outerHTML_writing_errors.phpt +++ b/ext/dom/tests/modern/xml/Element_outerHTML_writing_errors.phpt @@ -8,18 +8,18 @@ dom $dom = Dom\XMLDocument::createFromString(''); try { $dom->documentElement->outerHTML = ''; -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom = Dom\XMLDocument::createFromString(''); try { $dom->documentElement->firstChild->outerHTML = ''; -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..37ec160ce0d8 100644 --- a/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt +++ b/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt @@ -11,10 +11,10 @@ $child = $comment->nextSibling; try { $comment->removeChild($child); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..74b6da076376 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_createFromFile_override_encoding.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_createFromFile_override_encoding.phpt @@ -7,8 +7,8 @@ dom try { Dom\XMLDocument::createFromFile(__DIR__ . '/dummy.xml', overrideEncoding: 'nonexistent'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..add2a8cdd08b 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_createFromString_override_encoding.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_createFromString_override_encoding.phpt @@ -7,8 +7,8 @@ dom try { Dom\XMLDocument::createFromString(file_get_contents(__DIR__ . '/dummy.xml'), overrideEncoding: 'nonexistent'); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..8ced79db210c 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_fromFile_03.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_fromFile_03.phpt @@ -7,10 +7,10 @@ dom try { Dom\XMLDocument::createFromFile("%00"); -} catch (ValueError $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --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..d56b6ad46858 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt @@ -11,8 +11,8 @@ $flags = [ try { Dom\XMLDocument::createFromString('', -1); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..bd8b15196837 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_xpath.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_xpath.phpt @@ -45,8 +45,8 @@ echo "--- Get a namespace node ---\n"; // Namespace nodes don't exist in modern day DOM. try { var_dump($xpath->evaluate("//*/namespace::*")); -} catch (DOMException $e) { - echo $e->getCode(), ": ", $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..4d0a908c8fcc 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_xpath_errors.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_xpath_errors.phpt @@ -11,11 +11,11 @@ $xpath = new Dom\XPath($dom); try { var_dump($xpath->evaluate('-')); -} catch (Error $e) { - var_dump($e->getMessage()); +} catch (Throwable $e) { + 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..e5d4bb7e9d04 100644 --- a/ext/dom/tests/modern/xml/canonicalize_unattached.phpt +++ b/ext/dom/tests/modern/xml/canonicalize_unattached.phpt @@ -11,10 +11,10 @@ $child->remove(); try { $child->C14N(); -} catch (Dom\DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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/serialize_empty_xmlns.phpt b/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt index 7770143b2248..9de8f4007d4f 100644 --- a/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt +++ b/ext/dom/tests/modern/xml/serialize_empty_xmlns.phpt @@ -15,11 +15,11 @@ $x = $dom->documentElement->firstChild; $x->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:a', ''); try { var_dump($dom->documentElement->innerHTML); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..52c2b61ae459 100644 --- a/ext/dom/tests/modern/xml/simplexml_interop.phpt +++ b/ext/dom/tests/modern/xml/simplexml_interop.phpt @@ -21,8 +21,8 @@ echo $element->ownerDocument->saveXml($element), "\n"; // This should fail because it has been imported already above in modern DOM try { dom_import_simplexml($sxe); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..82bf2d4ad53e 100644 --- a/ext/dom/tests/not_serializable.phpt +++ b/ext/dom/tests/not_serializable.phpt @@ -9,49 +9,49 @@ $doc = new DOMDocument(); $doc->loadXML(''); try { serialize($doc); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $node = $doc->documentElement; try { serialize($node); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $xpath = new DOMXPath($doc); try { serialize($xpath); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $ns = $xpath->query('//namespace::*')->item(0); try { serialize($ns); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $dom = Dom\XMLDocument::createEmpty(); try { serialize($dom); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { serialize(new Dom\XPath($dom)); -} catch (Exception $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..8b3d2ce695c6 100644 --- a/ext/dom/tests/not_unserializable.phpt +++ b/ext/dom/tests/not_unserializable.phpt @@ -16,14 +16,14 @@ foreach ($classes as $class) { try { unserialize('O:' . strlen($class) . ':"' . $class . '":0:{}'); - } catch (Exception $e) { - echo $e->getMessage(), "\n"; + } catch (Throwable $e) { + 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..12e18ac74063 100644 --- a/ext/dom/tests/null_text_content_manipulation.phpt +++ b/ext/dom/tests/null_text_content_manipulation.phpt @@ -7,27 +7,27 @@ dom $text = new DOMText(); try { var_dump($text->substringData(1, 0)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($text->insertData(1, "")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($text->deleteData(1, 1)); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($text->replaceData(1, 1, "")); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..9be75918ec35 100644 --- a/ext/dom/tests/php_function_edge_cases.phpt +++ b/ext/dom/tests/php_function_edge_cases.phpt @@ -12,16 +12,16 @@ $xpath->registerNamespace("php", "http://php.net/xpath"); $xpath->registerPHPFunctions(); try { $xpath->query("//a[php:function(3)]"); -} catch (TypeError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..0459f10b8fea 100644 --- a/ext/dom/tests/property_write_errors.phpt +++ b/ext/dom/tests/property_write_errors.phpt @@ -10,47 +10,47 @@ $dom = new DOMDocument(); try { $dom->nodeValue = []; -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $dom->nodeType += 1; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $dom->xmlEncoding = null; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $entity = new DOMEntity(); try { $entity->actualEncoding = null; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $entity->encoding = null; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { $entity->version = null; -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + 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..e83643702c33 100644 --- a/ext/dom/tests/registerNodeClass_abstract_class.phpt +++ b/ext/dom/tests/registerNodeClass_abstract_class.phpt @@ -13,8 +13,8 @@ $dom = new DOMDocument; try { $dom->registerNodeClass("DOMElement", "Test"); -} catch (ValueError $e) { - echo "ValueError: ", $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..e366b58d3dd7 100644 --- a/ext/dom/tests/registerPhpFunctionNS_errors.phpt +++ b/ext/dom/tests/registerPhpFunctionNS_errors.phpt @@ -17,45 +17,45 @@ $xpath = new DOMXPath($doc); try { $xpath->registerPhpFunctionNS('http://php.net/xpath', 'strtolower', strtolower(...)); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctionNS('http://php.net/xpath', 'test', [new TrampolineClass, 'test']); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctionNS('urn:foo', '$$$', [new TrampolineClass, 'test']); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctionNS('urn:foo', 'x:a', strtolower(...)); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctionNS("urn:foo", "\0", strtolower(...)); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $xpath->registerPhpFunctionNS("\0", 'strtolower', strtolower(...)); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..0ceddc6b4931 100644 --- a/ext/dom/tests/register_node_class.phpt +++ b/ext/dom/tests/register_node_class.phpt @@ -29,8 +29,8 @@ $attr = $root->getAttributeNode('a'); echo get_class($attr), "\n"; try { print $attr->testit()."\n"; -} catch (Error $e) { - echo $e->getMessage(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --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..420b06b78598 100644 --- a/ext/dom/tests/replaceChild_attribute_validation.phpt +++ b/ext/dom/tests/replaceChild_attribute_validation.phpt @@ -11,8 +11,8 @@ $attr->textContent = "test"; try { $attr->replaceChild($dom->createProcessingInstruction('pi'), $attr->firstChild); -} catch (DOMException $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..69fe50112bc3 100644 --- a/ext/dom/tests/unsetting_properties.phpt +++ b/ext/dom/tests/unsetting_properties.phpt @@ -17,16 +17,16 @@ $root = $dom->documentElement; unset($root->myProp); try { $root->myProp; -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unset($root->textContent); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + 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..21ba3ab8df6d 100644 --- a/ext/dom/tests/xpath_domnamespacenode_advanced.phpt +++ b/ext/dom/tests/xpath_domnamespacenode_advanced.phpt @@ -29,8 +29,8 @@ foreach ($xpath->query($query) as $attribute) { // Second & third attempt should fail because it's no longer in the document try { $attribute->parentNode->remove(); - } catch (\DOMException $e) { - echo $e->getMessage(), "\n"; + } catch (\Throwable $e) { + 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