0
votes

We are trying to upgrade our laravel 5.0 project to the latest version of laravel (laravel 5.5 would be also fine) to support php7.1. When we are running composer install laravel gives the error below:

[Symfony\Component\Debug\Exception\FatalErrorException] Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instanc e of Error given, called in C:\xampp7\htdocs\V.E.K. Lexmond\vendor\laravel\framework\src\Illuminate\Foundation\Boot strap\HandleExceptions.php on line 73 and defined in C:\xampp7\htdocs\V.E.K. Lexmond\app\Exceptions\Handler.php:25 Stack trace: #0 C:\xampp7\htdocs\V.E.K. Lexmond\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.ph p(73): App\Exceptions\Handler->report(Object(Error)) #1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error)) #2 {main} thrown

What would be the reason of the this error? We hope anyone got a solution for our problem.

Thank you in advance!

WeTalkive

3
can you post your code for app\Exceptions\Handler.php ?syam
See my files belowWeTalkive
Are you following the upgrade instructions? laravel.com/docs/5.7/upgradeJason Houle
Yes, but it already fails on the composer installWeTalkive

3 Answers

0
votes

Can you post what you have in bootstrap/app.php?

also check if you have this in that file

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

);

0
votes

Handler.php

use Exception; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends 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);
}

}

0
votes
<?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;