Closed (duplicate)
Project:
Drupal core
Version:
8.3.x-dev
Component:
plugin system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Mar 2014 at 00:41 UTC
Updated:
5 Mar 2017 at 11:57 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
swentel commentedNo fix, just a patch that makes the tests locally not fail.
Comment #2
xjmThe test has been broken since... #2205367: [HEAD BROKEN] PHP 5.4. ;)
Comment #3
xjmBy the way, my error message is funnier:
Comment #4
alexpottThis only occurs on PHP 5.4 - I'm on PHP 5.4.16 - but this does not occur in PHP 5.5.
It appears to be an object serialisation issue since if I change the #element_validate assignment to use
get_class()like soI get a more reasonable error message of:
Comment #5
alexpottThe patch attached fixes the issue for me. The issue seems to be with unserialising two instances of the same object.
Comment #6
wim leersDoes this mean we want to clone every object we invoke a Form API callback on? (Because all of those may get serialized.)
Comment #7
alexpottNo - the clone solution sucks - I was just posting the results so far of my investigation so maybe someone knows what's going on.
Comment #8
alexpottSo we serialize the FilterPluginBag in the form which leads us to serializing the FilterPluginManager which means we serialize all sorts of other stuff. PHP 5.4 serialization does seem to be fragile but stopping this fixes this issue. Also offers a nice performance enhancement since the serialized form is much smaller.
Before
After
Comment #9
alexpott#2199795: Make the Settings class prevent serialization of actual settings is proposing the plugin bags need to be serialized using dependency serialization too
Comment #10
alexpott#2208115: Add DependencySerializationTrait will make this simpler
Comment #11
wim leersComment #12
xjmWhat is this postponed on? Can we put the issue in the summary?
Comment #13
wim leersIt was postponed on #2208115: Add DependencySerializationTrait and #2199795: Make the Settings class prevent serialization of actual settings. The first of those is now committed, the second one isn't yet, and that's what this is postponed on.
With #2208115: Add DependencySerializationTrait committed, #8 can be rerolled to be much simpler. So I did that here.
But, looking at #2199795-9: Make the Settings class prevent serialization of actual settings, it looks like a different solution was chosen (I think because of comment 5 in that issue). If that's the case, then this issue can implement that solution. I think alexpott should decide what to do here; I'm not knowledgeable enough in this area.
Comment #15
jhedstromComment #16
sivaji_ganesh_jojodae commentedPatch #13 rerolled.
Comment #17
pwieck commentedComment #18
mgiffordPatch no longer applies.
Comment #22
berdir\Drupal\Core\Plugin\DefaultLazyPluginCollection uses DependencySerializationTrait already, I think this is not necessary, we don't want to add this trait to actual services.