Recent Posts


Upgrading Magento 2: var/generation


Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

I just grabbed the latest Magento 2 from source, and suddenly PHP was complaining about a method declaration

PHP Fatal error: Declaration of MagentoCoreModelUrlProxy::setRequest() must be compatible with MagentoUrlInterface::setRequest(MagentoAppRequestInterface $request) in /Users/alanstorm/Documents/apache-git/github-magento2-10-4-2013/magento2/var/generation/Magento/Core/Model/Url/Proxy.php on line 8

Even stranger, the class MagentoCoreModelUrlProxy is no longer a part of the latest Magento source code.

Taking a closer look at the error revealed the problem


It looks like Magento 2 is doing some sort of code generation/caching in the var/generation folder. Removing this folder (and it’s generated classes) appears to have cleared up the problem.

Copyright © Alan Storm 1975 – 2022 All Rights Reserved

Originally Posted: 2nd November 2013