Thursday, March 8, 2018

Instagram Integration on Laravel 5

Leave a Comment

I kept getting this issue after installing this package below

https://github.com/vinkla/instagram

into my Laravel 5.1 project.

2018-02-27 at 1 55 36 pm

I followed everything in the instruction.

I am on Mac OS X, PHP 7.1, Laravel 5.1

Did I forget something?

How would one go about and debug this further ?


I'm open to any suggestions at this moment.

Any hints/suggestions / helps on this be will be much appreciated!

3 Answers

Answers 1

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.

Answers 2

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.

Answers 3

It seems to be a bug in Laravel. Do you have the last release of Laravel 5.1?

For helping debug, you might go to the vendor/Illuminate/Foundation/Bootstrap/HandleExceptions@handleException and add dd($e) at the first line of method.

Ex:

public function handleException($e) {     dd($e);     //.. } 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment