Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
base system
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
19 Apr 2021 at 21:40 UTC
Updated:
27 Sep 2021 at 09:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
andypostAdded upstream commit reference to IS, all exceptions been changed
Comment #3
longwaveThanks for finding the upstream commit, changed the title to match. Looks like the $code deprecation doesn't affect us.
Comment #5
longwaveAttached patch is latest #3161889: [META] Symfony 6 compatibility with two deprecation skips removed for this issue, in order to figure out what we need to change to solve this.
Comment #6
longwaveWe have a decision to make here: we can just cast NULLs to string when we throw exceptions, or we can go a bit further and remove NULL entirely, using the empty string instead of NULL to mean "no message" or "no reason".
In AccessAwareRouter:
It is trivial to change the NULLs here to the empty string, but
AccessResultReasonInterface::getReason()can also return NULL. The docs for this are:If follow Symfony here to only return strings (with the empty string meaning "no reason"), in the future we can simplify things like this as well:
Personally I think this is the correct thing to do, because at the moment you can pass either NULL or "" as a reason and they mean the same thing.
Comment #7
catchBumping to critical since this blocks Symfony 6 adoption.
Deprecating passing null (and defaulting to empty string?) seems like a good idea, although probably for a follow-up?
Comment #9
longwaveLast commit in the MR is the one to review, the others are setting up SF 5.3.
Comment #10
daffie commentedThe changes in the last commit look good to me, only the testbot is not happy.
Also a number of related issues have landed.
Comment #11
longwaveFixed some places where NULL was expected but we now have the empty string. I guess this is a BC break...
Comment #12
daffie commented@longwave: I want to help to get this issue to land by reviewing only it is to me not clear how it all works.
Comment #13
longwave@daffie The MR also contains work from #3161889: [META] Symfony 6 compatibility in order to upgrade to Symfony 5.3 and prove that the deprecations are fixed and also get all the tests to pass. I tried to keep the commits atomic so they can be reviewed individually.
https://git.drupalcode.org/project/drupal/-/merge_requests/719/commits
5b24d166 - stop skipping the deprecations that are covered by this issue so tests will fail if we still use them
4c4bff9b - latest patch for Symfony 5.3 support
5fa65acf - second round of fixes
0261f8bb - first round of fixes
The other commits are previous versions of this patch and can be ignored for now, for example a94a14b3 was an earlier version of Symfony 5.3 but 657453fd reverts this again so effectively it can be ignored. Sorry if this is confusing - I will try to get tests to pass and then open a separate MR with the fixes only.
Comment #14
catchApologies for all the rebase noise, I ended up doing one thing, then changing my mind and doing another...
First of all tried a straight rebase of the branch, but there's quite a lot of conflicts with the Symfony 5 update parts, which meant it started turning into a rebuild of the branch instead of a rebase. About half way through I realised it'd be better to do that over on #3161889: [META] Symfony 6 compatibility.
So.. instead I've removed the Symfony 5 updates from the branch altogether, and this is now only the changes required for this patch (I hope, tests just started running) on the latest 9.3.x. Essentially what longwave mentions in #13.
If the changes here are green, then I think the next step is probably to refresh #3161889: [META] Symfony 6 compatibility, and then generate a combined patch (or separate MR if we want to) from the two issues, and post that here to demonstrate the change passing against Symfony 5 too.
Comment #15
catchThe MR is passing against 9.3.x now.
#3161889: [META] Symfony 6 compatibility now contains the latest diff from the MR here, so we can see how it does with an actual Symfony 5.4 update over there.
Comment #16
daffie commentedAll the code changes look good to me and are RTBC for me.
The only problem that I have is that the change of the return value of
getReason(). To me it will be a BC break. My question is how small the impact will be.I cannot find any instances where the method is overriidden. See: http://grep.xnddx.ru/search?text=function+getReason%28%29&filename=.
I can find instances where in contrib NULL is returned instead of an empty string. Like:
$access_result instanceof AccessResultReasonInterface ? $access_result->getReason() : NULL. Not sure that will case a BC break, only 4 instances in contrib. See: http://grep.xnddx.ru/search?text=-%3EgetReason%28%29+%3A+null&filename=.I can find a couple of instances in contrib testing whih:
$this->assertNull($access->getReason());. I found it only in the scheduled_transsitions module. See: http://grep.xnddx.ru/node/31758647.No idea what custom modules are doing.
Comment #17
daffie commentedI thought about the solution a bit more and for me it is RTBC.
I leave it up to the committer to decide if the small BC break is exceptable and that it does not break any existing sites out there. For me I am not a 100% sure that there are no sites that broken at least a small bit.
On the other side is the fact that we want to have Symfony 6 in D10. To me this too important to not do this issue.
Comment #18
alexpottI think we have to take the tiny risk that this will break a site. We need this for PHP 8.1 compatibility too.
Committed 7c3b2861e1 and pushed to 9.3.x. Thanks!