symfony Shopware 6.5 Twig插件:错误页面

txu3uszq  于 7个月前  发布在  PWA
关注(0)|答案(1)|浏览(79)

Twig在Shopware 6.5中使用DDEV时未显示为错误页面

我使用symfony flex模板用ddev初始化了一个新的Shopware 6.5项目。
通常,symfony-context中的任何异常都应该呈现为错误页面。这对于普通的PHP-PHP来说很好。然而,Twig-Template产生的任何异常(例如,拼写为iffif语句)显示的是空白页面而不是错误页面。正确的错误仍然会记录在服务器日志中。
为了更好的再现性,这里是我使用的config.yaml

name: shopware-project
type: shopware6
docroot: public
php_version: "8.1"
developer_mode: true
webserver_type: apache-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: true
additional_hostnames: []
additional_fqdns: []
database:
    type: mariadb
    version: "10.4"
nfs_mount_enabled: false
mutagen_enabled: false
use_dns_when_possible: false
composer_version: "2"
web_environment: []
nodejs_version: "16"
disable_settings_management: true

我已经使用X-tool追踪到vendor/symfony/http-foundation/Response.php下的Response-Class。如果我取消注解行422($this->sendHeaders();),一切正常,我可以看到正确的错误页面。所以我认为它应该与ddev服务器配置有关。
除此之外:如果我使用相同的数据库使用MAMP运行相同的项目文件夹,它工作正常,我看到错误页面没有问题。ddev容器和MAMP-Server的头信息没有区别。

juud5qan

juud5qan1#

为了使用标准DDEV配置发送错误,必须调整php.ini。
由于vendor/symfony/error-handler/ErrorRenderer/HtmlErrorRenderer.php:307中使用preg_replace_callback处理的错误消息的长度,会发生PHP错误,因为preg_不适用于相反的字符串长度。
如果在php.ini中设置pcre.backtrack_limit=5000000,错误将被正确替换。
但是,这会导致nginx/apache中出现新的错误:

[error] 1931#1931: *3 upstream sent too big header while reading response header from upstream, client: 172.29.0.5, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm.sock:", host: "mysite.ddev.site`

我现在正在寻找一个解决nginx问题的方法。

相关问题