Php 从自定义MediaWiki挂钩返回结果

Php 从自定义MediaWiki挂钩返回结果,php,hook,mediawiki,Php,Hook,Mediawiki,我正在攻击一个现有的MediaWiki扩展,它向。由于迁移到PHP5.4和MW 1.22(从PHP5.3和MW 1.19.2),扩展似乎无法正常工作。问题在于定制钩子没有返回它应该返回的数据 以下是守则的相关部分: ProcessCite.php # Declare the hook: $wgHooks['CiteBeforeStackEntry'][] = 'wfProcessCite'; # the function itself function wfProcessCite($str,

我正在攻击一个现有的MediaWiki扩展,它向。由于迁移到PHP5.4和MW 1.22(从PHP5.3和MW 1.19.2),扩展似乎无法正常工作。问题在于定制钩子没有返回它应该返回的数据

以下是守则的相关部分:

ProcessCite.php

# Declare the hook:
$wgHooks['CiteBeforeStackEntry'][] = 'wfProcessCite';

# the function itself
function wfProcessCite($str, $argv){

# process $argv and $str to create a new version of $str
# $argv remains unchanged, $str is set to new value
  ...
  $str = "new string";

  return true;
}
在Cite_body.php中

function stack( $str, $key = null, $group, $follow, $call ) {
  # add the call to the CiteBeforeStackEntry hook
  wfRunHooks( 'CiteBeforeStackEntry', array( &$str, &$call ) );
我在
wfProcessCite
的开头和结尾添加了调试语句,这表明
$str
正在被修改;但是,
wfRunHooks
之前和之后的调试语句没有显示对
$str
的更改


有人能帮忙吗

从Mediawiki邮件列表上的Andru Vallance那里得到了答案:

在函数参数前面加上一个符号和字符会导致函数参数通过引用传入。 这意味着您直接在函数中操作原始变量,而不是复制

function wfProcessCite( &$str, $argv ){
    $str = ‘new value’; 
    return true;