Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fixed bug #61998 (Using traits with method aliases appears to result …
…in crash during execution)
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--TEST-- | ||
Bug #61998 (Using traits with method aliases appears to result in crash during execution) | ||
--FILE-- | ||
<?php | ||
class Foo { | ||
use T1 { | ||
func as newFunc; | ||
} | ||
|
||
public function func() { | ||
echo "From Foo\n"; | ||
} | ||
} | ||
|
||
trait T1 { | ||
public function func() { | ||
echo "From T1\n"; | ||
} | ||
} | ||
|
||
class Bar { | ||
public function func() { | ||
echo "From Bar\n"; | ||
} | ||
public function func2() { | ||
echo "From Bar\n"; | ||
} | ||
public function func3() { | ||
echo "From Bar\n"; | ||
} | ||
use T1 { | ||
func as newFunc; | ||
func as func2; | ||
} | ||
use T2 { | ||
func2 as newFunc2; | ||
func2 as newFunc3; | ||
func2 as func3; | ||
} | ||
} | ||
|
||
trait T2 { | ||
public function func2() { | ||
echo "From T2\n"; | ||
} | ||
} | ||
|
||
$f = new Foo(); | ||
|
||
$f->newFunc(); //from T1 | ||
$f->func(); //from Foo | ||
|
||
$b = new Bar(); | ||
$b->newFunc(); //from T1 | ||
$b->func(); //from Bar | ||
$b->func2(); //from Bar | ||
$b->newFunc2(); //from T2 | ||
$b->newFunc3(); //from T2 | ||
$b->func3(); //from Bar | ||
--EXPECTF-- | ||
From T1 | ||
From Foo | ||
From T1 | ||
From Bar | ||
From Bar | ||
From T2 | ||
From T2 | ||
From Bar |