[wp-trac] [WordPress Trac] #18637: Poor regex used in admin-ajax.php for user UI state

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 12 22:07:04 UTC 2011


#18637: Poor regex used in admin-ajax.php for user UI state
----------------------------+---------------------
 Reporter:  MarcusPope      |       Owner:  nacin
     Type:  defect (bug)    |      Status:  closed
 Priority:  normal          |   Milestone:  3.3
Component:  Administration  |     Version:  3.2.1
 Severity:  normal          |  Resolution:  fixed
 Keywords:  has-patch       |
----------------------------+---------------------

Comment (by MarcusPope):

 Just curious, but why was the use of a constant inappropriate in my
 original patch?  I completely understand using sanitize_key in lieu of yet
 another regex (though imo the readability of the intended logic is
 slightly lowered.)  But I don’t understand why replacing three copy-and-
 pasted string literals with a constant isn’t a good practice.

 Had sanitize_key (or variations of it) not existed in the codebase what
 would be the preferred method for solving this problem?

 Hopefully someone can answer me here or email me at marcus.pope at
 springbox.com

 Thanks everyone, especially @azaozz for keeping the behavior consistent :D
 (btw, I would hate to see slugs like you described as well, but in this
 case I have a post type with emc2 in the name and even the codex lists:

  "ai1m_product" - Products post type provided by the hypothetical "All-in-
 One Merchant" Plugin.

 as a valid naming convention for CPT’s.

 Thanks again to everyone else for knocking this out quickly!

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18637#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list