[TYPO3-core] RFC: t3lib_div::callUserFunction / parameters / call by reference

Wolfgang Klinger wolfgang at stufenlos.net
Fri Sep 1 10:07:08 CEST 2006


 *hiya!*

 t3lib_div callUserFunction parameters $params and $ref are passed by
 reference, but parameters for "call_user_func" are not passed by
 reference.

 This patch changes "call_user_func" to "call_user_func_array" to make
 this work (works since PHP 4.0.4, so it shouldn't be a problem).


 trunk only? IMHO it's a bug and should be applied to 4_0 too...


 tia, bye
 Wolfgang

-------------- next part --------------
Index: t3lib/class.t3lib_div.php
===================================================================
--- t3lib/class.t3lib_div.php   (revision 1700)
+++ t3lib/class.t3lib_div.php   (working copy)
@@ -3830,11 +3830,10 @@

                        // Check persistent object and if found, call directly and exit.
                if (is_array($GLOBALS['T3_VAR']['callUserFunction'][$funcName]))        {
-                       return call_user_func(
+                       return call_user_func_array(
                                                array(&$GLOBALS['T3_VAR']['callUserFunction'][$funcName]['obj'],
                                                        $GLOBALS['T3_VAR']['callUserFunction'][$funcName]['method']),
-                                               $params,
-                                               $ref
+                                               array(&$params, &$ref)
                                        );
                }

@@ -3891,10 +3890,9 @@
                                                );
                                        }
                                                // Call method:
-                                       $content = call_user_func(
+                                       $content = call_user_func_array(
                                                array(&$classObj, $parts[1]),
-                                               $params,
-                                               $ref
+                                               array(&$params, &$ref)
                                        );
                                } else {
                                        if (!$silent)   debug("<strong>ERROR:</strong> No method name '".$parts[1]."' in class ".$parts[0],1);
@@ -3904,7 +3902,7 @@
                        }
                } else {        // Function
                        if (function_exists($funcRef))  {
-                               $content = call_user_func($funcRef, $params, $ref);
+                               $content = call_user_func_array($funcRef, array(&$params, &$ref));
                        } else {
                                if (!$silent)   debug("<strong>ERROR:</strong> No function named: ".$funcRef,1);
                        }


More information about the TYPO3-team-core mailing list