Yesterday i updated a module and with the composer update command also some magento framework files were updated. After that saving a product after adjusting stock is not possible anymore, PhP error shows up:
Warning: Narrowing occurred during type inference. Please file a bug report on bugs.php.net in /home/jilco01/public_html/vendor/composer/ClassLoader.php on line 444 and product is not saved
My magento 2.2.1 runs on Php 7.1.12 and with Opcache and Redis.
3
Answers
After switching on PHP-FPM the problem was gone...
This is not a solution to the bug of PHP 7.1.12, but can help you to avoid this warning while coming out a patch or a new version (I suppose it could be solved then).
The problem is with the OPCache library, that “… improves PHP performance by storing precompiled script bytecode in shared memory…” more info: http://php.net/manual/en/intro.opcache.php.
The “solution” is clear the cache when the application is loaded. This is easy if you have an “single entry point” application (when you use a framework, for example). Just put the next function at the beginin of your index.php (or equivalent) file:
I’m not sure that this could be used in production servers, because could turn the application heavy.
In my case error caused by restarted php-fpm after upgrade new release (for folder symlink update).
Restart nginx additionally solve that error. But I think it’s temporary solution the php update should fix that.