From: Operating system: Irrelevant PHP version: 5.4.0alpha1 Package: Class/Object related Bug Type: Bug Bug description:Changing trait static method visibility
Description: ------------ When changing the visibility of a static method from a trait, it seems the methods static-ness is removed. The test script should be expected to work, as B uses A::foo as public. Instead you get a fatal error: "Non-static method B::foo() cannot be called statically". Omitting the 'as' segment throws an expected visibility error "Call to protected method B::foo() from context ''". Note: the same occurs when visibility isn't changed (but as is still used), e.g. if A::foo is declared public but B's definition doesn't change, the same problem is found. The only solution that will run is to not change static method visibility, and instead change the trait definition. Test script: --------------- <?php trait A { protected static function foo() { echo 'lolwas'; } } class B { use A { A::foo as public; } } B::foo(); ?> Expected result: ---------------- lolwas Actual result: -------------- Fatal error: Non-static method B::foo() cannot be called statically in C:\Server\Apache\htdocs\tests\trait_static_visibility.php on line 13 -- Edit bug report at https://bugs.php.net/bug.php?id=55137&edit=1 -- Try a snapshot (PHP 5.2): https://bugs.php.net/fix.php?id=55137&r=trysnapshot52 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55137&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55137&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55137&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55137&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55137&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55137&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55137&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55137&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55137&r=support Expected behavior: https://bugs.php.net/fix.php?id=55137&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55137&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55137&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55137&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55137&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55137&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55137&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55137&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55137&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55137&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55137&r=mysqlcfg Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55137&r=trysnapshot54