r79913 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79912‎ | r79913 | r79914 >
Date:20:15, 9 January 2011
Author:yaron
Status:deferred
Tags:
Comment:
Fix for call_user_func_array() for PHP >= 5.3.1
Modified paths:
  • /trunk/extensions/ExternalData/ED_ParserFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ExternalData/ED_ParserFunctions.php
@@ -344,11 +344,18 @@
345345 $params[$j] = str_replace( '{{{' . $variable . '}}}', $value, $params[$j] );
346346 }
347347 }
348 - // add $parser to the beginning of the $params array,
 348+ // Add $parser to the beginning of the $params array,
349349 // and pass the whole thing in as arguments to
350 - // doSetInternal, to mimic a call to #set_internal
 350+ // doSetInternal, to mimic a call to #set_internal.
351351 array_unshift( $params, $parser );
352 - call_user_func_array( array( 'SIOHandler', 'doSetInternal' ), $params );
 352+ // As of PHP 5.3.1, call_user_func_array() requires that
 353+ // the function params be references. Workaround via
 354+ // http://stackoverflow.com/questions/2045875/pass-by-reference-problem-with-php-5-3-1
 355+ $refParams = array();
 356+ foreach ( $params as $key => $value ) {
 357+ $refParams[$key] = &$params[$key];
 358+ }
 359+ call_user_func_array( array( 'SIOHandler', 'doSetInternal' ), $refParams );
353360 }
354361 return null;
355362 }

Status & tagging log