Annotation of embedaddon/php/Zend/tests/bug50816.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #50816 (Using class constants in array definition fails)
! 3: --FILE--
! 4: <?php
! 5: define("ONE", 1);
! 6: define("TWO", 1);
! 7:
! 8: class Foo {
! 9: const ONE = 1;
! 10: const TWO = 1;
! 11:
! 12: public static $mapWithConst = array(self::ONE => 'one', self::TWO => 'two',);
! 13:
! 14: public static $mapWithConst1 = array(1 => 'one', self::TWO => 'two',);
! 15: public static $mapWithConst2 = array(self::ONE => 'one', 1 => 'two',);
! 16:
! 17: public static $mapWithoutConst = array(1 => 'one', 1 => 'two',);
! 18: }
! 19:
! 20: $mapWithConst = array(1 => 'one', 1 => 'two',);
! 21:
! 22: $mapWithoutConst = array(Foo::ONE => 'one', Foo::TWO => 'two',);
! 23: $mapWithoutConst0 = array(1 => 'one', 1 => 'two',);
! 24: $mapWithoutConst1 = array(ONE => 'one', 1 => 'two',);
! 25: $mapWithoutConst2 = array(1 => 'one', TWO => 'two',);
! 26: $mapWithoutConst3 = array(ONE => 'one', TWO => 'two',);
! 27:
! 28: var_dump(Foo::$mapWithConst[1]);
! 29: var_dump(Foo::$mapWithConst1[1]);
! 30: var_dump(Foo::$mapWithConst2[1]);
! 31: var_dump(Foo::$mapWithoutConst[1]);
! 32: var_dump($mapWithConst[1]);
! 33: var_dump($mapWithoutConst[1]);
! 34: var_dump($mapWithoutConst0[1]);
! 35: var_dump($mapWithoutConst1[1]);
! 36: var_dump($mapWithoutConst2[1]);
! 37: var_dump($mapWithoutConst3[1]);
! 38: --EXPECT--
! 39: string(3) "two"
! 40: string(3) "two"
! 41: string(3) "two"
! 42: string(3) "two"
! 43: string(3) "two"
! 44: string(3) "two"
! 45: string(3) "two"
! 46: string(3) "two"
! 47: string(3) "two"
! 48: string(3) "two"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>