[wp-trac] [WordPress Trac] #46886: wp_targeted_link_rel adds the rel attribute when the link has data-target=""

WordPress Trac noreply at wordpress.org
Fri Apr 12 21:14:20 UTC 2019


#46886: wp_targeted_link_rel adds the rel attribute when the link has data-
target=""
----------------------------+------------------------------
 Reporter:  jakeparis       |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Formatting      |     Version:  5.1
 Severity:  normal          |  Resolution:
 Keywords:  has-unit-tests  |     Focuses:
----------------------------+------------------------------
Changes (by birgire):

 * keywords:   => has-unit-tests


Comment:

 Thanks for the ticket @jakeparis

 [attachment:"46886.diff"] adds a failing unit test for this case.

 Skimming through the regex {{{'|<a\s([^>]*target\s*=[^>]*)>|i'}}}, within
 {{{wp_targeted_link_rel()}}}:

 https://core.trac.wordpress.org/browser/tags/5.1.1/src/wp-
 includes/formatting.php#L3041

 it seems to allow the {{{target}}} attribute to be part of another string,
 thus picking up {{{data-target}}} as a false positive.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46886#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list