Object of class stdClass could not be converted to string

Bauer

Well-Known Member
I'm getting this error quite a bit with the latest github update.

fatal error 'Object of class stdClass could not be converted to string' at /home/public_html/components/com_fabrik/models/element.php 1859:

This is happening because of a few calc elements I have that are being stored as JSON arrays.
e.g. [fb_member_facilities___group_emp] => [{"emp_1":"2"},{"emp_3":"1"},{"emp_7":"2"},{"emp_9":"2"},{"emp_22":"2"},{"emp_32":"2"}]
 
1859 doesn't really make sense for the current github. Can you paste some context from your copy, so I know which line it actually is. Or update and get a new line number.

-- hugh
 
It's really @line 1856
I was scratching my head about how the __toString() 'magic method' is supposed to work and if it should be used here.

Then finally I gave up and just went with this - which fixes it.

// $rollOver = (string)$txt;
$rollOver = is_object($txt) ? "" : (string)$txt;
 
Hmm, yeah, it's because we always do a ...

Code:
$data = FabrikWorker::JSONtoData($data, true);

... in renderListData(), prior to building the tips. Of course, normally we will have already processed JSON data in elements into whatever string representation they use (elements like links, or uploads using crop, etc. which may store JSON but at this point will already have built the rendered string), and at that point in renderListData() the only time it'd be JSON would be repeated data (I think for multi-select joins, or things like multi AJAX uploads, or tags), so we bust it into an array and iterate round each one to build individual renders. But but we aren't in control of calc data.

So yeah ...

https://github.com/Fabrik/fabrik/commit/4ab49aef3bf69702cf2538ab2c3658d88cee197a

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top