Bug #53565 [Opn]: OOP last state binding bug in get_called_class()

From: Date: Fri, 17 Dec 2010 20:27:46 +0000
Subject: Bug #53565 [Opn]: OOP last state binding bug in get_called_class()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-157062@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53565&edit=1 ID: 53565 User updated by: updates at mail dot ru Reported by: updates at mail dot ru Summary: OOP last state binding bug in get_called_class() Status: Open Type: Bug Package: Scripting Engine problem Operating System: Linux 2.6.34-r1 PHP Version: 5.3.4 Block user comment: N Private report: N New Comment: This line does not affect the bug: $a = get_class($this); It can be removed. Previous Comments: ------------------------------------------------------------------------ [2010-12-17 21:22:02] updates at mail dot ru Description: ------------ Bug in get_called_class() Test script: --------------- class a { function __construct() { $a = get_class($this); a::test(); } function test() { var_dump(get_called_class()); } } class b extends a { } $a = new a(); $b = new b(); Expected result: ---------------- string(1) "a" string(1) "a" Actual result: -------------- string(1) "a" string(1) "b" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53565&edit=1

« previous php.bugs (#157062) next »