如何在 Laravel 中修复 "Invalid header value: must be a string or array of strings"

How to fix "Invalid header value: must be a string or array of strings" in Laravel

我在本地没有的产品服务器上遇到了问题。 Laravel 向我发送一条错误消息,指出存在 header 问题。我认为这是一个 Apache 问题。

我在本地机器上使用 Mamp。 Laravel 正在使用带有 Laravel Passport 的 OAuth。我已经在我的本地机器上试过了,它正在工作。我也在 Apache 服务器上 运行。

在我的生产服务器上,只要我想登录我的应用程序,就会出现此错误:

ERROR 500 : InvalidArgumentException, Invalid header value: must be a string or array of strings; cannot be an empty array.

它在 MessageTrait.php line 389 来自 Laravel Zendframwork 供应商。

也许它只是服务器上的一个模块?

谢谢

我遇到了同样的问题,我的解决方案是将下一个包降级到该特定版本,因为那是我项目中使用的版本:

composer require symfony/http-kernel:3.4.20
composer require symfony/http-foundation:3.4.20
composer require symfony/psr-http-message-bridge:1.1.0

希望对你有用。