Bug #66781 [Opn->Nab]: Errorneous "Cannot make non static method static in" for private methods

From: Date: Thu, 27 Feb 2014 17:12:17 +0000
Subject: Bug #66781 [Opn->Nab]: Errorneous "Cannot make non static method static in" for private methods
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184459@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66781&edit=1 ID: 66781 Updated by: krakjoe@php.net Reported by: maciej dot sz at gmail dot com Summary: Errorneous "Cannot make non static method static in" for private methods -Status: Open +Status: Not a bug Type: Bug Package: Class/Object related Operating System: irrelevant PHP Version: 5.5.9 Block user comment: N Private report: N New Comment: That would break anything dependent on Foo calling fooMethod in the object context. It's desired behaviour. Previous Comments: ------------------------------------------------------------------------ [2014-02-26 16:58:58] maciej dot sz at gmail dot com Description: ------------ Private methods are owned by the classes in which they are used, so there should be no problem with the following code: Test script: --------------- class Foo { private function fooMethod(){} } class Bar extends Foo { private static function fooMethod(){} } Expected result: ---------------- Sounds like the Bar::fooMethod() tries to override the Foo::fooMethod(), even though the Foo::fooMethod() is not a part of the Bar class. They should not affect each other due to private visibility. Actual result: -------------- The test code produces: Fatal error: Cannot make non static method Foo::fooMethod() static in class Bar in /home/www/workspace/tests/static_private_override.php on line 9 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66781&edit=1

« previous php.bugs (#184459) next »