纳速健身
标题:
drupal8安装时提示functions.php括号不匹配安装错误
[打印本页]
作者:
awagink
时间:
2016-1-18 21:47
标题:
drupal8安装时提示functions.php括号不匹配安装错误
求助:在安装drupal8时,php-fpm返回的日志中打印functions.php括号不匹配,具体错误日志如下:
[02-Jan-2015 21:59:37] PHP Parse error: syntax error, unexpected '[', expecting ')' in /usr/share/nginx/html/drupal8/core/vendor/react/promise/src/functions.php on line 62
[03-Jan-2015 00:20:43] PHP Parse error: syntax error, unexpected '[', expecting ')' in /usr/share/nginx/html/drupal8/core/vendor/react/promise/src/functions.php on line 62
[03-Jan-2015 00:21:37] PHP Parse error: syntax error, unexpected '[', expecting ')' in /usr/share/nginx/html/drupal8/core/vendor/react/promise/src/functions.php on line 62
对于的function.php文件如下:
其中62行对应一个if匹配:
if (!is_array($array) || !$array || $howMany < 1) {
return resolve([]);
}
复制代码
从代码看并没有错误,而且源代码我也没修改过。
完整的函数如下:
function some($promisesOrValues, $howMany)
{
return resolve($promisesOrValues)
->then(function ($array) use ($howMany) {
if (!is_array($array) || !$array || $howMany < 1) {
return resolve([]);
}
return new Promise(function ($resolve, $reject, $progress) use ($array, $howMany) {
$len = count($array);
$toResolve = min($howMany, $len);
$toReject = ($len - $toResolve) + 1;
$values = [];
$reasons = [];
foreach ($array as $i => $promiseOrValue) {
$fulfiller = function ($val) use ($i, &$values, &$toResolve, $toReject, $resolve) {
if ($toResolve < 1 || $toReject < 1) {
return;
}
$values[$i] = $val;
if (0 === --$toResolve) {
$resolve($values);
}
};
$rejecter = function ($reason) use ($i, &$reasons, &$toReject, $toResolve, $reject) {
if ($toResolve < 1 || $toReject < 1) {
return;
}
$reasons[$i] = $reason;
if (0 === --$toReject) {
$reject($reasons);
}
};
resolve($promiseOrValue)
->then($fulfiller, $rejecter, $progress);
}
});
});
}
复制代码
----------------------------------------------------------------------------------------------------------------
解决方法:
是PHP版本问题,你安装php 5.4以上就没了。
欢迎光临 纳速健身 (https://nasue.com/)
Powered by Discuz! X3.4