Magento2: setup:upgrade is throwing PHP Fatal error

Created on 1 Apr 2016  路  15Comments  路  Source: magento/magento2

I have downloaded installed a magento 2.0.2 CE (with sample data). I have played around with a sample plugin and got in to an error. so i have remove all plugins and run
bin/magento setup:upgrade
then
bin/magento setup:di:compile

but there is no "generate" folder created inside "var" folder

when i tried to open site in browser its showing 500 error
apache error log shows following error

[Fri Apr 01 17:11:36.545866 2016] [:error] [pid 32343] [client 127.0.0.1:60961] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\\Framework\\Config\\Scope::__construct() must be an instance of Magento\\Framework\\App\\AreaList, instance of Magento\\Framework\\ObjectManager\\ObjectManager given, called in /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 97 and defined in /var/www/magento2/vendor/magento/framework/Config/Scope.php:37\nStack trace:\n#0 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(97): Magento\\Framework\\Config\\Scope->__construct(Object(Magento\\Framework\\ObjectManager\\ObjectManager))\n#1 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->createObject('Magento\\\\Framewo...', Array)\n#2 /var/www/magento2/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\\\Framewo...')\n#3 /var/www/magento2/vendor/magento/framework/App/ObjectManager/Environment/Com in /var/www/magento2/vendor/magento/framework/Config/Scope.php on line 37

when i tried to re run the bin/magento setup:upgrade command the following error is appearing

`ti@SUYPC092:/var/www/magento2$ sudo bin/magento setup:upgrade
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Framework\Config\Scope::__construct() must be an instance of Magento\Framework\App\AreaList, instance of Magento\Framework\ObjectManager\ObjectManager given, called in /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 97 and defined in /var/www/magento2/vendor/magento/framework/Config/Scope.php:37
Stack trace:

0 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(97): Magento\Framework\Config\Scope->__construct(Object(Magento\Framework\ObjectManager\ObjectManager))

1 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\Framewo...', Array)

2 /var/www/magento2/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\Framewo...')

3 /var/www/magento2/vendor/magento/framework/App/ObjectManager/Environment/Com in /var/www/magento2/vendor/magento/framework/Config/Scope.php on line 37`

Ready for Work bug report

Most helpful comment

I had the same issue.
Deleting var/generation, var/cache and var/di solved it for me.

All 15 comments

@aswanthkumarks what mode are you in?

@mazhalai i am using default mode.
i have re created theissue with new installsion.
steps:

  1. downloaded magento 2.0.2 compressed file from magento site
  2. installed using frontend ui
  3. Uncommented SetEnv MAGE_MODE developer in htaccess file
  4. run sudo bin/magento setup:upgrade
  5. run sudo bin/magento setup:di:compile
  6. changed permission of magento root folder to 777
  7. tried loading the page the mentioned error was showing in the apache error log.
  8. after this all magento commands shows this error

@aswanthkumarks thank you. We have created related ticket MAGETWO-51440

Same issue here, using PHP 7.0

I had the same issue.
Deleting var/generation, var/cache and var/di solved it for me.

I got there after bin/magento setup:di:compile so I also had to:

rm -rf var/ge
neration/ var/di/
rm -rf /var/www/magento/var/cache /var/www/magento/var/di /var/www/magento/var/generation/ /var/www/magento/var/page_cache/

When you remove var content, di:compile results are also removed... so just don't run them (works only for default or developer mode).

I'm getting the same issue, also on php 7. I tested on php 5 and that worked fine.

failed: [172.28.128.3] => {"changed": true, "cmd": ["/usr/bin/php", "bin/magento", "setup:static-content:deploy"], "delta": "0:00:01.699265", "end": "2016-05-07 19:17:51.399373", "rc": 255, "start": "2016-05-07 19:17:49.700108"}
stderr: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Magento\Framework\Config\Scope::__construct() must be an instance of Magento\Framework\App\AreaList, instance of Magento\Framework\ObjectManager\ObjectManager given, called in /data/web/public/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 97 and defined in /data/web/public/vendor/magento/framework/Config/Scope.php:37
Stack trace:
#0 /data/web/public/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(97): Magento\Framework\Config\Scope->__construct(Object(Magento\Framework\ObjectManager\ObjectManager))
#1 /data/web/public/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#2 /data/web/public/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Framewo...')
#3 /data/web/public/vendor/magento/framework/App/ObjectManager/Environment/Compiled. in /data/web/public/vendor/magento/framework/Config/Scope.php on line 37

I'm running 7.0.5, and I'm guessing the people above are as well. I think this might have something to do with:

There is a known PHP issue that affects our code compiler when using PHP 7.0.5. We recommend you not use PHP 7.0.5.
http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements.html
https://bugs.php.net/bug.php?id=71914

If that's not the case it could be that there is a missing extend here

In Magento\Framework\ObjectManager\Factory\Compiled, there is a call to interface method Magento\Framework\ObjectManager\ConfigInterface::getArguments() that internally fetches serialized array data from var/di/*.ser files.

In the method Magento\Framework\ObjectManager\Config\Compiled::getArguments(), we can find out that the fallback for argument list is a Magento\Framework\ObjectManagerInterface.

Which brings me to the conclusion that once the var/di/ folder emptied after install and setup:di:compile re-run, we should find the class Magento\Framework\Config\Scope in the DI cache, but we can't (eg. by running find var/di/ -type f -print | xargs grep "Magento\\Framework\\Config\\Scope").

Is there an class exclusion list during setup:di:compile that would produce this?

@all this issue has been fixed in the develop branch. Related commit b029938ae996ee0a2d8948587882ddf52e3bc994
Closing this issue. Please add a new ticket if problems persist

@mazhalai but, how do I implement this fix into an existing structure?

@techgeeksquared add .patch to the url for the commit above, copy contents and apply patch.

@mazhalai Thank you.

Was anyone able to overcome this issue? Trying to upgrade from 2.0.5 to 2.0.6.

Catchable fatal error: Argument 1 passed to Magento\Framework\Filesystem\Directory\ReadFactory::__construct() must be an instance of Magento\Framework\Filesystem\DriverPool, array given, called in C:\xampp\htdocs\cms\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php on line 93 and defined in C:\xampp\htdocs\cms\vendor\magento\framework\Filesystem\Directory\ReadFactory.php on line 24

How can solve this? please help.

@Darshan411 Download the zip pack from github https://github.com/magento/magento2/releases, Then extract the same. Run composer install. Its solve my above issue.

Was this page helpful?
0 / 5 - 0 ratings