core/modules is large, so splitting roughly in half, A-L and M-Z and for system/simpletest module.
This is M-Z (except system and simpletest modules).
A-L is #2089465: Convert all calls to check_plain() in core to Drupal\Component\Utility\String::checkPlain() in core/modules/A-L.
Views is #2187829: Convert all calls to check_plain() in core to Drupal\Component\Utility\String::checkPlain() in core/modules/views
Part of #2089331: [meta] Replace calls to check_plain() with Drupal\Component\Utility\String::checkPlain().
Comment | File | Size | Author |
---|---|---|---|
#72 | 2089471-remove-check_plain-72.patch | 61.61 KB | longwave |
Comments
Comment #1
littledynamo CreditAttribution: littledynamo commentedComment #2
sidharthapAssigning it.
Comment #3
sidharthap1st patch from M to Z
Comment #4
littledynamo CreditAttribution: littledynamo commentedRemoved tag
Comment #6
sidharthapCorrected patch.
Comment #8
sidharthapComment #10
sidharthapComment #12
sandipmkhairnar CreditAttribution: sandipmkhairnar commentedRemove check_plain() in core to Drupal\Component\Utility\String::checkPlain().
Comment #13
mcrittenden CreditAttribution: mcrittenden commentedComment #15
rpsuMost of references to check_plain() replaced. However there are still a couple issues
Comment #16
jibran.
Comment #18
thedavidmeister CreditAttribution: thedavidmeister commentedviews declares also String class (twice) and I am not sure if that class is the one to use inside views or not [currently String::checkPlain]
If something is using check_plain() currently, you want to use \Drupal\Component\Utility\String::checkPlain() after conversion. If "String" is already in the current namespace, you'll have to use aliases - something like "viewsString" and "UtilityString" probably makes sense.
Do menu callbacks support array('\Drupal\Component\Utility\String', 'checkPlain') syntax?
Comment #19
rpsuViews check_plain: I think right way is to go with Drupal\Component\Utility\String with an alias since basically that is the one to use for replacing check_plain() (instead of String class declared by Views).
Menu-item: I could not find any other callbacks which would use array('\Drupal\Component\Utility\String', 'checkPlain') -kind of syntax, actually there is not one anywhere else (which I could find).
Comment #20
rpsuComment #22
thedavidmeister CreditAttribution: thedavidmeister commentedFrom the coding standards at https://drupal.org/node/1353118
Comment #23
rpsuLet's try again.
Comment #24
rpsuLet's try again.
Comment #25
rpsuSorry for the double post. Files are the same.
Comment #27
rpsuForgot to give an alias to String (collision with views's String), now fixed.
Comment #29
volkerk CreditAttribution: volkerk commentedRe-rolling with aliased UtilityString class, fixed typo.
Comment #31
volkerk CreditAttribution: volkerk commentedRe-rolling #27 and fixes from #29
Comment #32
volkerk CreditAttribution: volkerk commentedrun tests
Comment #34
volkerk CreditAttribution: volkerk commentedHopefully got them all now, see #22. Aliasing Drupal\Component\Utility\String might not be the correct solution.
Comment #36
volkerk CreditAttribution: volkerk commentedrerolling #34
Comment #38
netsensei CreditAttribution: netsensei commentedChasing head and fixing a missing use statement in user.module.
Comment #39
netsensei CreditAttribution: netsensei commented... and the interdiff.
Comment #41
netsensei CreditAttribution: netsensei commentedNew attempt.
This one *will* fail however on the Menu tests. However, I've somewhat isolated it's cause: 'description callback' in menu_test does not support the array syntax per #18 and #19. See: core/includes/menu.inc => _menu_item_localize().
The same also goes for title_callback.
1/ No support for the syntax above
2/ Around line 673 this happens:
I'd suggest opening up a separate issue which fixes that before we can get back here.
Comment #43
rpsuWould it not be enought to fix this and other alike callback test? After all it is just a test to see if stuff is already plain-texted.
Comment #44
netsensei CreditAttribution: netsensei commentedI don't think so.
1. re:
title_callback == array('\Drupal\Component\Utility\String', 'checkPlain)')
$title_callback can either be a string (function name) or an array (method call). Since the type of $title_callback is ambiguous, I don't think a condition like this could work.
2. We should think further then just menu_test. It's not because this is the first and only occurrence of String::checkPlain in core, it's not possible that someone will try to call other core class methods or contrib class methods as a *_callback.
I think this merits further discussion in a separate issue.
See: #2101803: Allow class methods to be set as menu *_callback
Comment #45
netsensei CreditAttribution: netsensei commentedHm.
I think this issue is blocked because
description_callback
in menu_test.module is not supporting the new static checkPlain() method.#2076085: Resolve the need for a 'title callback' using the route pretty much converts title_callback to the new yml _title_callback property. There is no similar conversion for description_callback at this point, though.
However, since
hook_menu
is being phased out for the new routing system, I wonder if we can work around this by either:1. Ignoring check_plain() functionality in to-be removed hooks like hook_menu alltogether
2. Change the test to use the new _title_callback functionality instead, but that needs to be checked of with the routing/menu maintainers.
3. Wait until someone comes up with a decent _description_callback compatibility within the routing system.
Comment #46
thedavidmeister CreditAttribution: thedavidmeister commentedWe could unblock the bulk of the conversion by splitting this issue into smaller issues.
Comment #47
sunComment #48
InternetDevels CreditAttribution: InternetDevels commentednew try
Comment #51
dimaro CreditAttribution: dimaro commented48: check_plain_to_String_checkPlain-2089471-48.patch queued for re-testing.
Comment #53
InternetDevels CreditAttribution: InternetDevels commentednew try.
Comment #54
snig CreditAttribution: snig commentedchanged status for patch testing.
Comment #56
InternetDevels CreditAttribution: InternetDevels commentedUpdate issue.
Comment #57
InternetDevels CreditAttribution: InternetDevels commentedA half of those patches are for views modules.
Seems that this issue is too big to be done at once.
I have created separated task for views/views_ui modules:
#2187829: Convert all calls to check_plain() in core to Drupal\Component\Utility\String::checkPlain() in core/modules/views
Comment #58
ianthomas_ukRe-rolling now
Comment #59
ianthomas_ukThis is a reroll after the views issue got in, plus it fixes 3 uses in array_map.
There were lots that still needed replacing in the system module, but simpletest had some that could prove tricky (simpletest.install scares me) and we've already got a 66k patch so I'll split those into a separate issue.
I've removed references to views from the issue title/summary, as if the odd one slips back in this is now the right issue to fix it in.
Comment #61
ianthomas_ukThe array_map uses needed to be fully qualified.
Comment #65
longwaveComment #66
ianthomas_ukClasses should be fully qualified (i.e. start \Drupal) in @see blocks.
Are we allowed to fix this spelling mistake as we're making a change next to it (overriting > overwriting)?
Over 80 characters
I've checked the rest of the patch, including making sure no function parameters have been changed and broken by a reroll, and it all looks good. I think we can RTBC once these nitpicks are fixed.
Comment #67
longwaveFixed all items in #66. I agree we should fix the spelling error now while it's been noted.
Comment #68
ianthomas_ukThat fixes my concerns, assuming the tests pass this is RTBC.
Comment #69
alexpott2089471-remove-check_plain-67.patch no longer applies.
Comment #70
ianthomas_ukReroll. Just a context change in WebTestBase, theme > _theme, so back to RTBC
Comment #71
alexpott2089471-remove-check_plain-70.patch no longer applies.
Comment #72
longwaveComment #73
ianthomas_ukJust context changes, looks good.
Comment #74
alexpott2089471-remove-check_plain-72.patch no longer applies.
Comment #75
thedavidmeister CreditAttribution: thedavidmeister commentedThis is postponed on a disruptive day (see parent issue).
Comment #76
ianthomas_ukThis was fixed on the meta