Return to bug43450.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests |
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