I kept getting this issue after installing this package below
https://github.com/vinkla/instagram
into my Laravel 5.1 project.
I followed everything in the instruction.
I am on Mac OS X, PHP 7.1, Laravel 5.1.
Did I forget something?
Your report()
method is being passed a PHP7 Throwable instead of an Exception.
Laravel 5.1 was not updated to support PHP7 Throwables until 5.1.8.
Considering the error, and the line number specified in HandleExceptions.php, it seems as if you are using a version previous to this (5.1.0 - 5.1.7).
You will need to update Laravel to at least 5.1.8 to fix this error. 5.1.8 was updated to convert Throwables to Symfony\Component\Debug\Exception\FatalThrowableError
exceptions, which are then passed to the report()
method.
You could change app\Exceptions\Handler.php
to not have the type declaration Exception
and handle some logic within it to convert the Error to an Exception. It looks like this is a known issue in laravel 5.2 <= with php 7. https://github.com/laravel/framework/issues/9650
from:
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
{
parent::report($exception);
}
to:
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @return void
*/
public function report($exception)
{
if ($exception instanceof Exception) {
parent::report($exception);
} else {
// convert to exception and then parent::report.
}
}
You will most likely need to do the same thing with the Handler render
method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With