]> granicus.if.org Git - php/commitdiff
- Fixed bug #55137 (Changing trait static method visibility)
authorFelipe Pena <felipe@php.net>
Wed, 6 Jul 2011 00:33:38 +0000 (00:33 +0000)
committerFelipe Pena <felipe@php.net>
Wed, 6 Jul 2011 00:33:38 +0000 (00:33 +0000)
Zend/tests/bug55137.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/Zend/tests/bug55137.phpt b/Zend/tests/bug55137.phpt
new file mode 100644 (file)
index 0000000..4a4e6e6
--- /dev/null
@@ -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
index 5f9cef311bf72b7976d2115e93043866b3523239..f3b6b77718cdace41a76288d088cdb4c88b50e91 100644 (file)
@@ -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++;