[wp-trac] [WordPress Trac] #30875: enforce integers in add_filter priority

WordPress Trac noreply at wordpress.org
Fri Jan 2 00:09:08 UTC 2015


#30875: enforce integers in add_filter priority
------------------------------------------+------------------------------
 Reporter:  drrobotnik                    |       Owner:
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Plugins                       |     Version:  4.1
 Severity:  normal                        |  Resolution:
 Keywords:  has-patch dev-feedback close  |     Focuses:
------------------------------------------+------------------------------

Comment (by dd32):

 > it does however, return false when $priority is set to an array or
 object. I added that because I was getting an 'Illegal offset type' thrown
 in the console when I tried to assert they were false.

 This is the type of error that we'd normally leave in place, as a
 development warning to the developer that they're passing something in
 that  doesn't evaluate in a manner that works. That might sound counter
 intuitive given the concerns raised here, but as long as a warning isn't
 something that should be generated in the normal runtime and correct use
 of a function, we generally leave it there for the dev to pick up on.

 Realistically I agree with adding a unit test that covers it, but I do
 question if unit testing the addition of filters is worthwhile, and rather
 that a test on the order of execution might be more useful.

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


More information about the wp-trac mailing list