felipe Wed, 06 Jul 2011 00:33:38 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=312972
Log: - Fixed bug #55137 (Changing trait static method visibility) Bug: https://bugs.php.net/55137 (Assigned) Changing trait static method visibility Changed paths: A php/php-src/branches/PHP_5_4/Zend/tests/bug55137.phpt U php/php-src/branches/PHP_5_4/Zend/zend_compile.c A php/php-src/trunk/Zend/tests/traits/bug55137.phpt U php/php-src/trunk/Zend/zend_compile.c Added: php/php-src/branches/PHP_5_4/Zend/tests/bug55137.phpt =================================================================== --- php/php-src/branches/PHP_5_4/Zend/tests/bug55137.phpt (rev 0) +++ php/php-src/branches/PHP_5_4/Zend/tests/bug55137.phpt 2011-07-06 00:33:38 UTC (rev 312972) @@ -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 Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c =================================================================== --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-07-06 00:16:24 UTC (rev 312971) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-07-06 00:33:38 UTC (rev 312972) @@ -3661,6 +3661,7 @@ 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 @@ 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++; Added: php/php-src/trunk/Zend/tests/traits/bug55137.phpt =================================================================== --- php/php-src/trunk/Zend/tests/traits/bug55137.phpt (rev 0) +++ php/php-src/trunk/Zend/tests/traits/bug55137.phpt 2011-07-06 00:33:38 UTC (rev 312972) @@ -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 Modified: php/php-src/trunk/Zend/zend_compile.c =================================================================== --- php/php-src/trunk/Zend/zend_compile.c 2011-07-06 00:16:24 UTC (rev 312971) +++ php/php-src/trunk/Zend/zend_compile.c 2011-07-06 00:33:38 UTC (rev 312972) @@ -3661,6 +3661,7 @@ 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 @@ 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++;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php