Re: Using parent with call_user_func_array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You know, ... after I posted this, I found another bug (not sure how I missed it before). This one may actually be the cause of my problem:

http://bugs.php.net/bug.php?id=32290

I don't relish the idea of an upgrade to work around this problem though. So any thoughts or idea would still be appreciated.

Chris wrote:

Should these two pieces of code function identically?

$aArgs = array('testarg1','testarg2');
call_user_func_array(array('parent','AddNewElement',$aArgs)

and

parent::AddNewElement('testarg1','testarg2');

I'm havign trouble debugging this, but my app seems to be going into an infinite loop when parent::AddNewElement is called with call_user_func_array.

I've found a fairly old bug related to self / parent and call_user_func[_array] , but this is nto the same thing. Though the discussions of this bug do lead me to believe that call_user_func_array should behave as I am expecting it to.

Am I missing something? Is this a bug? Is there a workaround?

More details about my problem follow

Apache2, PHP 5.0.3

I've got a method defined in a class called AddNewElement().

In a sub-class, I'm redefining overloading AddNewElement, and the only thing I want to do is add an argument to the argument list, and then pass it on to the parent::AddNewElement()

I can't do these statically, as the number of arguments is flexible (though it's guaranteed to have at least one argument..

<?php
...
   protected function AddNewElement($sClass)
   {
       $aArgs = func_get_args();
       array_splice($aArgs,1,0,(array)$this->NextID());
return call_user_func_array(array('parent','AddNewElement'),$aArgs);
   }
...
?>

Thanks,
Chris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux