Skip to content

Ensure that previous_attributes is always an instance of StripeObject#2011

Open
simonhammes wants to merge 1 commit intostripe:masterfrom
simonhammes:ensure-previous_attributes-is-stripe-object
Open

Ensure that previous_attributes is always an instance of StripeObject#2011
simonhammes wants to merge 1 commit intostripe:masterfrom
simonhammes:ensure-previous_attributes-is-stripe-object

Conversation

@simonhammes
Copy link

Fixes #1785

Why?

The @property annotation on the Event class says that previous_attributes is always an instance of StripeObject (or null).

#1785 shows that this is currently not guaranteed since an empty array is deserialized into an empty PHP array instead of a StripeObject object.

What?

This PR adds a second special case to the deserialization logic inside StripeObject.
Previously, the metadata property was special-cased to guarantee the same behavior.

@simonhammes simonhammes requested a review from a team as a code owner February 16, 2026 18:43
@simonhammes simonhammes requested review from prathmesh-stripe and removed request for a team February 16, 2026 18:43
@cla-assistant
Copy link

cla-assistant bot commented Feb 16, 2026

CLA assistant check
All committers have signed the CLA.

@simonhammes simonhammes marked this pull request as draft February 16, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Event::constructFrom with empty data->previous_attributes creates array instead of StripeObject

1 participant

Comments