Annotation of embedaddon/php/Zend/tests/bug43450.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #43450 (Memory leak on some functions with implicit object __toString() call)
! 3: --SKIPIF--
! 4: <?php if (!function_exists('memory_get_usage')) die('memory_get_usage() not installed'); ?>
! 5: --FILE--
! 6: <?php
! 7: error_reporting(E_ALL|E_STRICT);
! 8:
! 9: class Foo
! 10: {
! 11: public function __toString()
! 12: {
! 13: return __CLASS__;
! 14: }
! 15: }
! 16:
! 17: $num_repeats = 100000;
! 18:
! 19: $start = (memory_get_usage() / 1024) + 16;
! 20: for ($i=1;$i<$num_repeats;$i++)
! 21: {
! 22: $foo = new Foo();
! 23: md5($foo);
! 24: }
! 25: $end = memory_get_peak_usage() / 1024;
! 26:
! 27: if ($start < $end) {
! 28: echo 'FAIL';
! 29: } else {
! 30: echo 'PASS';
! 31: }
! 32:
! 33: ?>
! 34: --EXPECT--
! 35: PASS
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>