Permission titles are html code already, see
http://cgit.drupalcode.org/drupal/tree/modules/user/user.admin.inc?h=7.x...
So no check_plain() is necessary for them.

Comments

maximpodorov created an issue. See original summary.

maximpodorov’s picture

Status: Active » Needs review
StatusFileSize
new784 bytes
chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 2 year old patch in #2 to views_handler_filter_user_permissions.inc does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.

Checking patch modules/user/views_handler_filter_user_permissions.inc...
error: while searching for:
      if ($permissions = module_invoke($module, 'permission')) {
        foreach ($permissions as $perm => $perm_item) {
          // @todo: group by module but views_handler_filter_many_to_one does not support this.
          $this->value_options[$perm] = check_plain(strip_tags($perm_item['title']));
        }
      }
    }

error: patch failed: modules/user/views_handler_filter_user_permissions.inc:27
error: modules/user/views_handler_filter_user_permissions.inc: patch does not apply
silvi.addweb’s picture

Status: Needs work » Needs review
StatusFileSize
new783 bytes

@Chris2, I Replaced "check_plain" with "strip_tags" function for the views 7.x-3.x-dev. Kindly review my attached patch.

Thanks

damienmckenna’s picture

Issue tags: -Needs reroll
renatog’s picture

Hummmm maybe it makes sense

So as I understood $permission titles are html code already, so isn't necessary use
$this->value_options[$perm] = check_plain(strip_tags($perm_item['title']));

Because check_plain is unnecessary, and we can use only:
$this->value_options[$perm] = strip_tags($perm_item['title']);
That's right?!

It really makes sense to me, but I can't read your "source" because this link that you provided as proof of your concept points to a huge file without line reference so I couldn't find what is the exact line that you want to show

If someone can confirm that's true will helps a lot

maximpodorov’s picture

The updated link:
https://git.drupalcode.org/project/drupal/blob/7.x/modules/user/user.adm...
It was used to show that permission titles are HTML markup.

renatog’s picture

Status: Needs review » Reviewed & tested by the community

Cool! Thanks a lot @maximpodorov

So really makes sense to me. Moving to RTBC

Is anyone against this?

damienmckenna’s picture

I believe the correct way of looking at this is that when the items are rendered on the page as a select tag the options pass through form_select_options() which passes both the option key and title through check_plain().

damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thank you all for your work to resolve this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.