Tuesday, July 30, 2013

XML_RPC Non-Static PEAR::raiseError

"E_STRICT Caught: Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context in /usr/share/pear/XML/RPC.php on line 562"

Near as I can tell, this is because it's PHP 4 PEAR being used in PHP 5.
XML_RPC is supposedly replaced by XML_RPC2, which is not maintained.

Anyhow, this was causing an exception that interfered with the true exception.

The Fix:

in XML_RPC_Base:
    /**
     * PEAR Error handling
     *
     * @return object  PEAR_Error object
     */
    function raiseError($msg, $code)
    {
        include_once 'PEAR.php';
        if (is_object(@$this)) {
            throw new Exception($msg . $code);
          #  return PEAR::raiseError(get_class($this) . ': ' . $msg, $code);
        } else {
            throw new Exception($msg . $code);
          #  return PEAR::raiseError('XML_RPC: ' . $msg, $code);
        }
    }

No comments: