Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ext/simplexml/tests/012.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo attr="value"/>
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo attr="new value"/>
Cannot append to an attribute list
ValueError: Cannot append to an attribute list
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ $a = new SimpleXMLElement("<php>testfest</php>");
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
<?xml version="1.0"?>
<php>testfest</php>
4 changes: 2 additions & 2 deletions ext/simplexml/tests/SimpleXMLElement_xpath.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions ext/simplexml/tests/bug37076_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ $xml = simplexml_load_string("<root><foo /></root>");
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
<?xml version="1.0"?>
<root><foo/></root>
4 changes: 2 additions & 2 deletions ext/simplexml/tests/bug38406.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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
8 changes: 4 additions & 4 deletions ext/simplexml/tests/current_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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
8 changes: 4 additions & 4 deletions ext/simplexml/tests/gh12929.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand All @@ -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
8 changes: 4 additions & 4 deletions ext/simplexml/tests/key_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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
28 changes: 14 additions & 14 deletions ext/simplexml/tests/simplexml_uninitialized.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading