From:             ozone at cname dot com
Operating system: netbsd
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  method overloading works "correctly" but not "as described"

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

Reply via email to