当前位置: 首页 > 知识库问答 >
问题:

从laravel 5升级到laravel 5.5导致错误参数1传递给App\Exceptions\Handler::report()

赵元白
2023-03-14

我们正在尝试将我们的laravel 5.0项目升级到laravel的最新版本(laravel 5.5也可以),以支持php7.1。当我们运行composer安装时,laravel给出了以下错误:

[Symfony\Component\Debug\Exception\FatalErrorException]未捕获类型错误:传递给App\Exceptions\Handler::report()的参数1必须是异常实例,给定错误实例,在C:\xampp7\htdocs\V.e.K.Lexmond\vendor\laravel\framework\src\Illuminate\Foundation\Boot strap\HandleExceptions中调用。php位于第73行,在C:\xampp7\htdocs\V.E.K.Lexmond\app\Exceptions\Handler中定义。php:25堆栈跟踪:#0 C:\xampp7\htdocs\V.E.K.Lexmond\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions。ph p(73):应用程序\异常\处理程序-

这个错误的原因是什么?我们希望任何人都能为我们的问题找到解决方案。

提前谢谢!

我们的网站

共有3个答案

祁鸿哲
2023-03-14
<?php

/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/

$app = new Illuminate\Foundation\Application(
    realpath(__DIR__.'/../')
);

/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/

$app->singleton(
    'Illuminate\Contracts\Http\Kernel',
    'App\Http\Kernel'
);

$app->singleton(
    'Illuminate\Contracts\Console\Kernel',
    'App\Console\Kernel'
);

$app->singleton(
    'Illuminate\Contracts\Debug\ExceptionHandler',
    'App\Exceptions\Handler'
);

/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/

return $app;
吴山
2023-03-14

Handler.php

使用异常;使用Illumate\Foundation\Exceptions\Handler作为ExceptionHandler;

类处理程序扩展了ExceptionHandler{

/**
 * A list of the exception types that should not be reported.
 *
 * @var array
 */
protected $dontReport = [
    'Symfony\Component\HttpKernel\Exception\HttpException'
];

/**
 * Report or log an exception.
 *
 * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
 *
 * @param  \Exception  $e
 * @return void
 */
public function report(Exception $e)
{
    return parent::report($e);
}

/**
 * Render an exception into an HTTP response.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Exception  $e
 * @return \Illuminate\Http\Response
 */
public function render($request, Exception $e)
{
    return parent::render($request, $e);
}

}

湛宜春
2023-03-14

你能在bootstrap/app中发布你拥有的吗。php?

还要检查一下文件中是否有这个

$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class

);

 类似资料:
  • 我正在使用QT Creator在Ubuntu上制作一个C++程序。我编写的程序编译得很好,直到我决定开始使用C++11而不是C++98(这是QT Creator中的默认值)。我使用的是自己的cmake文件,而不是qmake,为此,我在中包含了以下一行: 在转移到C++11之后,我在行得到一个错误。这是因为,据我所见,变量在任何地方都没有定义,尽管定义了变量。 因此,我有两个问题: 1)为什么变量没

  • 帮助我理解并解决这些错误。 错误: Symfony\Component\Debug\Exception\FatalThrowableError(E\u RECOVERABLE\u ERROR)类型错误:传递给App\Http\Controllers\Auth\LoginController::authenticated()的参数1必须是App\Http\Controllers\Auth\Reque

  • 自从我在收购Android Studio后创建了Gradle(大约一个月前)以来,我目前的项目一直在与Gradle一起构建。[我安装了一些Android Studio的早期更新,但没有问题。] 但是,今天,在我将Android Studio的最新更新升级为“7月11日”版本,从版本0.1.9升级到0.2.0之后,我的项目开始抱怨Gradle现在需要至少0.5.0。 所以,我不清楚的是:我一直假设G

  • 我有一个如下所示的graphql查询: 因此,名称和电子邮件将由名为详细信息的其余endpoint解析,但是地址字段需要由另一个名为地址的其余endpoint解析。>rest终结点还需要在中传递的(因为我的rest服务需要该字段)。我不确定,在这种情况下,我如何设计我的解析器? 同样,一个字段一旦解析,是否可以将数据发送到另一个字段?这在grapqhql中可能吗?

  • 我已经将我的项目从Angular 4升级到Angular 7,并且我得到以下错误: node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead.d.ts(3,10)中的错误:错误TS2305:模块“d://usman/dev_area/code/physician-portal/node_modules/rxjs/observable”没

  • 我正在尝试使用AJAX将页面中的大量数据传递给PHP脚本。这对于一些少量的数据来说很好,但是当有更多的数据时会出现以下错误。 我正在使用的JQuery是: 数据实际上是一个json数据字符串。 并在PHP中读取,只需使用: 我怎么能传递大量的数据链接这个,但仍然使用$_POST在PHP中引用它 我以为我需要用JSON做一些事情,但我可以弄清楚什么。 谢啦