solvit.io

Twig error: Object of class stdClass could not be converted to string

Solution

One of your templates is trying to print the value of a variable or expression and, instead of a string, it's a PHP object of type stdClass. Since it's uncommon to use that PHP class directly, this may be the result of some other operation in PHP code.

For example, you may have used json_decode('...') without passing true as the second argument. That makes the result to include stdClass objects instead of being a PHP associative array.

Find more solutions about: , , ,