cvs: pear /XML_RPC RPC.php

From: Date: Sat, 22 Jan 2005 03:07:58 +0000
Subject: cvs: pear /XML_RPC RPC.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-28734@lists.php.net to get a copy of this message
danielc Fri Jan 21 22:07:58 2005 EDT Modified files: /pear/XML_RPC RPC.php Log: * Add XML_RPC_Base::isError(). * Have raiseError() return the error object, not just raise it. * When a connection attempt fails, have the method return the PEAR Error object. Prior to this change, execution continued, causing less than graceful failures. * Enhance connection failure messages by including the value from fsockopen()'s errstr argument. http://cvs.php.net/diff.php/pear/XML_RPC/RPC.php?r1=1.47&r2=1.48&ty=u Index: pear/XML_RPC/RPC.php diff -u pear/XML_RPC/RPC.php:1.47 pear/XML_RPC/RPC.php:1.48 --- pear/XML_RPC/RPC.php:1.47 Wed Jan 19 18:05:31 2005 +++ pear/XML_RPC/RPC.php Fri Jan 21 22:07:57 2005 @@ -31,7 +31,7 @@ * @author Stig Bakken <stig@php.net> * @author Martin Jansen <mj@php.net> * @copyright 1999-2001 Edd Dumbill - * @version CVS: $Id: RPC.php,v 1.47 2005/01/19 23:05:31 danielc Exp $ + * @version CVS: $Id: RPC.php,v 1.48 2005/01/22 03:07:57 danielc Exp $ * @link http://pear.php.net/package/XML_RPC */ @@ -399,11 +399,25 @@ { include_once 'PEAR.php'; if (is_object(@$this)) { - PEAR::raiseError(get_class($this) . ': ' . $msg, $code); + return PEAR::raiseError(get_class($this) . ': ' . $msg, $code); } else { - PEAR::raiseError('XML_RPC: ' . $msg, $code); + return PEAR::raiseError('XML_RPC: ' . $msg, $code); } } + + /** + * Tell whether something is a PEAR_Error object + * + * @param mixed $value the item to check + * + * @return bool whether $value is a PEAR_Error object or not + * + * @access public + */ + function isError($value) + { + return is_a($value, 'PEAR_Error'); + } } /** @@ -548,12 +562,15 @@ } if (!$fp && $this->proxy) { - $this->raiseError('Connection to proxy server ' . $this->proxy - . ':' . $this->proxy_port . ' failed', - XML_RPC_ERROR_CONNECTION_FAILED); + return $this->raiseError('Connection to proxy server ' + . $this->proxy . ':' . $this->proxy_port + . ' failed. ' . $this->errstr, + XML_RPC_ERROR_CONNECTION_FAILED); } elseif (!$fp) { - $this->raiseError('Connection to RPC server ' . $this->server . ' failed', - XML_RPC_ERROR_CONNECTION_FAILED); + return $this->raiseError('Connection to RPC server ' + . $server . ':' . $port + . ' failed. ' . $this->errstr, + XML_RPC_ERROR_CONNECTION_FAILED); } // Only create the payload if it was not created previously

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