Opened 7 years ago

Closed 7 years ago

#3000 closed defect (bug) (fixed)

warning returned in xmlrpc.php on pingback

Reported by: _ck_ Owned by: ryan
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).

  1. Yes it appears twice in a row.
  2. 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)

comment:1   _ck_7 years ago

  • Component changed from Administration to XML-RPC

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

comment:3   _ck_7 years ago

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.

comment:4   ryan7 years ago

  • Owner changed from anonymous to ryan

comment:5   ryan7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Should be fixed now. We were passing scalars instead of arrays in a few places.

Note: See TracTickets for help on using tickets.