[wp-trac] [WordPress Trac] #10778: PHP Warning in class-IXR.php when $method is array
WordPress Trac
wp-trac at lists.automattic.com
Thu Oct 29 10:02:09 UTC 2009
#10778: PHP Warning in class-IXR.php when $method is array
--------------------------+-------------------------------------------------
Reporter: orensol | Owner: josephscott
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.9
Component: XML-RPC | Version:
Severity: normal | Keywords: xmlrpc, class-IXR, warning
--------------------------+-------------------------------------------------
Comment(by G.hue):
There is a problem at line 352 of wp-includes/class-IXR.php when system
call:
{{{
substr($method, 0, 5)
}}}
$method can be an array, as you can see line 363 of wp-includes/class-
IXR.php
{{{
if(is_array($method))
}}}
If $method is an array, the substr function on '''line 352 display a
Warning Error'''.
If $method is an array, system will display a Warning Error '''but
continue doing well on server side.'''
If $method is an array, '''the client will NOT be ok''' when it analyse
the returned xml because there is the Warning displaying on the XML
returned, not well formed.
On xmlrpc.php there is that on line 57/58:
{{{
// Turn off all warnings and errors.
// error_reporting(0);
}}}
If you uncomment error_reporting(0), you can't see the bug. Maybe a
relation?
$method is an array when you call a method from an object plugin, like
that :
In constructor class:
{{{
add_action('xmlrpc_methods', array(&$this, 'xmlrpc_methods'));
}}}
Then in the class of plugin, the given method array '''array(&$this,
'xmlrpc_testConnexion')''' is the problem:
{{{
public function xmlrpc_methods($methods) {
$methods['pu.testConnexion'] = array(&$this,
'xmlrpc_testConnexion');;
return $methods;
}
}}}
And the function in the class:
{{{
public function xmlrpc_testConnexion($args){
return "test";
}
}}}
The xml returned is :
{{{
<br /><b>Warning</b>: substr() expects parameter 1 to be string, array
given in <b>C:\XXX\class-IXR.php</b> on line <b>352</b><br
/><methodResponse><params><param><value><string>test</string></value></param></params></methodResponse>"
}}}
PHP Version is 5.3.0
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10778#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list