#45186 [NEW]: __call depends on __callstatic in class scope

From: Date: Thu, 05 Jun 2008 12:26:12 +0000
Subject: #45186 [NEW]: __call depends on __callstatic in class scope
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-125521@lists.php.net to get a copy of this message
From:             felipe@php.net
Operating system: 
PHP version:      5.3CVS-2008-06-05 (CVS)
PHP Bug Type:     Scripting Engine problem
Bug description:  __call depends on __callstatic in class scope

Description:
------------
The magic method __call depends on __callstatic to be called in *class
scope*.

Adding:
	static public function __callstatic($a, $b) {
		print "__callstatic:\n";
		var_dump($a);
	}

The __call is called. Therefore, why dependency on __callstatic?

Reproduce code:
---------------
<?php

class bar  {
	public function __call($a, $b) {
		print "__call:\n";
		var_dump($this);
	}
	public function test() {
		self::ABC();
		bar::ABC();
		call_user_func(array('bar', 'abC'));
	}
}

$x = new bar;

$x->test();

Expected result:
----------------
__call:
object(bar)#1 (0) {
}
__call:
object(bar)#1 (0) {
}
__call:
object(bar)#1 (0) {
}


Actual result:
--------------
__call:
object(bar)#1 (0) {
}
__call:
object(bar)#1 (0) {
}

Warning: call_user_func() expects parameter 1 to be a valid callback,
class 'bar' does not have a method 'abc' in ...


-- 
Edit bug report at http://bugs.php.net/?id=45186&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45186&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45186&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45186&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45186&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45186&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45186&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45186&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45186&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45186&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45186&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45186&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45186&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45186&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45186&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45186&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45186&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45186&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45186&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45186&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45186&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#125521) next »