xref: /PHP-8.3/ext/simplexml/tests/bug35785.phpt (revision 7f2f0c00)
1--TEST--
2Bug #35785 (SimpleXML memory read error)
3--EXTENSIONS--
4simplexml
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--EXPECT--
20<?xml version="1.0"?>
21<root><bla><posts><name>FooBar</name></posts></bla></root>
22bool(false)
23<?xml version="1.0"?>
24<root><bla><posts><name>FooBar</name></posts></bla></root>
25<?xml version="1.0"?>
26<root><bla><posts><name>FooBar</name></posts></bla></root>
27