Skip to content

Cached instances of objects can be altered outside of Stash #377

@Ruud-Zuiderlicht

Description

@Ruud-Zuiderlicht

I'm getting "Serialization of Closure is not allowed" in concrete5 which uses Stash. This happens because objects stored in or returned by Empheral are a reference and any changes to the original/returned item also alters the stored instance in cache.
Therefore requesting the same cached item twice might result in different returned values even though the key has not been altered through a regular Stash set function.

This might be intended behaviour, although I don't feel it is really intuitive. It was suggested in the issue (concretecms/concretecms#6113) that this could be something that can be changed in Stash as well.

footnote: concrete5 clones objects before caching in Stash, but retrieves the cached instance without cloning. So the problem is less apparent there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions