diff --git a/ext/simplexml/tests/012.phpt b/ext/simplexml/tests/012.phpt index a68345d29d9a..1bb9605745d1 100644 --- a/ext/simplexml/tests/012.phpt +++ b/ext/simplexml/tests/012.phpt @@ -14,8 +14,8 @@ $sxe = simplexml_load_string($xml); try { $sxe[""] = "value"; -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $sxe["attr"] = "value"; @@ -28,17 +28,17 @@ echo $sxe->asXML(); try { $sxe[] = "error"; -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } __HALT_COMPILER(); ?> ===DONE=== --EXPECT-- -Cannot create attribute with an empty name +ValueError: Cannot create attribute with an empty name -Cannot append to an attribute list +ValueError: Cannot append to an attribute list diff --git a/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt b/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt index 65f8f7baa8b7..a3b86af10ac5 100644 --- a/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt +++ b/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt @@ -11,13 +11,13 @@ $a = new SimpleXMLElement("testfest"); try { $a->addAttribute( "", "" ); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo $a->asXML(); ?> --EXPECT-- -SimpleXMLElement::addAttribute(): Argument #1 ($qualifiedName) must not be empty +ValueError: SimpleXMLElement::addAttribute(): Argument #1 ($qualifiedName) must not be empty testfest diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt index 8af58ec2a0aa..3eaa4a1fccd1 100644 --- a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt +++ b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt @@ -13,9 +13,9 @@ $xml = @simplexml_load_string("XXXXXXX^", 'SimpleXMLElement', XML_PARSE_RECOVER) // $xml is supposed to hold a SimpleXMLElement, but not FALSE/NULL try { var_dump($xml->xpath("BBBB")); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt index b111b0bfb34a..e156a64dc7c2 100644 --- a/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt +++ b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt @@ -11,11 +11,11 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); try { simplexml_load_string("XXXXXXX^", $x, 0x6000000000000001); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECTF-- Warning: Undefined variable $x in %s on line %d -simplexml_load_string(): Argument #3 ($options) is too large +ValueError: simplexml_load_string(): Argument #3 ($options) is too large diff --git a/ext/simplexml/tests/bug37076_1.phpt b/ext/simplexml/tests/bug37076_1.phpt index ed7fecd104c2..6b2428ee1c9d 100644 --- a/ext/simplexml/tests/bug37076_1.phpt +++ b/ext/simplexml/tests/bug37076_1.phpt @@ -9,13 +9,13 @@ $xml = simplexml_load_string(""); try { $xml->{""} .= "bar"; -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } print $xml->asXML(); ?> --EXPECT-- -Cannot create element with an empty name +ValueError: Cannot create element with an empty name diff --git a/ext/simplexml/tests/bug38406.phpt b/ext/simplexml/tests/bug38406.phpt index 41f2df7aaf60..f56abe5b0a7c 100644 --- a/ext/simplexml/tests/bug38406.phpt +++ b/ext/simplexml/tests/bug38406.phpt @@ -16,8 +16,8 @@ $a = array(); try { $item->$a = new stdclass; -} catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } echo "Done\n"; @@ -33,5 +33,5 @@ object(SimpleXMLElement)#%d (1) { } Warning: Array to string conversion in %s on line %d -It's not possible to assign a complex type to properties, stdClass given +TypeError: It's not possible to assign a complex type to properties, stdClass given Done diff --git a/ext/simplexml/tests/current_error.phpt b/ext/simplexml/tests/current_error.phpt index dc22f735477d..b507eb1c6549 100644 --- a/ext/simplexml/tests/current_error.phpt +++ b/ext/simplexml/tests/current_error.phpt @@ -16,8 +16,8 @@ $sxe = simplexml_load_string($xml); try { $sxe->current(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } for ($sxe->rewind(); $sxe->valid(); $sxe->next()) { @@ -26,14 +26,14 @@ for ($sxe->rewind(); $sxe->valid(); $sxe->next()) { try { $sxe->current(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Iterator not initialized or already consumed +Error: Iterator not initialized or already consumed string(4) "elem" object(SimpleXMLElement)#3 (0) { } -Iterator not initialized or already consumed +Error: Iterator not initialized or already consumed diff --git a/ext/simplexml/tests/gh12929.phpt b/ext/simplexml/tests/gh12929.phpt index 2ae89346dba8..f64bf7280699 100644 --- a/ext/simplexml/tests/gh12929.phpt +++ b/ext/simplexml/tests/gh12929.phpt @@ -8,8 +8,8 @@ $scheme = "foo1"; stream_wrapper_register($scheme, "SimpleXMLIterator"); try { file_get_contents($scheme . "://x"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; echo $e->getPrevious()->getMessage(), "\n"; } @@ -17,13 +17,13 @@ $scheme = "foo2"; stream_wrapper_register($scheme, "SimpleXMLElement"); try { file_get_contents($scheme . "://x"); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; echo $e->getPrevious()->getMessage(), "\n"; } ?> --EXPECT-- -It's not possible to assign a complex type to properties, resource given +TypeError: It's not possible to assign a complex type to properties, resource given SimpleXMLElement is not properly initialized -It's not possible to assign a complex type to properties, resource given +TypeError: It's not possible to assign a complex type to properties, resource given SimpleXMLElement is not properly initialized diff --git a/ext/simplexml/tests/key_error.phpt b/ext/simplexml/tests/key_error.phpt index 5801aec1040b..e38d8f305c9d 100644 --- a/ext/simplexml/tests/key_error.phpt +++ b/ext/simplexml/tests/key_error.phpt @@ -16,8 +16,8 @@ $sxe = simplexml_load_string($xml); try { $sxe->key(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } for ($sxe->rewind(); $sxe->valid(); $sxe->next()) { @@ -26,14 +26,14 @@ for ($sxe->rewind(); $sxe->valid(); $sxe->next()) { try { $sxe->key(); -} catch (Error $exception) { - echo $exception->getMessage() . "\n"; +} catch (Throwable $exception) { + echo $exception::class, ': ', $exception->getMessage(), "\n"; } ?> --EXPECT-- -Iterator not initialized or already consumed +Error: Iterator not initialized or already consumed string(4) "elem" object(SimpleXMLElement)#3 (0) { } -Iterator not initialized or already consumed +Error: Iterator not initialized or already consumed diff --git a/ext/simplexml/tests/simplexml_uninitialized.phpt b/ext/simplexml/tests/simplexml_uninitialized.phpt index ade8b809b7aa..4731f58fd418 100644 --- a/ext/simplexml/tests/simplexml_uninitialized.phpt +++ b/ext/simplexml/tests/simplexml_uninitialized.phpt @@ -14,46 +14,46 @@ class MySXE extends SimpleXMLElement { $sxe = new MySXE; try { var_dump($sxe->count()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->xpath('')); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->getDocNamespaces()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->children()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->attributes()); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->registerXPathNamespace('', '')); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump($sxe->foo); -} catch (Error $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized -SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized +Error: SimpleXMLElement is not properly initialized