Skip to content

[Serializer] (re)document PRESERVE_EMPTY_OBJECTS #20877

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

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

94noni
Copy link
Contributor

@94noni 94noni commented Apr 10, 2025

👋🏻
when implementing a web hook, I had to serialize en empty array as object, and found it was wrong (empty list not empty object)

// json without flag
'data' => [],
"data":[],

// json with flag
'data' => new \ArrayObject(),
"data":{},

this PR (re)adds this feature as I thinks its useful to have it directly showcased in the main doc
weirdly it was present in v5.4 #16977

@javiereguiluz javiereguiluz changed the base branch from 7.2 to 6.4 April 14, 2025 08:38
@javiereguiluz javiereguiluz requested a review from xabbuh as a code owner April 14, 2025 08:38
@javiereguiluz javiereguiluz merged commit abc5d28 into symfony:6.4 Apr 14, 2025
3 checks passed
@javiereguiluz
Copy link
Member

Thanks Antoine! We merged this in 6.4 branch and up.

@94noni 94noni deleted the patch-15 branch April 14, 2025 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants