Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
user.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
15 Mar 2023 at 09:33 UTC
Updated:
5 Mar 2024 at 18:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
alexpottThere's no need to postpone this.
Comment #4
ranjit1032002Uploaded a patch for the issue mentioned, please review.
Thank You.
Comment #5
andypostneeds to replace
user_role_names()too and deprecate both functions https://www.drupal.org/about/core/policies/core-change-policies/drupal-d... and add testUpdated IS
Comment #7
andypostCreated MR - replaced all usage and deprecated
Needs reviews and polishing
Comment #8
andypostPHPStan reports false positive - it has no idea that roles has string IDs
Comment #9
andypostReplaced
roleStoragewith staticloadMultiple()allowed to pass PHPStan but it needs follow-up to get where it took integer type for IDsComment #10
andypostFiled issue to fix typing https://github.com/mglaman/phpstan-drupal/issues/522
Comment #11
alexpottRe #9 add to the baseline rather than make incorrect changes for PHPStan. PHPStan should not decide correctness when it is wrong.
Comment #12
smustgrave commentedPer #11
Comment #13
andypostUpdated baseline and reverted to injected storage
Meantime update of phpstan's baseline removed one false-positive
I did not commit guessing other issue
Comment #14
smustgrave commentedIf we can update the IS and CR similar to #3348092: Deprecate user_role_permissions() please
Comment #16
andypostUnrelated failure, updated IS and CR
Comment #17
andypostThere's 3 threads are open in MR and it needs addressing, maybe in follow-up
Basically some places using to call
HTML::escape()before using list of names forcheckboxesbut never forradiosform elements. Looking at code I think we can remove escaping as element doing that at render time.$roles = array_map(['\Drupal\Component\Utility\Html', 'escape'], $roles);Comment #18
anchal_gupta commentedI have uploaded the patch.
Address #17 comment
Comment #19
smustgrave commented@Anchal_gupta this issue is being worked on in the MR not patches. Hiding patch 18 and updating credit.
Comment #20
smustgrave commentedActually NW per #17
Comment #21
andypostRemoved escaping with extra commit and rebased
Also filed follow-up to remove 2 extra escaping #3352972: Stop calling Html::escape() for checkbox options
Comment #22
smustgrave commentedApplied MR and did searches for user_role_names() and user_role() and all instances, minus trigger_error section, have been addressed.
IS was recently updated so think that's fine.
Comment #23
alexpottFor the comment I just made on the MR.
Comment #25
murilohp commentedJust trying to move this forward, updated the code and fixed #23, moving back to NR
Comment #26
smustgrave commentedquick look into the build I don't immediately see the why but seems there were some failure in the last commit. Needs investigating.
Comment #27
andypostrebased, squashed 2 commits from murilohp and fixed it by filtering roles by permission first and then returning labels
Comment #29
elberHi sorry @andypost I didn't see your comment before, I just did the rebase, I reverted the commit "initial-default" because it pushed non-related changes.
Comment #30
andypost@elber you can just use
git rebase -i HEAD~2and drop useless commits as they will confuse reviewersComment #31
andypostRemoved this commits and rebased again (the failed test
CKEditor5AllowedTagsTestis known as failing randomly)Comment #32
smustgrave commentedPoint #23 appears to have been addressed
Comment #33
alexpottPosted another round of review on the MR
Comment #34
andypostThank you! fixed both points and reverted removal of
Html::escape()for #3352972: Stop calling Html::escape() for checkbox optionsComment #35
smustgrave commentedSo there is a build failure, I believe because #3352972: Stop calling Html::escape() for checkbox options needs to land first. So temporarily postponing this until that lands.
Comment #36
andypostNo, it was typo - closing
)in wrong place, I'm sure the #3352972: Stop calling Html::escape() for checkbox options should go second at beta stageComment #37
smustgrave commentedGotcha. In that case lets move it forward.
Comment #38
catchLeft a couple of comments on the MR.
Comment #39
alexpottUnfortunately the deprecation message needs a bit of work as
Use to inline implementation instead.doesn't make much sense. I think it should be something like:Note this needs fixing for both user_role_names() and user_roles().
@catch there's a follow-up for the escaping inconsistency - see #3352972: Stop calling Html::escape() for checkbox options
Comment #40
andypost@alexpott thanks, changed message to suggested, and rebased
@catch
user_role_names()doing thisarray_map()but having wrapper function for single function call sounds bad idea. Moreover, places where we need labels from array of entities are not a lot but could be a global helper (follow-up?)Comment #41
smustgrave commentedLets see if we can get this in for 10.1
Seems #39 has been addressed.
And #40
Think that should be a follow up as seems out of scope for this particular issue.
I can open that up if we all agree.
Comment #43
catchNeeds a re-roll for phpstan-baseline.neon (and also the deprecation version although that's also easy to fix on commit).
Comment #44
andypostRebased and updated deprecation message
Comment #45
smustgrave commentedReroll looks good!
Comment #47
catchOK let's go ahead without the helper method and rely on array_map(). Guessing we have quite a lot of usages in core compared to contrib. Also thanks for pointing me to the existing checkboxes issue.
Committed/pushed to 11.x, thanks!