From: reto at buxaprojects dot com
Operating system: Fedora
PHP version: 6CVS-2008-06-03 (snap)
PHP Bug Type: Class/Object related
Bug description: __callStatic() called only in static methods
Description:
------------
__call() instead of __callStatic() is called, when we call a static method
from a non-static method.
Reproduce code:
---------------
abstract class One
{
public function __call($m, $p)
{
echo '__call(' . $m . ') called' . "\n";
}
public static function __callStatic($m, $p)
{
echo '__callStatic(' . $m . ') called' . "\n";
}
}
class Two extends One
{
public function __construct()
{
$this->normalMethod();
self::staticMethod();
}
private function normalMethod()
{
echo 'normalMethod() called' . "\n";
parent::a();
self::b();
static::c();
One::d();
Two::e();
}
private static function staticMethod()
{
echo 'staticMethod() called' . "\n";
parent::a();
self::b();
static::c();
One::d();
Two::e();
}
}
$two = new Two();
Expected result:
----------------
normalMethod() called
__call(a) called
__callStatic(b) called
__callStatic(c) called
__callStatic(d) called
__callStatic(e) called
staticMethod() called
__callStatic(a) called
__callStatic(b) called
__callStatic(c) called
__callStatic(d) called
__callStatic(e) called
Actual result:
--------------
normalMethod() called
__call(a) called
__call(b) called
__call(c) called
__call(d) called
__call(e) called
staticMethod() called
__callStatic(a) called
__callStatic(b) called
__callStatic(c) called
__callStatic(d) called
__callStatic(e) called
--
Edit bug report at http://bugs.php.net/?id=45159&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45159&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45159&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45159&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45159&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45159&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45159&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45159&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45159&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45159&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45159&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45159&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45159&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45159&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45159&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45159&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45159&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45159&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45159&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45159&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45159&r=mysqlcfg