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

Fix TagList returning an object in array mode #1294

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

thienvu18
Copy link
Contributor

After applying the array_filter method, the $value array lost its 0-based indexing, causing it to be treated as an object instead of an array. To resolve this, I’ve wrapped the result with array_values to reindex it and restore it as an array.

@mjauvin mjauvin self-assigned this Jan 23, 2025
@mjauvin mjauvin added the maintenance PRs that fix bugs, are translation changes or make only minor changes label Jan 23, 2025
@mjauvin mjauvin added this to the 1.2.8 milestone Jan 23, 2025
@mjauvin mjauvin added the accepted Issues that have been accepted by the maintainers for inclusion label Jan 23, 2025
@mjauvin
Copy link
Member

mjauvin commented Jan 23, 2025

@thienvu18 the fix is valid.

I'm curious, did you get problems using it the way it was? If so, how?

@thienvu18
Copy link
Contributor Author

@mjauvin thank for accepting my pr.

When I use this form widget for a json column in Postgres, the value is stored as {"1":"some_value"} instead of ["some_value"]. This makes whereJsonLength throw Invalid parameter value: 7 ERROR: cannot get array length of a non-array

@LukeTowers LukeTowers changed the title Fix TagList form widget returning an object instead of an array in array mode Fix TagList returning an object in array mode Jan 25, 2025
@LukeTowers LukeTowers merged commit 7224239 into wintercms:develop Jan 25, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Issues that have been accepted by the maintainers for inclusion maintenance PRs that fix bugs, are translation changes or make only minor changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants