mirror of
https://github.com/php/php-src.git
synced 2024-12-18 14:30:35 +08:00
72027cd084
Specifically, this checks if there are trait aliases defined in the class scope before attempting to dereference the first trait alias. This handles the case where a trait alias was used in a child trait but no aliases exist in the concrete class.
30 lines
495 B
PHP
30 lines
495 B
PHP
--TEST--
|
|
Bug #65579 (Using traits with get_class_methods causes segfault)
|
|
--FILE--
|
|
<?php
|
|
trait ParentTrait {
|
|
public function testMethod() { }
|
|
}
|
|
|
|
trait ChildTrait {
|
|
use ParentTrait {
|
|
testMethod as testMethodFromParentTrait;
|
|
}
|
|
public function testMethod() { }
|
|
}
|
|
|
|
class TestClass {
|
|
use ChildTrait;
|
|
}
|
|
|
|
$obj = new TestClass();
|
|
var_dump(get_class_methods($obj));
|
|
?>
|
|
--EXPECT--
|
|
array(2) {
|
|
[0]=>
|
|
string(10) "testMethod"
|
|
[1]=>
|
|
string(25) "testmethodfromparenttrait"
|
|
}
|