Reply to Using parent with call_user_func_array

Your name:

Reply:


Posted by Chris on 09/03/05 22:33

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация