Annotation of embedaddon/php/ext/spl/tests/bug40872.phpt, revision 1.1.1.1

1.1       misho       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: 
                      8:                function __construct($id) {
                      9:                        $this->id = $id;
                     10:                }
                     11:        }
                     12: 
                     13:        class ProjectsList extends ArrayIterator {
                     14:                public function add(Project $item) {
                     15:                        $this->offsetSet($item->id, $item);
                     16:                }
                     17:        }
                     18: 
                     19:        $projects = new ProjectsList();
                     20:        $projects->add(new Project('1'));
                     21:        $projects->add(new Project(2));
                     22: 
                     23:        var_dump($projects->offsetExists(1));
                     24:        var_dump($projects->offsetExists('2'));
                     25: ?>
                     26: ===DONE===
                     27: --EXPECT--
                     28: bool(true)
                     29: bool(true)
                     30: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>