|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-18 19:18 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 17 08:00:01 2025 UTC |
Description: ------------ When trying to use call_user_func_array() to call a parent method php calls the current class method and therefore goes into a loop. Reproduce code: --------------- <?php class a { public function xyz () { $args = func_get_args(); print("\n\na:\n"); var_export($args); } } class b extends a { public function xyz () { $args = func_get_args(); print("\n\nb:\n"); var_export($args); call_user_func_array(array('parent', 'xyz'), $args); } } $b = new b(); $b->xyz('zero', 'one', 'two', 'three', 'four'); ?> Expected result: ---------------- b: array ( 0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', ) a: array ( 0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', ) Actual result: -------------- b: array ( 0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', ) b: array ( 0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', ) b: array ( 0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', ) ... [Inf loop]