Miguel Stevens
Miguel Stevens

Reputation: 9191

Laravel FatalErrorException in Handler.php line 25

I'm getting the following error on random occasions, working on a Laravel 5.1 project on the latest homestead with PHP7

FatalErrorException in Handler.php line 25:
Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of TypeError given, called in /home/vagrant/Code/henau/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 73 and defined in /home/vagrant/Code/henau/app/Exceptions/Handler.php:25
Stack trace:
#0 /home/vagrant/Code/henau/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(73): App\Exceptions\Handler->report(Object(TypeError))
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(TypeError))
#2 {main}
thrown

Even when I undo work that has been causing it, It stays. It's being caused by this block of code in this instance

\Mail::send('emails.registered', $user, function ($m) {
    $m->to('[email protected]')->subject('New Order');
});

It seems to me the error is not directly code-related. I've seen other people encounter it in complete different situations. And i've seen it popup in older threads regarding Homestead and PHP7. There was an askubuntu thread but it's offline, So I hope we can reopen the discussion here.

Upvotes: 3

Views: 10524

Answers (3)

Harshi Srivastava
Harshi Srivastava

Reputation: 151

This situation occur when laravel project version not compatible or not configured with your local installed version So the laravel not tracking the exact error and instead of showing exact error on line shows that type of errors

i had same problem in laravel 5.1. After reading this issue, i found out i was using laravel v5.1.0 and that seemed wrong so changed 5.1.0 to 5.1.* and ran composer update. this solved the issue for me.

Upvotes: 0

Carlos Adames
Carlos Adames

Reputation: 178

I had the same problem when running seeders Notflip . I'm usign Laravel framework 5.0.34. I had this structure:

App/Models/Users/ (My users's Models here)

After moving my users's models to the App directory, my seeder problem was solved.

Check your namespaces and put under consideration your Laravel Framework version before make changes in the framework.

Hope it helps!

Upvotes: 1

Miguel Stevens
Miguel Stevens

Reputation: 9191

Solution

This is actually an error that an exception can't be shown. This is caused by using PHP7.x on an older Laravel project that requires PHP5.6.x

My solution was to create a new Homestead specific for this project and install php5.6 on that homestead using an older version of laravel/homestead

Upvotes: 3

Related Questions