Annotation of embedaddon/php/Zend/tests/traits/bug61998.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #61998 (Using traits with method aliases appears to result in crash during execution)
! 3: --FILE--
! 4: <?php
! 5: class Foo {
! 6: use T1 {
! 7: func as newFunc;
! 8: }
! 9:
! 10: public function func() {
! 11: echo "From Foo\n";
! 12: }
! 13: }
! 14:
! 15: trait T1 {
! 16: public function func() {
! 17: echo "From T1\n";
! 18: }
! 19: }
! 20:
! 21: class Bar {
! 22: public function func() {
! 23: echo "From Bar\n";
! 24: }
! 25: public function func2() {
! 26: echo "From Bar\n";
! 27: }
! 28: public function func3() {
! 29: echo "From Bar\n";
! 30: }
! 31: use T1 {
! 32: func as newFunc;
! 33: func as func2;
! 34: }
! 35: use T2 {
! 36: func2 as newFunc2;
! 37: func2 as newFunc3;
! 38: func2 as func3;
! 39: }
! 40: }
! 41:
! 42: trait T2 {
! 43: public function func2() {
! 44: echo "From T2\n";
! 45: }
! 46: }
! 47:
! 48: $f = new Foo();
! 49:
! 50: $f->newFunc(); //from T1
! 51: $f->func(); //from Foo
! 52:
! 53: $b = new Bar();
! 54: $b->newFunc(); //from T1
! 55: $b->func(); //from Bar
! 56: $b->func2(); //from Bar
! 57: $b->newFunc2(); //from T2
! 58: $b->newFunc3(); //from T2
! 59: $b->func3(); //from Bar
! 60: --EXPECTF--
! 61: From T1
! 62: From Foo
! 63: From T1
! 64: From Bar
! 65: From Bar
! 66: From T2
! 67: From T2
! 68: From Bar
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>