Closed (fixed)
Project:
Drupal core
Version:
8.6.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Jan 2018 at 00:29 UTC
Updated:
17 Aug 2020 at 13:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kim.pepperInitial patch split from parent issue.
Comment #5
voleger#2935254: Remove all usages of drupal_get_message and drupal_set_message in core includes commited into 8.6.x. Retest patch from #2
Comment #6
volegerComment #7
jofitzRe-roll.
Comment #9
jofitzTrying to fix the test failures.
Comment #10
jofitzFix some of the test failures.
Comment #12
jofitzFix one of the test failures.
Comment #13
jofitzHere's a possible fix to avoid the remaining deprecation notice, but it is a real hack.
Comment #16
jofitzFix coding standards errors.
Comment #17
kim.pepperLooks like there are core tests that rely on inline_form_errors module. The patch in #2935257: [PP-1] Remove all usages of drupal_get_message and drupal_set_message in modules G-L addresses the inline form error changes. You may want to copy them over here as well.
Comment #18
kim.pepperMessenger Trait is now being added as part of #2937945: Add messenger to ControllerBase and FormBase
Comment #19
voleger#2937945: Add messenger to ControllerBase and FormBase fixed
Comment #20
jofitzPatch in #16 no longer applies. Re-roll.
Comment #21
voleger+1 for RTBC
Comment #22
kim.pepperLGTM
Comment #23
jibranComment #24
kim.pepperTagging
Comment #25
jibranThere are some usages remaining.
Comment #26
kim.pepperAll of those are testing the drupal_set_message and shouldn't be removed before Drupal 9.0.0, right?
Comment #27
jibranSure.
Comment #28
yogeshmpawarVerified the patch +1 for RTBC, good to go.
Comment #29
catchGiven $type isn't optional, when would it be null?
Comment #30
kim.pepper@catch From the docblock:
Are you saying because there's no default arg (e.g. $type = NULL), then this comment is wrong?
Messenger has different methods for delete by type vs all, so we need to check here if it's null.
Comment #31
alexpottYep we need to support NULL here for BC. We probably want to deprecate that at some point in the future but not in this issue.
Comment #32
alexpottActually this needs a reroll and also there are still instances for drupal_set_message and drupal_get_message outside of the modules directories. I think this issue should clean up everything that the modules issue does not. We should leave \Drupal\KernelTests\Core\Common\DrupalSetMessageTest alone though and make this the legacy test once we've removed the entry from \Drupal\Tests\Listeners\DeprecationListenerTrait::getSkippedDeprecations().
The files which contain stuff to fix are:
Comment #33
alexpottDid #32.
Comment #34
volegerShould it be in the current scope?
Comment #35
catchThis says defaults to NULL, but there is no default. I think it'd be more self-explanatory to add a default arg, or to change the comment to not say 'defaults to NULL'.
Comment #36
volegerRerolled #33
Also addressed:
#34: Reverted changes that are out of scope.
#35: Added arg default value.
Comment #37
alexpottThis issue should also be able to remove the messages from \Drupal\Tests\Listeners\DeprecationListenerTrait::getSkippedDeprecations() for drupal_set_message(). Any legacy tests of drupal_set_message() should be in the legacy test group and have an
@expectedDeprecationannotation.Comment #38
kim.pepperI removed drupal_set_message and drupal_get_message from DeprecationListenerTrait and added @expectedDeprecation to \Drupal\KernelTests\Core\Common\DrupalSetMessageTest
Comment #39
volegerShould comments in
core/modules/system/tests/src/Functional/Bootstrap/DrupalSetMessageTest.phpalso be updated?Update:
I guess not. Because those changes are out of scope. Maybe should this be updated in the followup issue if changes are required?
Anyway, +1 for RTBC.
Comment #40
martin107 commentedIt think there is a overcomplication that should be stripped out
SiteConfigureForm extends ConfigFormBase extends FormBase
FormBase makes use of MessengerTrait.
So there is not need to inject the messenger service into SiteConfigureForm
Comment #41
martin107 commentedLess talk more do.
PS BTW This was close to RTBC ... I think it is now.
Comment #42
kim.pepperFix php 5.5 fails.
Comment #43
voleger+1 for RTBC
Comment #44
alexpottCan we get a follow up to fix the naming of:
system_test.drupal_set_messageroute/system-test/drupal-set-messagepathSystemTestController::drupalSetMessageTest()method\Drupal\Tests\system\Functional\Bootstrap\DrupalSetMessageTest()test classNone of these things test
drupal_set_message()anymore. Actually, lets use the parent issue to finally finish that one - #2924538: [META] Remove all usages of drupal_set_message and drupal_get_messages.Crediting @catch and @jibran for reviews.
Comment #45
alexpottCommitted 3c82d71 and pushed to 8.6.x. Thanks!
fixed unused uses on commit.
Comment #47
tr commentedCan we get a change notice please, to notify us that MessengerTrait was added to a number of base classes? (which doesn't seem to be mentioned in the issue summary or discussed here ...)
drupal_set_message() was removed in 8.5.0, so I for one already converted my code to use the messenger service, which includes using MessengerTrait in my own plugin bases and list builders.
But as part of this patch for 8.6.x MessengerTrait was added to the core PluginBase, EntityListBuilder, BlockBase, etc. So now I get all sorts of errors from previously-working code. Adding MessengerTrait is a change in the core API for these important base classes, and there should be a change notice for this.
Comment #48
tr commentedThis should not have been committed without a change record. See Change records now needed before commit
Comment #49
markhalliwell#2937945: Add messenger to ControllerBase and FormBase added this trait and there is a CR for it: https://www.drupal.org/node/2774931
I've added a note (and referenced this issue) mentioning that a few base classes now have this trait.
Comment #51
devad commented