[wp-trac] [WordPress Trac] #13098: sanitize_bookmark_field() assumes link_category is an array

WordPress Trac wp-trac at lists.automattic.com
Sat Apr 24 00:48:43 UTC 2010


#13098: sanitize_bookmark_field() assumes link_category is an array
--------------------------+-------------------------------------------------
 Reporter:  mdawaffe      |       Owner:                       
     Type:  defect (bug)  |      Status:  new                  
 Priority:  normal        |   Milestone:  Unassigned           
Component:  General       |     Version:  3.0                  
 Severity:  minor         |    Keywords:  warning, optimization
--------------------------+-------------------------------------------------
 A link object's link_category property is an array of the link category
 ids to which the link belongs.  In rare circumstances, though, it can be
 set to a scalar.

 Attached casts the link_category value to an array before calling
 array_map().  This avoids a PHP warning.

 Patch also optimizes the conditional logic a bit by turning the series of
 $field if statements into a single switch statement and by moving the
 esc_attr/esc_js logic into the only $context branch to which it applies.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13098>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list