cvs: php4 /pear/PEAR Remote.php

From: Date: Wed, 31 Oct 2001 06:21:10 +0000
Subject: cvs: php4 /pear/PEAR Remote.php
Groups: php.pear.cvs php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1217@lists.php.net to get a copy of this message
ssb Wed Oct 31 01:21:10 2001 EDT Modified files: /php4/pear/PEAR Remote.php Log: * pearweb xmlrpc layer now handles PEAR errors Index: php4/pear/PEAR/Remote.php diff -u php4/pear/PEAR/Remote.php:1.3 php4/pear/PEAR/Remote.php:1.4 --- php4/pear/PEAR/Remote.php:1.3 Tue Oct 30 07:28:39 2001 +++ php4/pear/PEAR/Remote.php Wed Oct 31 01:21:10 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Remote.php,v 1.3 2001/10/30 12:28:39 ssb Exp $ +// $Id: Remote.php,v 1.4 2001/10/31 06:21:10 ssb Exp $ require_once 'PEAR.php'; @@ -73,7 +73,27 @@ $response .= $chunk; } fclose($fp); - return xmlrpc_decode($response); + $ret = xmlrpc_decode($response); + if (is_array($ret) && isset($ret['__PEAR_TYPE__'])) { + if ($ret['__PEAR_TYPE__'] == 'error') { + if (isset($ret['__PEAR_CLASS__'])) { + $class = $ret['__PEAR_CLASS__']; + } else { + $class = "PEAR_Error"; + } + if ($ret['code'] === '') $ret['code'] = null; + if ($ret['message'] === '') $ret['message'] = null; + if ($ret['userinfo'] === '') $ret['userinfo'] = null; + if (strtolower($class) == 'db_error') { + return $this->raiseError(DB::errorMessage($ret['code']), + $ret['code'], null, null, + $ret['userinfo']); + } else { + return $this->raiseError($ret['message'], $ret['code'], + null, null, $ret['userinfo']); + } + } + } } // }}}

« previous php.pear.cvs (#1217) next »