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.
The ChangedItem field type is using REQUEST_TIME. It should use the time service instead.
Comment | File | Size | Author |
---|---|---|---|
#2 | using-time-service-in-changeditem-2902896-2.patch | 1.07 KB | quocnht |
Comments
Comment #2
quocnht CreditAttribution: quocnht as a volunteer commentedReplaced REQUEST_TIME with \Drupal::time()->getRequestTime()
Comment #3
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedLooks good to me.
Comment #4
joachim CreditAttribution: joachim commentedShouldn't the time service be injected?
Comment #5
quocnht CreditAttribution: quocnht as a volunteer commented@joachim: #2053415: Allow typed data plugins to receive injected dependencies
Comment #6
joachim CreditAttribution: joachim commentedThat's type data rather than field type though isn't it?
I can see several field type plugins that say:
> 177: // @todo Inject entity storage once typed-data supports container injection.
but equally, core/modules/field/src/Plugin/migrate/process/FieldType.php does it by implementing ContainerFactoryPluginInterface.
Comment #7
quocnht CreditAttribution: quocnht as a volunteer commentedcore/modules/field/src/Plugin/migrate/process/FieldType.php is a MigrateProcessPlugin process field_type.
FieldType plugin in field system extends DataType plugin.
Comment #8
joachim CreditAttribution: joachim commentedOhhh. Whoops! I was searching for files with FieldType in the name...
Comment #10
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedBot fluke.
Comment #14
catchCommitted/pushed to 8.5.x and cherry-picked to 8.4.x. Thanks!
Comment #15
cilefen CreditAttribution: cilefen as a volunteer commentedContentEntityChangedTest is failing a lot on HEAD.
Comment #16
catchReverted from both branches for now.
Comment #19
quocnht CreditAttribution: quocnht as a volunteer commentedMaybe it related to : #2857843: Random fail in Drupal\KernelTests\Core\Entity\ContentEntityChangedTest::testChanged.
Comment #21
c31ck CreditAttribution: c31ck commentedNow that #2857843 has been fixed, we might be able to move forward again with this issue. Patch from #2 still applies cleanly, I've triggered the retest and it does not have any failures.
Comment #22
borisson_RTBC based on #10 and #3. Should we try to figure out if this issue was the problem for the failures discovered trough #15 or do we think that #2857843: Random fail in Drupal\KernelTests\Core\Entity\ContentEntityChangedTest::testChanged fixed this?
Comment #23
alexpottThank you for your work on cleaning up Drupal core's use of deprecated APIs!
In order to deprecate APIs in a maintainable way, converting deprecated uses should be replaced across all of core for a given kind of usage, rather than in individual modules or files. Such issues should also always be part of an overall plan to ensure all usages are removed, rather than standalone patches.
For background information on why we usually will not commit cleanups that aren't scoped in that way, see the core issue scope guidelines. See the core deprecation policy for more information on how we handle deprecations.
Contributing to the overall plan above will help ensure that your cleanups for core's deprecated code improve core in a maintainable and minimally disruptive way.
Marking this as a duplicate of #2902895: [meta][no patch] Replace uses of REQUEST_TIME and time() with time service where we'll come up with a plan that's not class by class, file by file.