Bug #62333 [NEW]: Cannot statically call method to parent class
| From: | Sjon at hortensius dot net | Date: | Fri, 15 Jun 2012 11:11:53 +0000 |
| Subject: | Bug #62333 [NEW]: Cannot statically call method to parent class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-171284@lists.php.net to get a copy of this message | ||
From: Sjon at hortensius dot net
Operating system:
PHP version: Irrelevant
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Cannot statically call method to parent class
Description:
------------
All static calls to a class-parent end up being non-static
Inconsistency clearly proven:
http://3v4l.org/Mkn0L
http://3v4l.org/1L3Wk (same, but without __call)
Test script:
---------------
See http://3v4l.org/Mkn0L
<?php
class A
{
public function __call($name, $args)
{
echo "Not static\n";
}
public static function __callStatic($name, $args)
{
echo "Static\n";
}
}
class B extends A
{
public function test()
{
forward_static_call(array('A', 'stuff'));
call_user_func(array('A', 'stuff'));
A::stuff();
}
}
class C
{
public function test()
{
forward_static_call(array('A', 'stuff'));
call_user_func(array('A', 'stuff'));
A::stuff();
}
}
A::test();
echo " = B =\n";
$b = new B();
$b->test();
echo " = C =\n";
$c = new C();
$c->test();
Expected result:
----------------
Static
= B =
Not static
Not static
Not static
= C =
Static
Static
Static
Actual result:
--------------
Static
= B =
Not static
Not static
Not static
= C =
Static
Static
Static
--
Edit bug report at https://bugs.php.net/bug.php?id=62333&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62333&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62333&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62333&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62333&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62333&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62333&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62333&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62333&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62333&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62333&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62333&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62333&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62333&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62333&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62333&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62333&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62333&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62333&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62333&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62333&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62333&r=mysqlcfg