1

I have created a new product in Magento 2.1 admin. I am getting the error shown below:

enter image description here

Warning: Illegal string offset 'is_in_stock' in [...]/vendor/magento/module-catalog-inventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php on line 87

Any idea what could cause this?

5 Answers 5

2

@johan , if you happen to be running PHP's OPCache extension on your server, please make sure opcache.save_comments is set to "1" in your opcache.ini file.

Though stripping comments can be par for the course in optimizing with OPCache, Magento 2.1 needs them for a getDocComments validation call in getExtensionAttributes method.

2
  • You just saved me from a mini heart attack. Commented Aug 24, 2016 at 4:42
  • @crashtestxxx I am not using opcache in local xampp system and i'm facing this in Magento 2.2.5.
    – Knight017
    Commented Sep 26, 2018 at 9:13
1

For fix this, go to Ves/Brand/etc/adminhtml/events.xml, comment code.

<event name="catalog_product_edit_action">
    observer name="ves_brand_loadproductbrand" instance="Ves\Brand\Observer\LoadProductBrand" 
</event>

OR comment event name catalog_product_edit_action

  1. Save file
  2. Upgrade magento using command line setup:upgrade
  3. Flush cache
0

Hey @Nikul Having this same issue, Ves Brand related error. After installing the Brand extension from LandOfCoder.com this eror began to occur.

After doing some research and come to the conclusion that because its just a warning its not effecting anything on our backend or our database its just extremely annoying..

So basically when it Calls for is_in_stock its expecting an array but it recieves a string which is in_stock which it does not like so it throws a warning.

If anyone has a better way of explaining it please chime in

To create this error. Fresh install magento 2.1 mysql 5.7 php7.04 nginx ubuntu 16.04 set developer mode install Ves_Brand https://ticksy_attachments.s3.amazonaws.com/Ves_Brand_v2.1.0_403.zip Add brand Group then add product Result = warning.

0

You have to enable opcache.save_comments

Follow the steps into the official guide: enter link description here

After the steps it's very important to regenarate DI files (ExtensionAttributesFactory.php) so you have to execute this command:

php bin/magento setup:di:compile

from your Magento installation directory

0

I bought this extension from landofcoder.com.

The worst experience ever... No replies from support and ignoring my help requests.

solution was to not buy from this company and avoid.

Wish I never came across them, extensions are full of bugs!!

Submit your extensions to Magento.. They will never get approved in a 100 years....

Worst of the worst..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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