diff --git a/ext/simplexml/tests/012.phpt b/ext/simplexml/tests/012.phpt
index a68345d29d9a..137e0f931720 100644
--- a/ext/simplexml/tests/012.phpt
+++ b/ext/simplexml/tests/012.phpt
@@ -15,7 +15,7 @@ $sxe = simplexml_load_string($xml);
try {
$sxe[""] = "value";
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
$sxe["attr"] = "value";
@@ -29,16 +29,16 @@ echo $sxe->asXML();
try {
$sxe[] = "error";
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ 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..c6f33e5661c0 100644
--- a/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt
+++ b/ext/simplexml/tests/SimpleXMLElement_addAttribute_required_attribute_name.phpt
@@ -12,12 +12,12 @@ $a = new SimpleXMLElement("testfest");
try {
$a->addAttribute( "", "" );
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ 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..f6541429385e 100644
--- a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt
+++ b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt
@@ -14,8 +14,8 @@ $xml = @simplexml_load_string("XXXXXXX^", 'SimpleXMLElement', XML_PARSE_RECOVER)
try {
var_dump($xml->xpath("BBBB"));
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ 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..e4d31407c3ae 100644
--- a/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt
+++ b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt
@@ -12,10 +12,10 @@ 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";
+ 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..e6ac05ca4245 100644
--- a/ext/simplexml/tests/bug37076_1.phpt
+++ b/ext/simplexml/tests/bug37076_1.phpt
@@ -10,12 +10,12 @@ $xml = simplexml_load_string("");
try {
$xml->{""} .= "bar";
} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+ 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..8aed05291a5d 100644
--- a/ext/simplexml/tests/bug38406.phpt
+++ b/ext/simplexml/tests/bug38406.phpt
@@ -17,7 +17,7 @@ $a = array();
try {
$item->$a = new stdclass;
} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+ 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..822db6ed0073 100644
--- a/ext/simplexml/tests/current_error.phpt
+++ b/ext/simplexml/tests/current_error.phpt
@@ -17,7 +17,7 @@ $sxe = simplexml_load_string($xml);
try {
$sxe->current();
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
for ($sxe->rewind(); $sxe->valid(); $sxe->next()) {
@@ -27,13 +27,13 @@ for ($sxe->rewind(); $sxe->valid(); $sxe->next()) {
try {
$sxe->current();
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ 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..0b3586fb88ca 100644
--- a/ext/simplexml/tests/gh12929.phpt
+++ b/ext/simplexml/tests/gh12929.phpt
@@ -9,7 +9,7 @@ stream_wrapper_register($scheme, "SimpleXMLIterator");
try {
file_get_contents($scheme . "://x");
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
echo $e->getPrevious()->getMessage(), "\n";
}
@@ -18,12 +18,12 @@ stream_wrapper_register($scheme, "SimpleXMLElement");
try {
file_get_contents($scheme . "://x");
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ 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..519d1d100248 100644
--- a/ext/simplexml/tests/key_error.phpt
+++ b/ext/simplexml/tests/key_error.phpt
@@ -17,7 +17,7 @@ $sxe = simplexml_load_string($xml);
try {
$sxe->key();
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
for ($sxe->rewind(); $sxe->valid(); $sxe->next()) {
@@ -27,13 +27,13 @@ for ($sxe->rewind(); $sxe->valid(); $sxe->next()) {
try {
$sxe->key();
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ 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..ac14ad451118 100644
--- a/ext/simplexml/tests/simplexml_uninitialized.phpt
+++ b/ext/simplexml/tests/simplexml_uninitialized.phpt
@@ -15,45 +15,45 @@ $sxe = new MySXE;
try {
var_dump($sxe->count());
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($sxe->xpath(''));
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($sxe->getDocNamespaces());
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($sxe->children());
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($sxe->attributes());
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($sxe->registerXPathNamespace('', ''));
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($sxe->foo);
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ 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