Bug #52741 [Opn->Asn]: OOP late static bindings bug

From: Date: Mon, 30 Aug 2010 16:35:09 +0000
Subject: Bug #52741 [Opn->Asn]: OOP late static bindings bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153939@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52741&edit=1 ID: 52741 Updated by: johannes@php.net Reported by: flyguy dot by at gmail dot com Summary: OOP late static bindings bug -Status: Open +Status: Assigned Type: Bug Package: Scripting Engine problem -Operating System: Windows Vista +Operating System: * PHP Version: 5.3.3 -Assigned To: +Assigned To: colder Block user comment: N New Comment: Etienne, you are the LSB expert - what's your take on this? - In the given example I can see the reporter's point. (While there is a "extends test1" missing) I wonder about this: class test1 { public static function testing_method() { var_dump(get_called_class()); } } class test2 extends test1 { } class test3 extends test2 { public static function testing_method() { parent::testing_method(); } } Here parent might refer to test2, test2 inherits testing_method() from test1 so the called class might be test2 ... some might argue that test1 is correct. I think the most simple thing is to keep the current behavior and define parent not to change the lsb scope. Previous Comments: ------------------------------------------------------------------------ [2010-08-30 17:33:48] flyguy dot by at gmail dot com Description: ------------ This is code prints "test2". Why ? Test script: --------------- class test1 { public static function testing_method() { var_dump(get_called_class()); } } class test2 { public static function testing_method() { parent::testing_method(); } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52741&edit=1

« previous php.bugs (#153939) next »