在里面pomo/po.php
:
# pomo/po.php
# 168: $res = implode("\\n", array_map(create_function(\'$x\', "return $php_with.\\$x;"), $lines));
# 256: $is_final = create_function(\'$context\', \'return $context == "msgstr" || $context == "msgstr_plural";\');
# 349: if (array() == array_filter($entry->translations, create_function(\'$t\', \'return $t || "0" === $t;\'))) {
$res = implode( "\\n", array_map( function( $x ) {
return $php_with.\\$x;
}, $lines ) );
$is_final = function( $context ) {
return $context == "msgstr" || $context == "msgstr_plural";
}
if (array() == array_filter($entry->translations, function($t) { return $t || "0" === $t; } ) ) {
然而,在
pomo/translations.php
, 这条线是
pomo/translations.php
208: return create_function(\'$n\', $func_body);
由于$func\\u body是一个变量,我们必须仔细查看代码:
function make_plural_form_function($nplurals, $expression) {
$expression = str_replace(\'n\', \'$n\', $expression);
$func_body = "
\\$index = (int)($expression);
return (\\$index < $nplurals)? \\$index : $nplurals - 1;";
return create_function(\'$n\', $func_body);
}
我们可以尝试使用PHP的
use
关键字(尚未测试此项,没有承诺它会起作用):
function make_plural_form_function($nplurals, $expression) {
$expression = str_replace(\'n\', \'$n\', $expression);
return function( $n ) use ( $expression, $nplurals ) {
$index = (int)($expression);
return ($index < $nplurals) ? $index : $nplurals - 1;
}
}
说了这么多,除非你
must 不要使用HHVM。这是一个大问题,即使只修复一次这些调用,也意味着每次重新安装或升级WordPress时,都必须反复执行。
EDIT: BIG WARNING HERE. WHAT I AM SUGGESTING IS A MODIFICATION TO WORDPRESS CORE. THIS SHOULD NEVER BE AN OPTION, ESPECIALLY IN A PRODUCTION ENVIRONMENT, UNLESS YOU ARE WILLING TO TAKE ON THE LONG-TERM MAINTENANCE OF A HACK TO THE CORE. DO NOT DO THIS