1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 10:12:18 +01:00
Files
archived-php-src/ext/simplexml/tests/bug72971_2.phpt
Nikita Popov 6adb7e0b7a Followup for bug #72971
Property writes did not respect the namespace either. This is an
incomplete fix in that it only handles the case where an existing
child element is modified, not when a new one is created.
2016-08-30 12:53:50 +02:00

36 lines
755 B
PHP

--TEST--
Bug #72971 (2): SimpleXML property write does not respect namespace
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?>
--FILE--
<?php
$xml = new SimpleXMLElement('<root xmlns:ns="ns"><foo>bar</foo><ns:foo>ns:bar</ns:foo></root>');
$xml->foo = 'new-bar';
var_dump($xml->foo);
var_dump($xml->children('ns')->foo);
$xml->children('ns')->foo = 'ns:new-bar';
var_dump($xml->foo);
var_dump($xml->children('ns')->foo);
?>
--EXPECT--
object(SimpleXMLElement)#2 (1) {
[0]=>
string(7) "new-bar"
}
object(SimpleXMLElement)#3 (1) {
[0]=>
string(6) "ns:bar"
}
object(SimpleXMLElement)#3 (1) {
[0]=>
string(7) "new-bar"
}
object(SimpleXMLElement)#2 (1) {
[0]=>
string(10) "ns:new-bar"
}