Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
If you have a widget form with #ajax, something that page manager itself might also have, then you get a container was serialized error and then a fatal error.
Proposed resolution
Add some dark magic in __sleep() to unset properties that might contain the container and/or can be recreatd.
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#7 | page-manager-2419081-7-interdiff.txt | 1.01 KB | Berdir |
#7 | page-manager-2419081-7.patch | 5.53 KB | Berdir |
#7 | page-manager-2419081-7-test-only.patch | 3.1 KB | Berdir |
#4 | page-manager-2419081-4.patch | 2.39 KB | Berdir |
#1 | page-manager-2419081-1.patch | 595 bytes | Berdir |
Comments
Comment #1
BerdirComment #4
BerdirOuch, this definitely needs tests.
This seems to be working for me for both adding and editing widgets. Was a tough one to debug and figure out, very weird php serialization issues, similar to what I recently saw when fixing search_api. $this->block in validate for the add form was suddenly just a string.
And for edit, the problem was that the page entity had a different display collection than we had in the form, as that one was still the serialized version, and then it didn't get updated.
I think it would be better to not store the block/display object at all as properties. The effort to create them again can't be much bigger than the overhead of serializing those possibly huge objects.
Comment #5
neclimdul"collections, collection"?
I guess this is a whitelist of sorts. Excuse me if my lack of Entity experience is showing but these make me nervous. Are we sure there aren't other things that might sneak in from contrib? Should it be smarter somehow?
Comment #6
BerdirThanks for the review.
2. I don't think this is a problem. Entity classes are just like other classes, contrib can't just add more properties there. Config entities can only be extended in very strict ways ways, and those things are just scalars/arrays, nothing that we need to worry about when serializing.
Comment #7
BerdirOk, this seems to work as tests.
Comment #10
BerdirComment #11
tim.plunkettThanks @Berdir!