[wp-trac] [WordPress Trac] #57021: Sanitize should accept broader types

WordPress Trac noreply at wordpress.org
Fri Mar 29 20:29:53 UTC 2024


#57021: Sanitize should accept broader types
------------------------------------------+------------------------------
 Reporter:  kkmuffme                      |       Owner:  (none)
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Formatting                    |     Version:  6.2
 Severity:  normal                        |  Resolution:
 Keywords:  has-patch close dev-feedback  |     Focuses:
------------------------------------------+------------------------------
Changes (by kkmuffme):

 * type:  enhancement => defect (bug)


Comment:

 >The expectation here is that the caller should be doing this initial
 sanity check.

 It seems this wasn't the expectation, since there are existing tests that
 pass non-string.

 This leads to a bug where the types declared in apply_filters are wrong
 therefore breaking any callbacks that use PHP native types.

 This is why I changed the type to bug now - since it was annotated as
 string type, but it accepted mixed (but only handled some cases correctly)
 and passed an invalid type in the apply_filters.

 That's also why I reverted my @since annotations in many cases I added in
 the initial commit, since they wouldn't make sense - since it was mixed
 all along.

 It's ready to be reviewed and merged now.

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


More information about the wp-trac mailing list