Skip to content

Conversation

@AndrewMast
Copy link
Contributor

Why

The AsArrayObject cast allows for accessing the array keys as props, but AsEncryptedArrayObject does not. I unexpectedly ran into this issue when changing the cast from AsArrayObject to AsEncryptedArrayObject.

What

I added ArrayObject::ARRAY_AS_PROPS when creating the ArrayObject in the AsEncryptedArrayObject cast.

- return new ArrayObject(Json::decode(Crypt::decryptString($attributes[$key])));
+ return new ArrayObject(Json::decode(Crypt::decryptString($attributes[$key])), ArrayObject::ARRAY_AS_PROPS);

@taylorotwell
Copy link
Member

Is this a breaking change?

@taylorotwell taylorotwell merged commit 6822896 into laravel:12.x Feb 4, 2026
72 checks passed
@AndrewMast
Copy link
Contributor Author

AndrewMast commented Feb 4, 2026

Not to my knowledge, we can still do $arrayObject['key'] when using ArrayObject::ARRAY_AS_PROPS.

@AndrewMast AndrewMast deleted the encrypted-array-object-props branch February 4, 2026 19:29
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.

2 participants