Browse Source

- Fixed bug #55137 (Changing trait static method visibility)

pull/271/head
Felipe Pena 15 years ago
parent
commit
8953916314
  1. 26
      Zend/tests/bug55137.phpt
  2. 2
      Zend/zend_compile.c

26
Zend/tests/bug55137.phpt

@ -0,0 +1,26 @@
--TEST--
Bug #55137 (Changing trait static method visibility)
--FILE--
<?php
trait A {
protected static function foo() { echo "abc\n"; }
private static function bar() { echo "def\n"; }
}
class B {
use A {
A::foo as public;
A::bar as public baz;
}
}
B::foo();
B::baz();
?>
--EXPECT--
abc
def

2
Zend/zend_compile.c

@ -3661,6 +3661,7 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
if (!(aliases[i]->modifiers & ZEND_ACC_PPP_MASK)) {
fn_copy.common.fn_flags |= ZEND_ACC_PUBLIC;
}
fn_copy.common.fn_flags |= fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK);
}
lcname_len = aliases[i]->alias_len;
@ -3700,6 +3701,7 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
if (!(aliases[i]->modifiers & ZEND_ACC_PPP_MASK)) {
fn_copy.common.fn_flags |= ZEND_ACC_PUBLIC;
}
fn_copy.common.fn_flags |= fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK);
}
}
i++;

Loading…
Cancel
Save