[wp-trac] [WordPress Trac] #21504: Not checking if apply_filters exists before calling it

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 6 22:49:52 UTC 2012


#21504: Not checking if apply_filters exists before calling it
--------------------------+-----------------------------
 Reporter:  jdkoelsch     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  3.4.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Prior to version 3.4, there was a check to verify that apply_filters
 existed before calling it in wp-includes/wp-db.php.


 {{{
 // some queries are made before the plugins have been loaded, and thus
 cannot be filtered with this method
 if ( function_exists( 'apply_filters' ) )
   $query = apply_filters( 'query', $query );
 }}}


 In version 3.4 and above, that check doesn't exist anymore, and can throw
 an error. There is still a comment indicating that a check should be made,
 but the actual code to perform the check is now gone. This is around line
 1081


 {{{
 // some queries are made before the plugins have been loaded, and thus
 cannot be filtered with this method
                  $query = apply_filters( 'query', $query );
 }}}




 Here is the github blame view to show when the code was remove (I'm not
 sure how to find this same view in your svn):

 https://github.com/WordPress/WordPress/commit/81ed9a7563e5ad4c0edccd059bc4ea7d9c1a4a10

 There's no explanation about why the code was removed, so would it be
 possible to add it back in?

 Thanks!

 Julia

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


More information about the wp-trac mailing list