Closed (fixed)
Project:
Drupal core
Version:
10.3.x-dev
Component:
datetime.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Feb 2020 at 18:04 UTC
Updated:
6 Mar 2024 at 15:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mpdonadioOK, took the patch from 2902895-43.patch
- Isolated just the OO code (well, I tried); this includes classes w/ and w/o access to the container as a starting point
At this point will start going through `git diff --name-only 8.9.x` to isolate by path/namespace revert changes to classes that def have container access
Comment #3
mpdonadioOK, I think these are all of the usages of classes that need to use the \Drupal singleton.
Comment #8
mpdonadioCommit credits.
Comment #9
daffie commentedAll code changes look good to me.
The patch is for me RTBC.
There is one small documentation nitpick that can be changed on commit.
Documentation lines are not filled out to the max. Can be changed on commit.
Comment #10
alexpottIt feels odd given that we're replacing REQUEST_TIME to not also replace time() in these three instances with the \Drupal::time() equivalent.
Comment #11
hardik_patel_12 commentedKindly review a new patch, where time() is replaced with \Drupal::time()->getCurrentTime().
Comment #12
hardik_patel_12 commentedComment #13
daffie commentedThe remark from @alexpott from comment #10 has been addressed.
All the code changes look good to me.
Back to RTBC.
Comment #14
alexpottCommitted d23b4cc and pushed to 9.0.x. Thanks!
We could have a follow-up to simplify this a bit. The whole point is to generate a unique random identifier. This feels overly complex. But no need to address here.
@Hardik_Patel_12 it would have been great if you could have addressed #9 in #11 as well.
Fixed on commit.
Comment #17
alexpottNeed to work out why but this patch has caused instability in the test system. Locally I can't get
core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.phpto pass. And we're seeing other fails too - https://www.drupal.org/pift-ci-job/1586930Comment #18
alexpottOh fun... so at least the fail in
core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.phphappens because in KernelTestBase we do:Because it does
Request::create('/');this ends up having a different time than $_SERVER['REQUEST_TIME'] (and therefore the legacy REQUEST_TIME) because this request is created using the result oftime()not the server globals.I think this means efforts to do conversions bit by bit are fraught and that we might need to do everything at once.
Changing
Request::create('/');toRequest::createFromGlobals();fixes the test but I don't think this change is correct.Comment #20
kristen polSee possibly related issues noted here:
https://www.drupal.org/project/drupal/issues/3112283#comment-13605217
Comment #24
andypostshould move request time out of loop
Comment #25
mondrakeComment #26
ravi.shankar commentedAdded reroll of patch #11 on Drupal 9.4.x.
Comment #30
akashkumar07 commentedAdded reroll for 9.5.x-dev version.
Comment #31
mondrakeThis impacts PHPStan baseline so better target 10.1.x first. Changing to MR worflow.
Comment #32
mondrakeCan't create a MR against 10.1.x for some reasons, fallback to 10.0.x
Comment #34
mondrakeComment #35
mondrakeAddressed #24.
Comment #36
mondrakeAddressed #9 plus another crufty comment.
Comment #37
smustgrave commentedBelieve this missed the 10.0 boat but can land in 10.1 hopefully.
Moving to NW for the MR to be updated to point to 10.1 please
Comment #39
mondrakeI closed the MR2467 to avoid becoming a bottleneck. Reverting to patch workflow, rerolled patch.
Comment #40
smustgrave commentedNot sure why but when I tried to run ./core/scripts/dev/commit-code-check.sh to check this patch it now locks up.
Comment #41
andypostcould use variable to prevent calling twice if both are 0
Could use variable $time = \Drupal::time()
Comment #42
andypostBtw is there a reason to replace
time()with service call? I think only for unit-testing reasonsComment #43
smustgrave commentedAddressed points in #41
For #42 I believe it was made for cleaner code? But can't be sure.
Also when I try to run the code check it locks up. Is that normal when making changes to phpstan files?
Comment #44
danielvezaThis needs a reroll for 10.1.x, patch no longer applies.
Ran the test fails on the latest 10.1.x with this patch with --repeat=20.
SaveActionTestpassed, but EntityValidationTest is now flaky. It fails about 30% of the timeComment #45
_pratik_#43 patch not applied for me also, Please try this new patch.
Thanks
Comment #50
acbramley commentedMoving back to an MR workflow, rebased #45 on to a new branch off 11.x in a new MR
Comment #53
acbramley commentedThe MR is green but we did have another failure earlier which I couldn't reproduce locally https://git.drupalcode.org/issue/drupal-3112295/-/pipelines/85141/test_r...
I'm not too sure how this could happen when we're sleeping
Comment #54
acbramley commentedAnother similar random failure this time in testEntityChangedConstraintOnConcurrentMultilingualEditing
Comment #55
taran2lWas looking at this a bit, and I'm not quite sure some of the examples actually do not have access to the container
Comment #56
taran2lComment #57
andypostBaseline needs clean-up
Comment #58
taran2lShould be good to go now
Comment #59
acbramley commentedFound one instance that can use DI
Comment #60
taran2lComment #61
taran2l@acbramley, something like this ?
Comment #62
acbramley commentedLooks perfect! Nice one.
Comment #65
catchCommitted/pushed to 11.x and cherry-picked to 10.3.x, thanks!
Comment #66
andypostIt was the last in list, so META can be closed as well!
PS: please close MR