bug69996.phpt 451 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Bug #69996 (Changing the property of a cloned object affects the original)
  3. --FILE--
  4. <?php
  5. function method($cache) {
  6. $prepared = clone $cache;
  7. var_dump($prepared->data);
  8. $prepared->data = "bad";
  9. return $prepared;
  10. }
  11. $cache = new stdClass();
  12. $cache->data = "good";
  13. for ($i = 0; $i < 5; ++$i) {
  14. method($cache);
  15. }
  16. ?>
  17. --EXPECT--
  18. string(4) "good"
  19. string(4) "good"
  20. string(4) "good"
  21. string(4) "good"
  22. string(4) "good"