Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[JsonStreamer] Fix decoding iterable lists#61561

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@mtarld
Copy link
Contributor

QA
Branch?7.3
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#61559
LicenseMIT

Because alist<T> is a subtype ofarray<T>, aniterable<T> cannot be a list.

This means that, as saidhere:

There is no way to be sure that keys of an iterable are successive (even if they are integers).
And if keys are not successive, the resulting JSON structure is an object and not an array.
According, to theJSON specification, object' keys must be strings, and not integers.

This imply that it is right now impossible to "yield" items from[{"itemId": 1, "modificationDate": "2025-10-10"}] - it can only be yielded from{"0": {"itemId": 1, "modificationDate": "2025-10-10"}}.

I think that in the real world, a lot of people want to be able to yield items from[...], even though it does not stick with the JSON specification.

This PR is doing the trade-off of consideringiterable<int, Anything> as an "iterable list" (likelist<Anything> but not cast to array).

natewiebe13 reacted with hooray emoji
@mtarldmtarldforce-pushed thefix/json-streamer-iterable-list branch fromfd4737d to4dc00f4CompareSeptember 1, 2025 07:14
@mtarldmtarldforce-pushed thefix/json-streamer-iterable-list branch from4dc00f4 to2b9b801CompareSeptember 1, 2025 07:15
@nicolas-grekas
Copy link
Member

Thank you@mtarld.

@nicolas-grekasnicolas-grekas merged commit6e42b36 intosymfony:7.3Sep 1, 2025
9 of 11 checks passed
@mtarldmtarld deleted the fix/json-streamer-iterable-list branchSeptember 1, 2025 09:30
fabpot added a commit that referenced this pull requestSep 3, 2025
This PR was merged into the 7.3 branch.Discussion----------[JsonStreamer] Fix encoding iterable lists| Q             | A| ------------- | ---| Branch?       | 7.3| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        || License       | MITSibling of#61561.Handle any iterable with `int` as key as a list during encoding (which mean being encoded with brackets).Commits-------2057bc8 [JsonStreamer] Fix encoding iterable lists
@fabpotfabpot mentioned this pull requestSep 27, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

Assignees

No one assigned

Projects

None yet

Milestone

7.3

Development

Successfully merging this pull request may close these issues.

3 participants

@mtarld@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp