bug67582.phpt 559 B

123456789101112131415161718192021222324
  1. --TEST--
  2. Bug #67582: Cloned SplObjectStorage with overwritten getHash fails offsetExists()
  3. --FILE--
  4. <?php
  5. class MyObjectStorage extends SplObjectStorage {
  6. // Overwrite getHash() with just some (working) test-method
  7. public function getHash($object): string { return get_class($object); }
  8. }
  9. class TestObject {}
  10. $list = new MyObjectStorage();
  11. $list->attach(new TestObject());
  12. foreach($list as $x) var_dump($list->offsetExists($x));
  13. $list2 = clone $list;
  14. foreach($list2 as $x) var_dump($list2->offsetExists($x));
  15. ?>
  16. --EXPECT--
  17. bool(true)
  18. bool(true)