Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[L5.2][php7] Error with exeption #9650

Closed
Codenator81 opened this issue Jul 16, 2015 · 21 comments
Closed

[L5.2][php7] Error with exeption #9650

Codenator81 opened this issue Jul 16, 2015 · 21 comments

Comments

@Codenator81
Copy link

This error came when I try use Mail fasade in controller
FatalErrorException in FlattenException.php line 76:
Uncaught TypeError: Argument 1 passed to Symfony\Component\Debug\Exception\FlattenException::create() must be an instance of Exception, instance of TypeError given, called in /home/alex/www/laravel.local/vendor/symfony/debug/ExceptionHandler.php on line 206 and defined in /home/alex/www/laravel.local/vendor/symfony/debug/Exception/FlattenException.php:76
Stack trace:
#0 /home/alex/www/laravel.local/vendor/symfony/debug/ExceptionHandler.php(206): Symfony\Component\Debug\Exception\FlattenException::create(Object(TypeError))
#1 /home/alex/www/laravel.local/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(93): Symfony\Component\Debug\ExceptionHandler->createResponse(Object(TypeError))
#2 /home/alex/www/laravel.local/app/Exceptions/Handler.php(42): Illuminate\Foundation\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(TypeError))
#3 /home/alex/www/laravel.local/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(101): App\Exceptions\Handler->

As you can see not useful info what sup )

I using Laravel 5.2.x-dev

@Codenator81 Codenator81 changed the title [L5.2][php7] Another error with exeption [L5.2][php7] Error with exeption Jul 16, 2015
@GrahamCampbell
Copy link
Member

Laravel 5.2 isn't supported at all yet. Sorry.

@GrahamCampbell
Copy link
Member

Symfony will be fixing this in due course, but it may take until November.

@GrahamCampbell
Copy link
Member

I'm actually going to keep this open so I can personally keep track of this, since this will become important in the future if not addressed before we launch 5.2. Thank you very much for reporting @Codenator81. :)

@Codenator81
Copy link
Author

Lol I am stupid this is Symfony issue))) I think there issue all ready )

@GrahamCampbell
Copy link
Member

Is there any chance you could paste a link here. It will be useful for anyone else testing out new stuff early, and indeed for me to check out. :)

@GrahamCampbell
Copy link
Member

Had some feedback from symfony. See symfony/symfony#14086 (comment).

@GrahamCampbell
Copy link
Member

Given L5.1 is LTS, the PHP 7 fixes will end up getting backported where reasonable back into 5.1.

@Codenator81
Copy link
Author

Yes it make sense if Laravel5.1 is LTS and PHP 7 will RC in November

@GrahamCampbell
Copy link
Member

Yeh, we indent to have all currently supported Laravel versions working on all currently supported PHP versions. This means L5.1 will be working on php 5.5, 5.6, 7.0 before php 7 goes stable.

@nicolas-grekas
Copy link
Contributor

In Symfony, we cast Throwables to FatalThrowableError:

        if (!$exception instanceof \Exception) {
            $exception = new FatalThrowableError($exception);
        }

Laravel should do the same don't you think?

@GrahamCampbell
Copy link
Member

That works for me. :)

@GrahamCampbell
Copy link
Member

We're planning on getting 5.2 fully working on php 7, then we're going to backport what's reasonable to 5.1 after we've had time to test it for a bit.

@GrahamCampbell
Copy link
Member

Ok, we've got this sorted. PHP 7 support should ship in the next 5.1 release.

@Codenator81
Copy link
Author

Great. )

@laurencei
Copy link
Contributor

@GrahamCampbell - I just got this error on Laravel 5.1.26 (LTS) running on Homestead PHP7.0.0RC5

To replicate - I was accidentally injecting a FormRequest object on one of my controller methods during a GET request (which I know I shouldnt - it was an accident).

It keep throwing me the exact error above - which made it difficult to determine what was going on.

So it seems the issue is not fully fixed yet? Or at least not fully backported to 5.1

@GrahamCampbell
Copy link
Member

This issue should have been fixed in 5.1+. I fixed it myself.

@laurencei
Copy link
Contributor

Well - I'm running 5.1.26 and I got the error above - so it can still occur...

@laurencei
Copy link
Contributor

Actually - its a slightly different error:

FatalThrowableError in FlattenException.php line 76:
Type error: Argument 1 passed to Symfony\Component\Debug\Exception\FlattenException::create() must be an instance of Exception, instance of ParseError given, called in /home/vagrant/www/ambulance/myshift/vendor/symfony/debug/Exception/FlattenException.php on line 98

in FlattenException.php line 76
at FlattenException::create(object(ParseError)) in FlattenException.php line 98
at FlattenException::create(object(ReflectionException)) in ExceptionHandler.php line 209
at ExceptionHandler->createResponse(object(ReflectionException)) in Handler.php line 155
at Handler->convertExceptionToResponse(object(ReflectionException)) in Handler.php line 98
at Handler->render(object(Request), object(ReflectionException)) in Handler.php line 55
at Handler->render(object(Request), object(ReflectionException)) in Kernel.php line 281
at Kernel->renderException(object(Request), object(ReflectionException)) in Kernel.php line 91
at Kernel->handle(object(Request)) in index.php line 53

And to cause it - I had a syntax error in my PHP code - but I couldnt work it out for ages (because the error message wasnt helpful). In my FormRequest object I had this:

        return [
            'date' => 'required|string|date_format:d-m-Y'
            'area_list' => 'required|string|exists:area_staff_sheet_lists,id'
            'shift_type' => 'required|string|in:day,night,oncall'
        ];

Notice the missing 'commas' at the end of each row

@laurencei
Copy link
Contributor

I've opened a seperate ticket for it - 11329

@missael
Copy link

missael commented May 15, 2016

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

@adulion
Copy link

adulion commented Aug 12, 2016

@missael did you get this sorted? i have exactly the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants