1--TEST-- 2Bug #61998 (Using traits with method aliases appears to result in crash during execution) 3--FILE-- 4<?php 5class Foo { 6 use T1 { 7 func as newFunc; 8 } 9 10 public function func() { 11 echo "From Foo\n"; 12 } 13} 14 15trait T1 { 16 public function func() { 17 echo "From T1\n"; 18 } 19} 20 21class 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 42trait 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--EXPECT-- 61From T1 62From Foo 63From T1 64From Bar 65From Bar 66From T2 67From T2 68From Bar 69