如何处理index.php中Request::capture()中抛出的错误? Laravel版本:8(最新版本) PHP版本:7.4.10 数据库驱动程序&版本:MySql 5.6 说明:
在如何处理index.php中Request::capture()中抛出的错误? Laravel版本:8(最新版本) PHP版本:7.4.10 数据库驱动程序&版本:MySql 5.6 说明:,php,laravel,exception,error-handling,Php,Laravel,Exception,Error Handling,在Request::capture()中的index.php中抛出的异常不由错误处理程序\App\Exceptions\handler.php处理 在我的例子中:服务器上有一个杀毒软件,可以删除任何受感染的上传文件。当用户上载受感染的文件时。发生的情况是: 用户上传文件 PHP将文件路径放入全局请求中 防病毒软件会删除该文件 Symfony尝试在此处构建文件SymfonyRequest::createFromGlobals() Symfony在这里检查文件vendor/Symfony/http
Request::capture()
中的index.php
中抛出的异常不由错误处理程序\App\Exceptions\handler.php
处理
在我的例子中:服务器上有一个杀毒软件,可以删除任何受感染的上传文件。当用户上载受感染的文件时。发生的情况是:
SymfonyRequest::createFromGlobals()
vendor/Symfony/http foundation/file/file.php
:致命错误:Uncaught Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException:35行的/home/vagrant/code/eskan/vendor/Symfony/http foundation/File/File.php中不存在文件“/tmp/php6CKu5H”
vendor/symfony/http foundation/File/File.php中抛出错误,如下所示:
Request::capture()
中抛出的任何错误都可能具有相同的大小写。
是的,我也可以得到异常处理程序没有处理异常的问题,但我在浏览器中也没有看到异常,我只是看到了chrome generic 500错误。不过,我同意这不是一个框架问题。由于该问题源于
public/index.php
,并且该文件位于laravel/laravel
项目中,因此在该项目中指出索引中的异常不由异常处理程序处理可能更合适。
public function __construct(string $path, bool $checkPath = true)
{
if ($checkPath && !is_file($path)) {
throw new FileNotFoundException($path);
}
parent::__construct($path);
}
public function __construct(string $path, bool $checkPath = true)
{
throw new FileNotFoundException($path);
if ($checkPath && !is_file($path)) {
}
parent::__construct($path);
}