[wp-trac] [WordPress Trac] #31503: code flaw in function wp_clean_update_cache

WordPress Trac noreply at wordpress.org
Mon Mar 2 12:29:50 UTC 2015


#31503: code flaw in function wp_clean_update_cache
--------------------------+-----------------------------
 Reporter:  juggledad     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.1.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I may be mistaken, but there seems to be a flaw in wp_clean_update_cache.
 here is teh existing code:
 /**
  * Clear existing update caches for plugins, themes, and core.
  *
  * @since 4.1.0
  */
 function wp_clean_update_cache() {
         if ( function_exists( 'wp_clean_plugins_cache' ) ) {
                 wp_clean_plugins_cache();
         } else {
                 delete_site_transient( 'update_plugins' );
         }
         wp_clean_plugins_cache();
         wp_clean_themes_cache();
         delete_site_transient( 'update_core' );
 }
 If the function 'wp_clean_plugins_cache' exists, then it is called twice,
 once in the if...else and once outside the if...else.
 If the function wp_clean_plugins_cache does not exist then
 delete_site_transient( 'update_plugins' ); will run (the else) but then
 you will get a fatal error 'call to an undefined function.

 Since no one is getting the fatal error, then the else must never be
 running and why have two calls to teh same function?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31503>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list