Symfony 4:类类型参数的默认值只能是 [英] Symfony 4 : Default value for parameters with a class type can only be
问题描述
我目前正在 symfony 4 中开发一个应用程序.我遇到了在 prod 中部署的问题.当我到达导航器时,出现此错误:
I am currently working on an application in symfony 4. I encounter a problem for deploy in prod. when I get to the navigator I get this error :
致命错误:在第 40 行的/var/www/html/project/vendor/symfony/config/ResourceCheckerConfigCache.php 中,具有类类型的参数的默认值只能为 NULL.
Fatal error: Default value for parameters with a class type can only be NULL in /var/www/html/project/vendor/symfony/config/ResourceCheckerConfigCache.php on line 40.
public function __construct(string $file, iterable $resourceCheckers = array())
{
$this->file = $file;
$this->resourceCheckers = $resourceCheckers;
}
我指定该站点与开发服务器完美配合(php bin/console server:start)
I specify that the site works perfectly with the dev server (php bin /console server:start)
问题一定来自环境.在 .env 文件中,当我设置 APP_ENV=dev 时,浏览器中只有一个状态为 500 的空白页面(日志中没有消息)
The problem must come from the environment. in the .env file, when I set APP_ENV=dev , in the browser there is only a blank page with a status 500 (no message in the logs)
我在互联网上找不到任何文档,我开始缺乏想法.如果有人有解决方案,我很感兴趣.
I can not find any documentation on the internet and I am starting to lack ideas. If someone has a solution I am interested.
谢谢.
推荐答案
OP 的解决方案.
问题是 PHP 版本是 PHP 7.0 而不是 7.1.尽管在我的 shell 中,php -v
命令在 7.1 中很好,但我注意到 phpinfo ();
The problem was that the PHP version was PHP 7.0 and not 7.1. Though in my shell the php -v
command was fine with 7.1, I noticed the wrong version used by phpinfo ();
这篇关于Symfony 4:类类型参数的默认值只能是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!