bug40872.phpt 629 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #40872 (inconsistency in offsetSet, offsetExists treatment of string enclosed integers)
  3. --FILE--
  4. <?php
  5. class Project {
  6. public $id;
  7. function __construct($id) {
  8. $this->id = $id;
  9. }
  10. }
  11. class ProjectsList extends ArrayIterator {
  12. public function add(Project $item) {
  13. $this->offsetSet($item->id, $item);
  14. }
  15. }
  16. $projects = new ProjectsList();
  17. $projects->add(new Project('1'));
  18. $projects->add(new Project(2));
  19. var_dump($projects->offsetExists(1));
  20. var_dump($projects->offsetExists('2'));
  21. ?>
  22. --EXPECT--
  23. bool(true)
  24. bool(true)