xref: /PHP-8.3/ext/simplexml/tests/bug42369.phpt (revision 7f2f0c00)
1--TEST--
2Bug #42369 (Implicit conversion to string leaks memory)
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7    $xml = '<?xml version="1.0" encoding="utf-8"?>';
8    $x = simplexml_load_string($xml . "<q><x>foo</x></q>");
9
10    echo 'explicit conversion' . PHP_EOL;
11    for ($i = 0; $i < 100000; $i++) {
12        md5(strval($x->x));
13    }
14
15    echo 'no conversion' . PHP_EOL;
16    for ($i = 0; $i < 100000; $i++) {
17        md5($x->x);
18    }
19
20?>
21--EXPECT--
22explicit conversion
23no conversion
24