7

I just installed Laravel 4 (Illuminate) and as I opened the index.php file in a browser, I was met with this error:

Parse error: syntax error, unexpected 'yield' (T_YIELD), expecting identifier (T_STRING) in /www/Laravel4/vendor/illuminate/view/src/Illuminate/View/Environment.php on line 339

I have fixed the permissions for the meta folder, and installed all the dependencies through Composer. I am running PHP version 5.5.0alpha2 on OSX 10.8.2.

hakre
  • 193,403
  • 52
  • 435
  • 836
Erik Djupvik
  • 1,187
  • 1
  • 10
  • 13
  • 2
    FYI: I created a report in their issue tracker: https://github.com/illuminate/view/issues/23 – hakre Dec 21 '12 at 13:15
  • 1
    FYI: The issue has been fixed, it's now PHP 5.5 compatible: https://github.com/illuminate/view/commit/d37abcecc7d79d00bf5f22b134d152ca765f26b2 – hakre Jan 09 '13 at 18:18

1 Answers1

12

That's because yield became a language construct in PHP 5.5 (used in Generators) - but someone decided that it's a good idea to use this short word to name a function:

public function yield($section)
{
  return isset($this->sections[$section]) ? $this->sections[$section] : '';
}

Downgrade to PHP 5.4 (after all, it's the current mainstream version, 5.5 is not even in beta yet) and it should work fine.

raina77ow
  • 103,633
  • 15
  • 192
  • 229