A few Laravel 4.1 Update Gotchas

Update (12/12/1013)

One of the headaches with the upgrade to Production was waiting for ‘composer update’ to run while the site was down due to the skeleton and framework being out of sync. However, I’ve just realized that I should be pushing my composer.lock file to prod and just running ‘composer install’, which is much faster and makes sure your packages are in sync across environments. Doh!*

 

I have a bad habit of being an early adopter. Mavericks? Sign me up! New iPhone, I’m there! So when Laravel 4.1 was release a few hours ago, I had to jump in and update some apps. Upgradeing frameworks will probably never be as easy as upgrading WordPress, et al., but the changes to the Laravel app skeleton are pretty minor. However, once that’s done, there are few things to watch out for: After making the skeleton changes, the change to composer.json (“laravel/framework”: “4.0.*” to “laravel/framework”: “4.1.*”) and running ‘composer update install’ on my Dev and Test environments, everything was fine. But once I did the same in Production (no!), I got this:

Error Output: PHP Fatal error: Call to undefined method Illuminate\Foundation\Application::bindShared()

The error referenced bootstrap/compiled.php, so the fix was just to remove it, then re-run ‘composer update install’, with the the environment difference being that Dev and Test don’t create that file. Then in another app (not sure why this wasn’t a consistent issue), I got this when running ‘composer update install’:

{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' not found"...

Once again, I deleted ‘compiled.php’, but I also need to remove

"post-install-cmd": 
    [ "php artisan optimize" ], 
"pre-update-cmd": 
    [ "php artisan clear-compiled" ],

 from composer.json. (it turns out, you can run ‘composer update install’ with ‘–no-scripts’ to achieve the same.) After running the update, I added these lines back.

Last but not least, 4.1 includes something called FrameGuard that is enabled by default. This prevents cross-domain iframe embeds. I maintain two apps for which providing iframe video embed code is vital, so it would have been nice to know this would be the default have when I upgraded. Adding App::forgetMiddleware('Illuminate\Http\FrameGuard'); to bootstrap/start.php right before return $app; disables this behavior.

comments powered by Disqus