2007-12-21 20:56:10 +00:00
|
|
|
--TEST--
|
|
|
|
Bug #43450 (Memory leak on some functions with implicit object __toString() call)
|
2013-04-03 11:52:09 +00:00
|
|
|
--INI--
|
|
|
|
opcache.enable_cli=0
|
2007-12-21 20:56:10 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
2018-10-14 16:03:31 +00:00
|
|
|
class Foo
|
2007-12-21 20:56:10 +00:00
|
|
|
{
|
|
|
|
public function __toString()
|
2020-02-03 21:52:20 +00:00
|
|
|
{
|
|
|
|
return __CLASS__;
|
|
|
|
}
|
2007-12-21 20:56:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$num_repeats = 100000;
|
|
|
|
|
2014-08-15 15:44:15 +00:00
|
|
|
$start = memory_get_usage() / 1024;
|
2018-09-16 17:16:42 +00:00
|
|
|
for ($i=1;$i<$num_repeats;$i++)
|
2007-12-21 20:56:10 +00:00
|
|
|
{
|
2020-02-03 21:52:20 +00:00
|
|
|
$foo = new Foo();
|
|
|
|
md5($foo);
|
2007-12-21 20:56:10 +00:00
|
|
|
}
|
2014-08-15 15:44:15 +00:00
|
|
|
$end = memory_get_usage() / 1024;
|
2007-12-21 20:56:10 +00:00
|
|
|
|
2014-08-15 15:44:15 +00:00
|
|
|
if ($start + 16 < $end) {
|
2020-02-03 21:52:20 +00:00
|
|
|
echo 'FAIL';
|
2007-12-21 20:56:10 +00:00
|
|
|
} else {
|
2020-02-03 21:52:20 +00:00
|
|
|
echo 'PASS';
|
2007-12-21 20:56:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
PASS
|