cellog Sat Sep 24 16:28:11 2005 EDT
Modified files:
/pear-core/PEAR/REST 10.php
Log:
finally fix the empty error message for list-all with invalid XML
http://cvs.php.net/diff.php/pear-core/PEAR/REST/10.php?r1=1.31&r2=1.32&ty=u
Index: pear-core/PEAR/REST/10.php
diff -u pear-core/PEAR/REST/10.php:1.31 pear-core/PEAR/REST/10.php:1.32
--- pear-core/PEAR/REST/10.php:1.31 Tue Sep 20 23:53:28 2005
+++ pear-core/PEAR/REST/10.php Sat Sep 24 16:28:10 2005
@@ -15,7 +15,7 @@
* @author Greg Beaver <cellog@xxxxxxx>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: 10.php,v 1.31 2005/09/21 03:53:28 cellog Exp $
+ * @version CVS: $Id: 10.php,v 1.32 2005/09/24 20:28:10 cellog Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a12
*/
@@ -293,9 +293,9 @@
if (!is_array($packagelist['p'])) {
$packagelist['p'] = array($packagelist['p']);
}
+ PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
foreach ($packagelist['p'] as $package) {
if ($basic) { // remote-list command
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
if ($dostable) {
$latest = $this->_rest->retrieveData($base . 'r/' .
strtolower($package) .
'/stable.txt');
@@ -303,7 +303,6 @@
$latest = $this->_rest->retrieveData($base . 'r/' .
strtolower($package) .
'/latest.txt');
}
- PEAR::popErrorHandling();
if (PEAR::isError($latest)) {
$latest = false;
}
@@ -311,6 +310,7 @@
} else { // list-all command
$inf = $this->_rest->retrieveData($base . 'p/' .
strtolower($package) . '/info.xml');
if (PEAR::isError($inf)) {
+ PEAR::popErrorHandling();
return $inf;
}
if ($searchpackage) {
@@ -322,7 +322,6 @@
continue;
};
}
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$releases = $this->_rest->retrieveData($base . 'r/' .
strtolower($package) .
'/allreleases.xml');
if (PEAR::isError($releases)) {
@@ -406,7 +405,6 @@
if (!isset($stable)) {
$stable = '-n/a-';
}
- PEAR::popErrorHandling();
if (!$searchpackage) {
$info = array('stable' => $latest, 'summary' => $inf['s'],
'description' =>
$inf['d'], 'deps' => $deps, 'category' =>
$inf['ca']['_content'],
@@ -419,6 +417,7 @@
}
$ret[$package] = $info;
}
+ PEAR::popErrorHandling();
return $ret;
}
@@ -490,6 +489,11 @@
{
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$pinfo = $this->_rest->retrieveData($base . 'p/' .
strtolower($package) . '/info.xml');
+ if (PEAR::isError($pinfo)) {
+ PEAR::popErrorHandling();
+ return PEAR::raiseError('Unknown package: "' . $package . '"
(Debug: ' .
+ $pinfo->getMessage() . ')');
+ }
$releases = array();
$allreleases = $this->_rest->retrieveData($base . 'r/' .
strtolower($package) .
'/allreleases.xml');
@@ -512,8 +516,11 @@
}
$pf->setDeps(unserialize($ds));
$ds = $pf->getDeps();
- $info = $this->_rest->retrieveCacheFirst($base . 'r/' .
strtolower($package) . '/' .
- $release['v'] . '.xml');
+ $info = $this->_rest->retrieveCacheFirst($base . 'r/' .
strtolower($package)
+ . '/' . $release['v'] . '.xml');
+ if (PEAR::isError($info)) {
+ continue;
+ }
$releases[$release['v']] = array(
'doneby' => $info['m'],
'license' => $info['l'],
@@ -525,15 +532,10 @@
'deps' => $ds ? $ds : array(),
);
}
- $relinfo = $this->_rest->retrieveCacheFirst($base . 'r/' .
strtolower($package) . '/' .
- $release['v'] . '.xml');
} else {
$latest = '';
}
PEAR::popErrorHandling();
- if (PEAR::isError($pinfo)) {
- return PEAR::raiseError('Unknown package: "' . $package . '"');
- }
return array(
'name' => $pinfo['n'],
'channel' => $pinfo['c'],
|