?
avatar Flowman
Flowman
5 May 2021

Steps to reproduce the issue

When storing a object to the table and _jsonEncode is set on the table, it will fail with 'Cannot use object of type stdClass as array'.

It is because only supports arrays but the rest of the bind function supports both arrays and objects.

if (isset($src[$field]) && is_array($src[$field]))

This has been fixed in 4.0

Expected result

Storing the data should be successful.

Actual result

Error 'Cannot use object of type stdClass as array'

System information (as much as possible)

Joomla 3.9.26

avatar Flowman Flowman - open - 5 May 2021
avatar joomla-cms-bot joomla-cms-bot - change - 5 May 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 5 May 2021
avatar Flowman Flowman - change - 5 May 2021
The description was changed
avatar Flowman Flowman - edited - 5 May 2021
avatar Flowman Flowman - change - 5 May 2021
The description was changed
avatar Flowman Flowman - edited - 5 May 2021
avatar Flowman Flowman - change - 5 May 2021
Title
[4.0][3.9] _jsonEncode in table not working with object
[3.9] _jsonEncode in table not working with object
avatar Flowman Flowman - edited - 5 May 2021
avatar richard67
richard67 - comment - 5 May 2021

In J4 it was fixed with #25761 . Unfortunately that PR doesn't tell anything about it in its title or description, it just mentions tests being added :-(
We should back-integrate the fix for handling objects from that PR into 3.10-dev.
I'll prepare a PR soon.

avatar richard67
richard67 - comment - 5 May 2021

The pull request with a fix for this issue for 3.10 is almost ready. It only needs testing instructions, but that would need to write some little PHP class and test program. @Flowman Do you have some extension which we could use for testing?

avatar richard67
richard67 - comment - 5 May 2021

PR is #33558 .

avatar Flowman
Flowman - comment - 5 May 2021

@richard67 not really. I got this quiz or lms component I am building but its to large.

But I know the changes you are doing is working, as I did the same hack to the core on my test site.

avatar richard67
richard67 - comment - 6 May 2021

Closing as having a pull request. Please test #33558 . Thanks in advance.

avatar richard67 richard67 - change - 6 May 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-05-06 13:15:51
Closed_By richard67
avatar richard67 richard67 - close - 6 May 2021
avatar richard67
richard67 - comment - 7 May 2021

New pull request is #33633 for 3.9. Please test. Thanks in advance.

Add a Comment

Login with GitHub to post a comment