Skip to content

Commit

Permalink
Merge branch 'PHP-5.4' into PHP-5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Aug 29, 2013
2 parents bd677b4 + 72027cd commit f0cb674
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
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 @@ -3980,15 +3980,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

0 comments on commit f0cb674

Please sign in to comment.