Bug #68055 [Opn->Nab]: Calls from incompatible contexts do weird things

From: Date: Fri, 19 Sep 2014 17:28:47 +0000
Subject: Bug #68055 [Opn->Nab]: Calls from incompatible contexts do weird things
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187607@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68055&edit=1 ID: 68055 Updated by: aharvey@php.net Reported by: m-a-x at kpitv dot net -Summary: 1 +Summary: Calls from incompatible contexts do weird things -Status: Open +Status: Not a bug Type: Bug -Package: *General Issues +Package: Scripting Engine problem Operating System: Linux PHP Version: 5.4.33 Block user comment: N Private report: N New Comment: This is already being dealt with: in PHP 5.6, the following deprecation warning will be emitted: Deprecated: Non-static method A::test() should not be called statically, assuming $this from incompatible context in /private/tmp/test.php on line 20 The deprecation is documented at http://php.net/manual/en/migration56.deprecated.php#migration56.deprecated.incompatible-context — in the longer term, I expect this will be removed, probably in PHP 7. Previous Comments: ------------------------------------------------------------------------ [2014-09-19 16:55:32] m-a-x at kpitv dot net Description: ------------ $C->someFunction(); must be same as C::someFunction(); but we have Fatal error: Access to undeclared static property: C::$test It is strange that it is still not fixed Test script: --------------- <? phpinfo(); class A { function test() { echo get_called_class(),"\n"; echo static::$test,"\n\n"; } } class B extends A { static $test = 'B'; } class C { function someFunction() { B::test(); } } B::test(); C::someFunction(); $C = new C(); $C->someFunction(); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68055&edit=1

« previous php.bugs (#187607) next »