Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Gemini Brain
Gemini Brain
14,273 Points

Parse Error with using redirect function

Everytime I want to use redirect function it shows me a parse error.

Parse error: syntax error, unexpected '?' in /vendor/symfony/http-foundation/Response.php on line 501

Could you help me? I did everything according to this and previous videos and when I want to log in it shows me this error. When I comment redirect function, parse error dissappear.

Ever ten times maybe more I check my redirect function and videos and everything is the same... I don't know what I'm doing wrong.

3 Answers

Gemini Brain
Gemini Brain
14,273 Points

It's already ok, but thank you for your quick response James. It was casued bacuse of my PHP version 7.0. In last version of symfony/http-foundation are used iterables (http://php.net/manual/en/language.types.iterable.php)

But these iterables are available from PHP version 7.1, so I changed my PHP version at my hosting provider and everything's alright.

Parse error was reporting unexpected using of a question mark as described above and this fact actually reffers to iterables.

Thanks again James.

jamesjones21
jamesjones21
9,260 Points

Is this laravel? Can you post your method? You may need to do return redirect ()->back();

Hey Martin, glad you were able to figure out. It would be helpful to the community if you selected a best answer, so other people will know this question has been resolved. Thanks