Opened 7 years ago
Closed 7 years ago
#3000 closed defect (bug) (fixed)
warning returned in xmlrpc.php on pingback
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.1 |
| Component: | XML-RPC | Version: | 2.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I am getting the following warning while doing a pingback to a test blog using 2.1a2 (however I don't believe the code in question has changed since 2.0 gold).
- Yes it appears twice in a row.
- I am using the pingback class from pear so I am assuming it's sending properly formed data.
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/example/public_html/news/xmlrpc.php</b> on line <b>160</b><br /> <br /> <b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/example/public_html/news/xmlrpc.php<
The code in question is here:
function escape(&$array) {
global $wpdb;
foreach ($array as $k => $v) {
if (is_array($v)) {
$this->escape($array[$k]);
} else if (is_object($v)) {
//skip
} else {
$array[$k] = $wpdb->escape($v);
}
}
}
Change History (5)
My amateur skills tell me that php doesn't like "$array" which may be passed something other than an array? Should there be a test before the loop starts? ie. is_array($array) ?
It's beyond my ability to trace what is calling it and when so I hope someone can make it respond more gracefully. Technically no human should see a pingback session error/warning response but it bothers me somewhat.
Note: See
TracTickets for help on using
tickets.

I don't think the function is wrong. I think that it's one of the calls the function.