Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.9] _jsonEncode in table not working with object #33553

Closed
Flowman opened this issue May 5, 2021 · 6 comments
Closed

[3.9] _jsonEncode in table not working with object #33553

Flowman opened this issue May 5, 2021 · 6 comments
Assignees

Comments

@Flowman
Copy link

Flowman commented May 5, 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

@Flowman Flowman changed the title [4.0][3.9] _jsonEncode in table not working with object [3.9] _jsonEncode in table not working with object May 5, 2021
@richard67
Copy link
Member

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.

@richard67
Copy link
Member

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?

@richard67
Copy link
Member

PR is #33558 .

@Flowman
Copy link
Author

Flowman commented May 5, 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.

@richard67
Copy link
Member

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

@richard67
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants