core icon indicating copy to clipboard operation
core copied to clipboard

"Serialization of 'Closure' is not allowed" error when trying to login in CMS

Open mcdennem opened this issue 1 year ago • 9 comments

This error appears after creating a new MySQL db for a project, which has a contenttype including a collectection with a set.

Details

Question Answer
Relevant Bolt Version 5.1.12
PHP version 7.4
MySQL version 8.0.28

Reproduction

Bug summary

  • After debugging, this has to do with the content_array setting in config.yaml. When set to 0, the error is solved.

Steps to reproduce

  • Create a new MySQL database with bin/console bolt:setup
  • Make sure the project contains a contenttype which has collection' with a set`
  • Login into the CMS
  • "Serialization of 'Closure' is not allowed" error appears

mcdennem avatar Jul 12 '22 15:07 mcdennem

I'm not able to reproduce this, just yet. What CT are you using, exactly?

I'm trying with:

dummies:
    name: Dummies
    singular_name: Dummy
    fields:
        title:
            type: text
        slug:
            type: slug
            uses: title
        collectie:
            type: collection
            fields:
                set:
                    label: My set
                    type: set
                    fields:
                        name:
                            type: text
                            label: My name
                        multiselect:
                            label: My turtle
                            type: select
                            values: [ A-tuin, Donatello, Rafael, Leonardo, Michelangelo, Koopa, Squirtle ]
                            multiple: true
    icon_many: "fa:viruses"
    icon_one: "fa:virus"
Schermafbeelding 2022-07-12 om 19 29 21

I've tried both MySQL and SQLite and both with and without Fixtures added to the newly created DB.

Do you have more details on how to reproduce this?

bobdenotter avatar Jul 12 '22 17:07 bobdenotter

This happens to me too since the last update.

Sometimes it works, most of the times I get the error, I cannot reproduce it regularly.

This is the Data it wants to serialize: image

Spomsoree avatar Jul 13 '22 10:07 Spomsoree

I've been trying to reproduce, but no dice yet. I'mma leave this open until more info is available.

bobdenotter avatar Aug 10 '22 12:08 bobdenotter

I think this occurs if you update a project that used an older version before, but thats just a guess.

Spomsoree avatar Aug 10 '22 12:08 Spomsoree

@bobdenotter when I just tested your update to the 5.2 beta branch and wanted to click on the dashboard I get this error too.

I performed a checkout to your branch. Ran composer install. The composer install ran fine with no issues.

Sander-Hub avatar Aug 12 '22 15:08 Sander-Hub

I can confirm that changing the value of content_array setting in config.yaml as described by @mcdennem allowed me to access the dashboard again.

I am unsure whether or not to create a new issue for this, as I did not install a new project I just switched branches albeit an internal one.

The only noteworthy thing is that I switched branches from Bolt 5.1.10 to the internal 5.2 beta branch (perhaps upgrading to the latest maintenance release will not cause this issue).

Sander-Hub avatar Aug 13 '22 08:08 Sander-Hub

This just happened to me as well, yesterday the issue didn't occur but today it did. I created a new bolt 5 project and copied/migrated data from a bolt 3 project over using the Conimex extension.

Setting the value content_array: 0 helped, thanks!

laurens94 avatar Aug 24 '22 14:08 laurens94

Can confirm this now happens to me following update to tagged release 5.1.12 - not the beta branch.

Turning off caching for the content_array also allows my dashboard to load.

Not sure whether this is related, but trying to manually refresh the Symfony cache through the cli also produces these warnings:

WARNING [cache] Failed to save key "property_metadata_4ba6ddb7eb691582c68feab91b1d58fb" of type ApiPlatform\Core\Metadata\Property\PropertyMetadata: Cache key "property_metadata_4ba6ddb7eb691582c68feab91b1d58fb" has non-serializable "ApiPlatform\Core\Metadata\Property\PropertyMetadata" value. ["key" => "property_metadata_4ba6ddb7eb691582c68feab91b1d58fb","exception" => Symfony\Component\Cache\Exception\InvalidArgumentException^ { …},"cache-adapter" => "Symfony\Component\Cache\Adapter\PhpFilesAdapter"]

So it seems like there might be something strange afoot with serialization.

Steve-MP avatar Aug 26 '22 13:08 Steve-MP

It seems like the issue is solved for me on version 5.2

Spomsoree avatar Nov 25 '22 11:11 Spomsoree