summaryrefslogtreecommitdiff
path: root/ext/simplexml/tests/bug42369.phpt
blob: f8e030526c7ec3fad9e76f488c2b91f48722a80f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--TEST--
Bug #42369 (Implicit conversion to string leaks memory)
--SKIPIF--
<?php if (!extension_loaded('simplexml')) echo 'skip simplexml extension is not loaded'; ?>
--FILE--
<?php
    $xml = '<?xml version="1.0" encoding="utf-8"?>';
    $x = simplexml_load_string($xml . "<q><x>foo</x></q>");

    echo 'explicit conversion' . PHP_EOL;
    for ($i = 0; $i < 100000; $i++) {
        md5(strval($x->x));
    }

    echo 'no conversion' . PHP_EOL;
    for ($i = 0; $i < 100000; $i++) {
        md5($x->x);
    }

?>
===DONE===
--EXPECT--
explicit conversion
no conversion
===DONE===