bug43450.phpt 481 B

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