ID: 41866
Updated by: [EMAIL PROTECTED]
Reported By: ozone at cname dot com
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: netbsd
PHP Version: Irrelevant
New Comment:
You are calling __call() directly. Documentation describes behavior
with indirect calling - method($parameters).
Previous Comments:
------------------------------------------------------------------------
[2007-07-01 21:26:50] ozone at cname dot com
Description:
------------
Documentation states that the __call() method will be passed two
arguments, the first being the name of the called method, the second
being *an array* of the arguments. Thus, when daisy-chaining the
__call() method via parent::__call() or equivalent, the second __call()
should have an array with a single element which is an array of the
arguments passed to the first __call().
The actual behavior is more desirable than the documented behavior, and
this is probably "not a bug". That said, I don't want to rewrite my code
if a future version of PHP changes the behavior without warning.
Reproduce code:
---------------
class a {
function __call($m, $a) {
echo "--- a::$m\n";
echo "call($m) ";
var_dump($a);
}
}
class b extends a {
function __call($m, $a) {
echo "--- b::$m\n";
if($m == "special") {
echo "special override ";
var_dump($a);
} else parent::__call($m, $a);
}
}
$ca = new a();
$cb = new b();
$ca->test();
$ca->test("one", "two");
$cb->special();
$cb->test();
$cb->test("one", "two");
Expected result:
----------------
A literal interpretation of the documentation says the var_dump
ultimately executed by the last call to $cb->test() "should" display
something like:
array(1) {
[0]=> array(2) {
[0]=>
string(3) "one"
[1]=>
string(3) "two"
}
}
Actual result:
--------------
array(2) {
[0]=>
string(3) "one"
[1]=>
string(3) "two"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41866&edit=1