Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ PHP NEWS
?? ??? 2013, PHP 5.4.20

- Core:
. Fixed bug #65579 (Using traits with get_class_methods causes segfault).
(Adam)
. Fixed bug #65490 (Duplicate calls to get lineno & filename for
DTRACE_FUNCTION_*). (Chris Jones)
. Fixed bug #65483 (quoted-printable encode stream filter incorrectly encoding
Expand Down
29 changes: 29 additions & 0 deletions Zend/tests/bug65579.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--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"
}
17 changes: 9 additions & 8 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -3917,15 +3917,16 @@ ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name
{
zend_trait_alias *alias, **alias_ptr;

alias_ptr = ce->trait_aliases;
alias = *alias_ptr;
while (alias) {
if (alias->alias_len == len &&
!strncasecmp(name, alias->alias, alias->alias_len)) {
return alias->alias;
}
alias_ptr++;
if (alias_ptr = ce->trait_aliases) {
alias = *alias_ptr;
while (alias) {
if (alias->alias_len == len &&
!strncasecmp(name, alias->alias, alias->alias_len)) {
return alias->alias;
}
alias_ptr++;
alias = *alias_ptr;
}
}

return name;
Expand Down