Using Laravel 3 on PHP 5.5

If you try to run Laravel 3 on a server with PHP 5.5 and then attempt to make a migration you’ll probably get an error that looks something like:

Parse error: syntax error, unexpected 'yield' (T_YIELD), expecting '(' in /laravel/helpers.php on line 563

Luckily enough for you there’s a solution. Just run a find and replace on your project and replace any instance of
yield($var)

with

yield_content($var)

In my experience so far if you’re just looking at solving the problem with making and running migrations you only need to change it in the helpers file but there might be other instances of `yield` around the place. This change is required because in PHP5.5 the PHP team decided to claim yield as their own funtion. This won’t be a problem in Laravel 4.

EDIT: We’ve had some trouble with this with one of our apps at work so we’re rolling back to 5.4 I hope to have more posts about the process of getting up to 5.5 in the future.

About Nick

Melbourne based web developer that loves building front-end systems with anything from vanilla JS to React. Infosec student and active learner. Subscribe to the blog

www ·

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.