Skip to content
Merged
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
12 changes: 6 additions & 6 deletions ext/simplexml/tests/012.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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
<?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 @@ -11,13 +11,13 @@ $a = new SimpleXMLElement("<php>testfest</php>");

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
<?xml version="1.0"?>
<php>testfest</php>
6 changes: 3 additions & 3 deletions ext/simplexml/tests/SimpleXMLElement_xpath.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions ext/simplexml/tests/bug37076_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ $xml = simplexml_load_string("<root><foo /></root>");

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
<?xml version="1.0"?>
<root><foo/></root>
6 changes: 3 additions & 3 deletions ext/simplexml/tests/bug38406.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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";
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
12 changes: 6 additions & 6 deletions ext/simplexml/tests/current_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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
12 changes: 6 additions & 6 deletions ext/simplexml/tests/gh12929.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ $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";
}

$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
12 changes: 6 additions & 6 deletions ext/simplexml/tests/key_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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
42 changes: 21 additions & 21 deletions ext/simplexml/tests/simplexml_uninitialized.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading