2

I encountered the following issue when I was moved Magento 2 module into production with command setup:di:compile

Uncaught Error: Call to a member function setActive() on boolean in /opt/bitnami/apps/magento/htdocs/vendor/magento/module-backend/Model/View/Result/Page.php:27\nStack trace: /opt/bitnami/apps/magento/htdocs/generated/code/Magento/Backend/Model/View/Result/Page/Interceptor.php(24): Magento\Backend\Model\View\Result\Page->setActiveMenu('...')

I found a solution to delete magento\generated\metadata\global.php file which worked.

Does anyone know the purpose of global.php file and is it safe to delete it?

Thanks in advance.

  • I would look for any errors that occur while Magento is in developer mode, without running di:compile. You'll want to find a root cause of your issue, rather than trying to delete core Magento files. – andyjv Jan 18 at 15:01
0

As the documentation says

"The code compiler creates generated/metadata/global.php, which is a PHP serialized map of all constructor definitions mixed with object linking configuration defined in di.xml. di.xml is the dependency injection configuration. There is a global app/etc/di.xml and there can one defined for every module ."

0

Well looking into M2 core if the global.php is missing it runs environment in developer mode rather than compiled mode (check vendor/magento/framework/App/EnvironmentFactory.php getMode method). I have no idea what that means in terms of performance and why running in compiled mode causes the error you mentioned since none of this is documented.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.