xref: /PHP-8.3/Zend/tests/bug43450.phpt (revision f8d79582)
1--TEST--
2Bug #43450 (Memory leak on some functions with implicit object __toString() call)
3--INI--
4opcache.enable_cli=0
5--FILE--
6<?php
7
8class Foo
9{
10    public function __toString()
11    {
12        return __CLASS__;
13    }
14}
15
16$num_repeats = 100000;
17
18$start = memory_get_usage() / 1024;
19for ($i=1;$i<$num_repeats;$i++)
20{
21    $foo = new Foo();
22    md5($foo);
23}
24$end = memory_get_usage() / 1024;
25
26if ($start + 16 < $end) {
27    echo 'FAIL';
28} else {
29    echo 'PASS';
30}
31
32?>
33--EXPECT--
34PASS
35