xref: /PHP-5.6/ext/simplexml/tests/bug35785.phpt (revision 610c7fbe)
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>");
12$count = count($xml->bla->posts);
13var_dump($count);
14$xml->bla->posts[$count]->name = "FooBar";
15echo $xml->asXML();
16$xml = simplexml_load_string("<root></root>");
17$xml->bla->posts[]->name = "FooBar";
18echo $xml->asXML();
19?>
20===DONE===
21<?php exit(0); __halt_compiler(); ?>
22--EXPECTF--
23<?xml version="1.0"?>
24<root><bla><posts><name>FooBar</name></posts></bla></root>
25int(0)
26<?xml version="1.0"?>
27<root><bla><posts><name>FooBar</name></posts></bla></root>
28<?xml version="1.0"?>
29<root><bla><posts><name>FooBar</name></posts></bla></root>
30===DONE===
31