Please check below error:

Fatal error: Method Magento\Ui\TemplateEngine\Xhtml\Result::__toString() must not throw an exception, caught Error: Cannot use string offset as an array in /vendor/magento/module-ui/Component/Wrapper/UiComponent.php on line 0

I can see the above error when I go to the admin > Catalog > Manage Category and choose any category to edit.

Please help me if you face any kind of this issues?

Thanks in advance!

  • did you make any changes in core modules.?
    – Ask Xah
    Commented Oct 10, 2018 at 10:20
  • In your custom construct argument are different so this issue occur. First check after removing generated folder. if it will not work check which module's code affected it Commented Oct 10, 2018 at 10:25
  • @AskBytes No, I didn't make any changes in core files
    – Rajan Soni
    Commented Oct 10, 2018 at 10:32
  • Hi, @RutveeSojitra I have setup 2 environment 1st for production and 2nd is the clone of production as staging. That same error I didn't get on staging and I got the above error on production. I also tried with your answers but it's not working can you please help me to fix that error with your great suggestions. Thanks!
    – Rajan Soni
    Commented Oct 15, 2018 at 7:29
  • Hi @RutveeSojitra see I got the answer
    – Rajan Soni
    Commented Nov 22, 2018 at 10:10

2 Answers 2


I just fixed the above mention issue which I mention in my question.

I got the error is actually coming from the Core files.

Just go to the file using below path: > /vendor/magento/module-catalog/Model/Category/DataProvider.php

Should use $attributeCode as lines 495 & 496 rather than hardcoded ['image']

Like below code

$categoryData[$attributeCode][0]['size'] = isset($stat) ? $stat['size'] : 0;
$categoryData[$attributeCode][0]['type'] = $mime;

I hope its working for you as well.


you need to add this in your di.xml in tag


Your di.xml will be like this

  <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <virtualType name="vendor\module\Model\ResourceModel\Region\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
            <argument name="mainTable" xsi:type="string">you_table_name</argument>
            <argument name="resourceModel" xsi:type="string">vendor\module\Model\ResourceModel\Region</argument>
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
            <argument name="collections" xsi:type="array">
                <item name="your_table_name" xsi:type="string">vendor\module\Model\ResourceModel\Region\Collection</item>

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.