Ever seen this? Magento\Framework\DataObject could not be converted to string - Escaper.php

Every time I think I’m getting close to accomplishing something I find a new issue. This one has me stumped. I’m working through it as much as I can with magento’s limited hints.

It is in the system.log

main.CRITICAL: Recoverable Error: Object of class Magento\Framework\DataObject could not be converted to string in public_html/vendor/magento/framework/Escaper.php on line 261 [] []

Line around 261 on Escaper.php

/**
     * Escape a string for the HTML attribute context
     *
     * @param string $string
     * @param boolean $escapeSingleQuote
     * @return string
     * @since 101.0.0
     */
    public function escapeHtmlAttr($string, $escapeSingleQuote = true)
    {
        if ($escapeSingleQuote) {
            return $this->getEscaper()->escapeHtmlAttr((string) $string);
        }
        return htmlspecialchars((string)$string, $this->htmlSpecialCharsFlag, 'UTF-8', false);
    }

I have run in to something extremely strange and I have NO idea what has caused it or if I have all of the sudden stumbled upon this issue that has been there all along.

I found a couple categories that have no products that show on them. When I try to load the category I get that error in the system log. Strange, I tried to add a product from the “ghost” (shows no products) category to another category and now that category is “ghosting” me. I removed the product and now it still won’t show any products.

Super strange. Time to go digging around in the database to see if I can find something anomalous there.

It is related to porto. Changing back to LUMA and it goes away. I’ll let them sort it out.

They resolved the issue. I am waiting to hear what the problem was or if they will just be patching their theme. It isn’t an entirely obvious issue as it was hit or miss on my end, so it may not have been noticed.

So, they did confirm the issue was their end? That makes a change :smiley:

Yes, they did. They’ve actually been extremely helpful for me and I’ve reported several bugs to them and they’ve immediately fixed them. I am always extremely nice to them though. That may have something to do with it. I’m sure they get an absolute ton of tickets with people being grumps most of the time.

1 Like