php-src/ext/simplexml/tests/bug35785.phpt

29 lines
717 B
Plaintext
Raw Normal View History

2005-12-23 20:26:41 +00:00
--TEST--
Bug #35785 (SimpleXML memory read error)
2006-06-27 00:09:43 +00:00
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
2005-12-23 20:26:41 +00:00
--FILE--
<?php
$xml = simplexml_load_string("<root></root>");
2006-02-26 23:14:45 +00:00
$xml->bla->posts->name = "FooBar";
echo $xml->asXML();
echo "===FAIL===\n";
$xml = simplexml_load_string("<root></root>");
$count = count($xml->bla->posts);
var_dump($count);
$xml->bla->posts[++$count]->name = "FooBar";
2005-12-23 20:26:41 +00:00
echo $xml->asXML();
?>
===DONE===
<?php exit(0); __halt_compiler(); ?>
--EXPECTF--
<?xml version="1.0"?>
2006-02-26 23:14:45 +00:00
<root><bla><posts><name>FooBar</name></posts></bla></root>
===FAIL===
int(0)
2006-03-07 15:22:48 +00:00
Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sbug35785.php on line %d