Magento2: 1 exception(s): Exception #0 (Exception): Warning: Illegal offset type in isset or empty in /home/jewelrynest2/public_html/magento/vendor/magento/module-eav/Model/Entity/Attribute/Source/AbstractSource.php on line 76

Created on 12 Feb 2018  路  17Comments  路  Source: magento/magento2

Preconditions (*)


1.Magento 2.3.0
2.

Steps to reproduce (*)

To reproduce the issue. Please follow the below steps,

1.Product attribute grid -> select Quantity attribute-> Storefront Properties -> Change Visible on Catalog 2.Pages on Storefront to Yes

Expected result (*)

  1. Attribute should visible on frontend

Actual result (*)


1.Exception whille catalog product view
1 exception(s): Exception #0 (Exception): Warning: Illegal offset type in isset or empty in /home/jewelrynest2/public_html/magento/vendor/magento/module-eav/Model/Entity/Attribute/Source/AbstractSource.php on line 76

Eav Fixed in 2.2.x Fixed in 2.3.x Confirmed Format is valid Ready for Work PR Created Reproduced on 2.2.x Reproduced on 2.3.x

Most helpful comment

Hi,
I have noticed this issue today after trying to display the "Quantity" attribute in the product page

  • go to product attribute -> select Quantity one -> Storefront Properties -> Change Visible on Catalog Pages on Storefront to Yes

I still don't know why this happen

Regards,

All 17 comments

@kamal3294 thank you for your report.
Please use the issue reporting guidelines to report an issue. Please, edit issue description and include the preconditions, the steps required to reproduce, the actual result, and the expected result.
Please, add the following information:

  • [X] Preconditions: Magento version
  • [X] Steps to reproduce
  • [X] Expected result
  • [X] Actual result

Dear ,
I am new user in magento 2 , when we click on product then showing above error kindly help me.

Exception #0 (Exception): Warning: Illegal offset type in isset or empty in /home/jewelrynest2/public_html/magento/vendor/magento/module-eav/Model/Entity/Attribute/Source/AbstractSource.php on line 76

image

image

@kamal3294 thank you for your report.
We were not able to reproduce this issue by following the steps you provided.
Please try to reproduce this issue on the clean installation (clear, fresh, without any custom themes, third-party extensions, etc.) and tell us the result.

@kamal3294, we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

Hi,
I have noticed this issue today after trying to display the "Quantity" attribute in the product page

  • go to product attribute -> select Quantity one -> Storefront Properties -> Change Visible on Catalog Pages on Storefront to Yes

I still don't know why this happen

Regards,

@magento-engcom-team I am also facing the same issue after changing the Quantity attribute settings.

To reproduce the issue. Please follow the below steps,

Product attribute grid -> select Quantity attribute-> Storefront Properties -> Change Visible on Catalog Pages on Storefront to Yes

I confirm that there is an issue with quantity_and_stock_status (Qty) system attribute.
If somebody/admin changes it to be visible on frontend the following happens:

$value in \Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend::getValue is an array (with 2 elements afair: stock and qty). $value is a parameter in $this->getOption($value) and later in $source->getOptionText($optionId);.
Unfortunately \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource::getOptionText($value) is checking the following condition if (isset($options[$value])) {. Array keys can only be scalar, but $value is an array.

Illegal offset type in isset or empty in magento/vendor/magento/module-eav/Model/Entity/Attribute/Source/AbstractSource.php on line 76

W'd like to re-open this.

I could reproduce this with an attribute with custom backend model. Some more info here ... https://magento.stackexchange.com/questions/246201/custom-backend-model-for-multiselect-attributes-causes-exception

Attribute setup:

public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
    $eavSetup = $this->eavSetupFactory->create();
    $eavSetup->addAttribute(
        Product::ENTITY,
        Helper::ATTRIBUTE_CODE,
        [
            'group' => 'General',
            'type' => 'varchar',
            'label' => 'Label',
            'input' => 'multiselect',
            'source' => 'Vendor\Module\Model\Attribute\Source\Country',
            'backend' => 'Vendor\Module\Model\Attribute\Backend\Country',
            'required' => false,
            'sort_order' => 100,
            'global' => ScopedAttributeInterface::SCOPE_WEBSITE,
        ]
    );
}

Backend model can also be Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend ...

I have the same problem, this could be a fix (at least the detail page shows again):

        if (false === is_null($value) && false === is_array($value) && isset($options) && isset($options[$value])) {
            return $options[$value];
        }

Hi @TomashKhamlai. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

Hi @irajneeshgupta. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [x] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [x] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [x] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [x] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [x] 6. Add label Issue: Confirmed once verification is complete.

  • [x] 7. Make sure that automatic system confirms that report has been added to the backlog.

Hi @engcom-backlog-tomash. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

@irajneeshgupta Thank you for verifying the issue.

Unfortunately, not enough information was provided to created internal ticket. Please consider adding the following:

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

@irajneeshgupta Thank you for verifying the issue.

Unfortunately, not enough information was provided to created internal ticket. Please consider adding the following:

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

@irajneeshgupta Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-97571 were created

Hi @kamal3294. Thank you for your report.
The issue has been fixed in magento/magento2#20001 by @aditisinghcedcoss in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.2 release.

Hi @kamal3294. Thank you for your report.
The issue has been fixed in magento/magento2#21802 by @amol2jcommerce in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.9 release.

Was this page helpful?
0 / 5 - 0 ratings