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.
Beta phase evaluation
Problem/Motivation
In #2199795: Make the Settings class prevent serialization of actual settings we identified that serializing the settings is problematic, but we did not actually replaced all instances.
Proposed resolution
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#29 | interdiff.txt | 761 bytes | dawehner |
#29 | 2443351-29.patch | 33.95 KB | dawehner |
Comments
Comment #1
dawehnerLet's fix stuff.
Comment #3
dawehnerFIxed the failures.
Comment #5
dawehnerDoes someone is able to spot the problem of the YML file?
Comment #6
larowlanthis makes a difference locally
Comment #8
larowlanand so does this
Comment #10
dawehner@larowlan
This is what I don't understand, those lines aren't even touched, see #6
Comment #11
dawehnerLet's fix it.
Comment #13
dawehnerNearly fixed all of them.
Comment #15
dawehnerThere we go.
Comment #16
BerdirI recently saw that we have a SessionConfiguration service, that makes the session configuration stuff easier to access, just wondering if it would make sense to put that in there as well?
Do you plan to actually remove it from the container?
We tried to be as nice as possible with the error when the container is serialized (php notice/warning), but at the moment that is pointless because it always results in an exception due to settings being serialized as well.
Are there more keys than those two? Should we maybe make them separate properties instead of accessing it as an array?
does the default value like this actually make sense? if it's always called through the container, not so much?
Maybe it should be an if (empty) set default check?
same here, for configurations where we have a fixed set of keys, I think separate properties would be easier to write/document. We could still pass it in as an array...
For example here, you could just replace $proxies with $this->proxies or proxyAddresses or something.
this will go away in the page_cache.module issue, but I'm not actually sure we thought of removing the constructor argument there...
Don't we have a helper for this? or only for settings.php? should we have a helper?
Just checked, didn't find anything, but might be worth it, especially considering that we might end up doing this multiple times, and the helper should be intelligent enough to remember existing settings or so?
For example, this might overwrite the existing services.yml written in WebTestBase::setUp().
Comment #17
BerdirOn 8., found it, there's setContainerParameter in WebTestBase.
Also forget the stuff about remember existing values, didn't notice that you read the file first.
Comment #18
dawehnerOH right, there is that. I'll assume for now we skipped that setting not on purpose.
Sure, this is the entire point of it.
No its, just those two. It totally makes sense to use two variables.
Good catch. I guess we want to have the same framework as the rewriteSettings one.
Comment #19
Wim LeersNice! :) Also makes the DX more consistent, by moving as much as possible out of
settings.php
, into the site-specificservices.yml
.Let's not comment these; they match the default values.
That also makes this a bit easier to parse.
(Right now it's very confusing to read: it's difficult to see what's a header versus explanation versus value.)
And let's add
for these, for similar reasons. This is consistent with how
factory.keyvalue
etc. are handled.Comment #20
dawehnerAlright, there we go.
Fixed also the injection of the settings into the
CacheFactory
Comment #21
Wim LeersNow no longer matching.
Comment #22
dawehner.
Comment #23
rteijeiro CreditAttribution: rteijeiro commentedRe-rolled and fixed.
Comment #24
dawehnerOh, Opened #2461435: Add integration test coverage for ReverseProxyMiddleware based upon that.
Comment #27
dawehnerReroll
Comment #29
dawehnerMeh.
Comment #30
alexpottHow is this a bug? I agree that in an ideal world these things should be container params but drupal currently works fine with them not being.
Comment #31
dawehnerWell, its a bug in the sense that with
Settings()
being no longer serializable, potentially custom code which serializes something would break.I'm fine with moving it to a task ...
Comment #32
dawehnerSeems to be 9.x material. Open a follow up to fix the problem I had with it: #2473347: Don't store the language manager as static property on \Drupal\views\Views
Comment #33
vijaycs85@alexpott, I believe we are going to get surprise regressions like #2502195: \Drupal\Core\StringTranslation\Translator\CustomStrings should be serializable, but contain \Drupal\Core\Site\Settings which is not until we have settings as a service in core. IMHO, this issue should be a 8.0.x bug.
Comment #34
dawehnerAs intermediate step I think removing the settings service and always use the singleton directly would be a good way forward to solve the potential problems.
Comment #35
catchI think we should look at:
- add the container parameters
- check settings first
- eventually E_DEPRECATED when the setting is found.
That lets us transition gradually to container parameters while maintaining bc.
Also using the settings singleton directly instead of the service looks fine for minor releases, even if we leave the service itself in and deprecated.
Comment #38
catchComment #44
alexpottI think we can do something like #3061535: Add settings from settings.php to the container as parameters to help us move to not using settings.php.
Comment #51
andypostIt still makes a lot of sense for #3299828: Stop storing Settings singleton in object properties
Comment #52
andypostproper status