Opened 10 years ago
Closed 10 years ago
#31503 closed defect (bug) (fixed)
code flaw in function wp_clean_update_cache
Reported by: | juggledad | Owned by: | ocean90 |
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 4.1.1 |
Component: | General | Keywords: | has-patch commit |
Focuses: | Cc: |
Description (last modified by )
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?
Attachments (2)
Change History (10)
#2
follow-up:
↓ 6
@
10 years ago
I can't think of a scenario right now, where WP_INC/theme.php
(for wp_clean_themes_cache()
) is loaded, but plugin.php
(for wp_clean_plugins_cache()
) isn't. Thus, we should probably add the same check for wp_clean_themes_cache()
as well, see 31503.diff.
#3
@
10 years ago
- Keywords has-patch commit added
31503.diff still applies. Moving for commit consideration.
This ticket was mentioned in Slack in #core by drew. View the logs.
10 years ago
#6
in reply to:
↑ 2
;
follow-up:
↓ 7
@
10 years ago
Replying to TobiasBg:
I can't think of a scenario right now, where
WP_INC/theme.php
(forwp_clean_themes_cache()
) is loaded, butplugin.php
(forwp_clean_plugins_cache()
) isn't. Thus, we should probably add the same check forwp_clean_themes_cache()
as well, see 31503.diff.
wp_clean_plugins_cache() is in *wp-admin/includes*, which is not always loaded, while wp-includes/theme.php is always loaded. Just removing the one line is appropriate.
#7
in reply to:
↑ 6
@
10 years ago
Replying to nacin:
wp_clean_plugins_cache() is in *wp-admin/includes*, which is not always loaded, while wp-includes/theme.php is always loaded. Just removing the one line is appropriate.
Ah, indeed. Had somehow confused it with the WP_INC/plugin.php
. Thanks for clearing this up!
Introduced in [30856] ([30870] for the 4.1 branch).