Making WordPress.org

Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#2879 closed defect (bug) (fixed)

Regex for @see linking of hooks does not account for unencoded quotes

Reported by: coffee2code's profile coffee2code Owned by: coffee2code's profile coffee2code
Milestone: Priority: normal
Component: Developer Hub Keywords:
Cc:

Description

When using the @see notation to link to hooks, it is necessary to place single quotes around the hook name. In the context of function descriptions (the majority usage), those quotes are already encoded as HTML entities prior to handling by link_internal_element(). However, data stored in meta (such as hash param descriptions) are not encoded. Thus, regular single quotes must also be considered in the auto-link handling for hooks (which presumes quotes are encoded).

For example, comment_form() https://developer.wordpress.org/reference/functions/comment_form/:

It's $args argument is a hash parameter. The first element 'fields' references a hook properly as {@see 'comment_form_default_fields'} and that string is eventually passed unencoded to link_internal_element() where, due to the lack of quote encoding, it passes through to the fallback option of assuming it should link to a function.

Change History (3)

#1 @coffee2code
7 years ago

  • Owner set to coffee2code
  • Resolution set to fixed
  • Status changed from new to closed

In 5577:

developer.wordpress.org: Change regex for @see linking of hooks to also check for unencoded quotes.

In the context of descriptions, the quotes around hook names are already encoded as HTML entities prior to handling by link_internal_element(). However, data stored in meta (such as hash param descriptions) are not encoded so regular single quotes must also be considered.

Example: https://developer.wordpress.org/reference/functions/comment_form/

Fixes #2879.

#2 @DrewAPicture
7 years ago

Nice catch!

This ticket was mentioned in Slack in #meta-devhub by drew. View the logs.


5 years ago

Note: See TracTickets for help on using tickets.