Opened 19 years ago
Closed 19 years ago
#2344 closed defect (bug) (fixed)
Warning: Invalid argument supplied for foreach() in /var/sites/lbt/wp-includes/functions.php on line 458
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.0 |
Component: | General | Keywords: | bg|has-patch |
Focuses: | Cc: |
Description
When using the subscribe to comments plugin, on removing a subscription the following warning message is displayed:
Warning: Invalid argument supplied for foreach() in /var/sites/lbt/wp-includes/functions.php on line 458
Although I have only been able to trigger this bug using subscribe to comments, the problem appears to be in Wordpress itself.
The function remove_subscriber() in subscribe-to-comments.php:546 calls delete_post_meta() in wp-includes/functions.php:436, with 3 parameters:
- $post_id: 18
- $key: "_sg_subscribe-to-comments"
- $value: email address
On line 458 of wp-includes/functions.php, the following returns the warning:
foreach ( $cache_key as $index => $data )
This is because $cache_key, taken from $post_meta_cache$post_id?[$key] is empty.
I would have expected delete_post_meta() to have checked for $cache_key being non-empty before passing it to foreach(). If this is in fact a bug in subscribe to comments then please close this report and I will pass this onto the plugin developer.
- Wordpress version tested: wordpress-2.0
- Subscribe to comments version: 2.0.3
- PHP version: 4.1.2-7.woody5
- Operating system: Debian GNU/Linux 3.0
Thanks for the pointer.