Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magento 2.0.4 DI Compilation Breaks CLI Tool #4070

Closed
davidalger opened this issue Apr 8, 2016 · 19 comments
Closed

Magento 2.0.4 DI Compilation Breaks CLI Tool #4070

davidalger opened this issue Apr 8, 2016 · 19 comments
Assignees
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@davidalger
Copy link
Member

Steps to reproduce

  1. Install Magento 2.0.4 from composer packages
  2. Change application mode to: production
  3. Run bin/magento setup:di:compile-multi-tenant
  4. Attempt using the bin/magento tool

Failure encountered

Any attempt to run bin/magento fails until one manually removes the var/di/relations.ser file generated by the compile-multi-tenant process:

PHP Fatal error:  Uncaught Error: Cannot instantiate interface Magento\Framework\Filesystem\DriverInterface in /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:73
Stack trace:
#0 /var/www/magento2/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...')
#1 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(236): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framewo...')
#2 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(53): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Framewo...', NULL, 'filesystem', 'Magento\\Framewo...')
#3 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(82): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Framewo...', Array, Array)
#4 /var/www/magento2/vendor/magento/fr in /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 73

Detailed example

root@m2demo:10:00 AM:/var/www/magento2$ bin/magento | head -n1
Magento CLI version 2.0.4
root@m2demo:10:00 AM:/var/www/magento2$ bin/magento setup:di:compile-multi-tenant | sed 's/^.*$//' | tr "\n" . && echo
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
root@m2demo:10:01 AM:/var/www/magento2$ bin/magento
PHP Fatal error:  Uncaught Error: Cannot instantiate interface Magento\Framework\Filesystem\DriverInterface in /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:73
Stack trace:
#0 /var/www/magento2/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...')
#1 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(236): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framewo...')
#2 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(53): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Framewo...', NULL, 'filesystem', 'Magento\\Framewo...')
#3 /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(82): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Framewo...', Array, Array)
#4 /var/www/magento2/vendor/magento/fr in /var/www/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 73
root@m2demo:10:02 AM:/var/www/magento2$ ls -1 var/di
plugins.ser
relations.ser
root@m2demo:10:02 AM:/var/www/magento2$ rm -f var/di/relations.ser 
root@m2demo:10:02 AM:/var/www/magento2$ bin/magento | head -n1
Magento CLI version 2.0.4
root@m2demo:10:02 AM:/var/www/magento2$ bin/magento deploy:mode:show
Current application mode: production.
root@m2demo:10:02 AM:/var/www/magento2$
davidalger pushed a commit to davidalger/m2demo that referenced this issue Apr 8, 2016
@sshrewz sshrewz added the PS label Apr 8, 2016
@dsikkema-magento
Copy link
Contributor

created internal ticket MAGETWO-51699

@dsikkema-magento
Copy link
Contributor

@davidalger what's your php version? And do you get the same issue when running single-tenant compiler?

@Vinai
Copy link
Contributor

Vinai commented Apr 8, 2016

Seems related, and might be an easy way to reproduce:

$ php -v
PHP 7.0.5 (cli) (built: Mar 31 2016 06:38:53) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
    with blackfire v1.10.0, https://blackfire.io, by Blackfireio Inc.


$ vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist vendor/magento/module-catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php
PHPUnit 4.1.0 by Sebastian Bergmann.

Configuration read from /Volumes/CaseSensitive/Workspace/m2-zurich/mage2ce/dev/tests/unit/phpunit.xml.dist

......EEEEEE........

Time: 118 ms, Memory: 8.00Mb

There were 6 errors:

1) Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Edit\Tab\InventoryTest::testGetFieldValue with data set #0 (99, array('getField'), 'call-method')
PHPUnit_Framework_MockObject_RuntimeException: Class "Magento\CatalogInventory\Api\Data\StockItemInterface" does not exist.

/Volumes/CaseSensitive/Workspace/m2-zurich/mage2ce/vendor/magento/module-catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php:270

2) Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Edit\Tab\InventoryTest::testGetFieldValue with data set #1 (NULL, array(), 'default-result')
PHPUnit_Framework_MockObject_RuntimeException: Class "Magento\CatalogInventory\Api\Data\StockItemInterface" does not exist.

/Volumes/CaseSensitive/Workspace/m2-zurich/mage2ce/vendor/magento/module-catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php:270

3) Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Edit\Tab\InventoryTest::testGetFieldValue with data set #2 (99, array(), 'default-result')
PHPUnit_Framework_MockObject_RuntimeException: Class "Magento\CatalogInventory\Api\Data\StockItemInterface" does not exist.

/Volumes/CaseSensitive/Workspace/m2-zurich/mage2ce/vendor/magento/module-catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php:270

4) Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Edit\Tab\InventoryTest::testGetConfigFieldValue with data set #0 (99, array('getUseConfigField'), 'call-method')
PHPUnit_Framework_MockObject_RuntimeException: Class "Magento\CatalogInventory\Api\Data\StockItemInterface" does not exist.

/Volumes/CaseSensitive/Workspace/m2-zurich/mage2ce/vendor/magento/module-catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php:345

5) Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Edit\Tab\InventoryTest::testGetConfigFieldValue with data set #1 (NULL, array(), 'default-result')
PHPUnit_Framework_MockObject_RuntimeException: Class "Magento\CatalogInventory\Api\Data\StockItemInterface" does not exist.

/Volumes/CaseSensitive/Workspace/m2-zurich/mage2ce/vendor/magento/module-catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php:345

6) Magento\Catalog\Test\Unit\Block\Adminhtml\Product\Edit\Tab\InventoryTest::testGetConfigFieldValue with data set #2 (99, array(), 'default-result')
PHPUnit_Framework_MockObject_RuntimeException: Class "Magento\CatalogInventory\Api\Data\StockItemInterface" does not exist.

/Volumes/CaseSensitive/Workspace/m2-zurich/mage2ce/vendor/magento/module-catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php:345

FAILURES!
Tests: 20, Assertions: 51, Errors: 6.

@alankent
Copy link

alankent commented Apr 8, 2016

Could you try 7.0.4? There are reports of something breaking with 7.0.5. Not sure who's fault, but 7.0.5 is behaving differently in a way that impacts Magento.

@davidalger
Copy link
Member Author

The version I'm running is indeed 7.0.5. @alankent do you know off-hand what RPM I can use to install 7.0.4 readily? The stack setups I'm doing are using remi, which does not have the old versions present yet. I'll see what I can do to test this in 7.0.4

@davidalger
Copy link
Member Author

@dsikkema The single-tenant compiler is broken such that the CLI tool will not work. There is an open issue here on GH for that already I believe, and is an error something to do with the area preferences.

@Vinai
Copy link
Contributor

Vinai commented Apr 9, 2016

@alankent Same result in PHP 7.0.4

$ /usr/local/Cellar/php70/7.0.4/bin/php -v
PHP 7.0.4 (cli) (built: Mar  4 2016 11:25:38) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
    with blackfire v1.10.0, https://blackfire.io, by Blackfireio Inc.

$ /usr/local/Cellar/php70/7.0.4/bin/php vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist vendor/magento/module-catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php
PHPUnit 4.1.0 by Sebastian Bergmann.

Configuration read from /Volumes/CaseSensitive/Workspace/m2-zurich/mage2ce/dev/tests/unit/phpunit.xml.dist

......EEEEEE........

Time: 335 ms, Memory: 8.00Mb

There were 6 errors: 

[...same as above when running the test with 7.0.5...]

In fact, the same happens if I run this test with 7.0.3, 7.0.2, 7.0.1 or 7.0.0.
Before each run I do rm -r dev/tests/unit/tmp var/generation var/cache var/page_cache var/di to be on the safe side by the way. Leaving out that step makes no difference in the result though.

It seems like it's an issue in 2.0.4 with PHP7. The same tests succeed if I execute them with PHP 5.6.20.

davidalger pushed a commit to davidalger/capistrano-magento2 that referenced this issue Apr 9, 2016
@alankent
Copy link

alankent commented Apr 9, 2016

Thanks! I will escalate internally.

@MauroNigrele
Copy link

Same here on php7.0.5 using either multi/single tenant more details here

Complemental Information:

  • If you look at var/di/relations.ser you will find an empty serialized string {}
  • and the compile process stops at Marketplace module.

@mazhalai mazhalai added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Apr 11, 2016
@robversluis
Copy link

acknowledged

@thlassche
Copy link
Contributor

The igbinary implementation breaks as well on 7.0.x

@degaray
Copy link

degaray commented Apr 15, 2016

Any workaround for this error?

@davidalger
Copy link
Member Author

@degaray The only workaround would be to remove the var/di/relations.ser file after the failed compilation so that the app continues to run. Obviously not a long-term solution since that is effectively nullifying the meta-data caching intended to speed up performance.

@thlassche
Copy link
Contributor

Is there an update on this? My guess the root cause lies in the serialize implementation changes in PHP 7

@moleman
Copy link

moleman commented May 13, 2016

I had the same issue when running on php 7.0.5 but it works on php 7.0.6

@thlassche
Copy link
Contributor

I can confirm that it works for 7.0.6 (both igbinary and standard serializer)

@miguelbalparda
Copy link
Contributor

Had this same issue with PHP 7.0.5 and Magento 2.0.6, removing var/di/relations.ser brought back the application.

davidalger pushed a commit to davidalger/capistrano-magento2 that referenced this issue May 25, 2016
@davidalger
Copy link
Member Author

I can confirm this works in 7.0.6 as well… so since it didn't turn out to be a real bug in Magento (which now officially does not support 7.0.5 specifically) I'm going to close this.

For any future readers: If you are running PHP 7.0.5 and having issues, upgrade to PHP 7.0.6 or better! :)

@LKIkost
Copy link

LKIkost commented Sep 4, 2017

Magneto 2.1.0 & php7.0.22 - don't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests