xref: /PHP-7.2/ext/simplexml/tests/bug35785.phpt (revision 1ccada35)
1--TEST--
2Bug #35785 (SimpleXML memory read error)
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip"; ?>
5--FILE--
6<?php
7
8$xml = simplexml_load_string("<root></root>");
9$xml->bla->posts->name = "FooBar";
10echo $xml->asXML();
11$xml = simplexml_load_string("<root></root>");
12var_dump(isset($xml->bla->posts));
13$xml->bla->posts[0]->name = "FooBar";
14echo $xml->asXML();
15$xml = simplexml_load_string("<root></root>");
16$xml->bla->posts[]->name = "FooBar";
17echo $xml->asXML();
18?>
19===DONE===
20<?php exit(0); __halt_compiler(); ?>
21--EXPECTF--
22<?xml version="1.0"?>
23<root><bla><posts><name>FooBar</name></posts></bla></root>
24bool(false)
25<?xml version="1.0"?>
26<root><bla><posts><name>FooBar</name></posts></bla></root>
27<?xml version="1.0"?>
28<root><bla><posts><name>FooBar</name></posts></bla></root>
29===DONE===
30