Modified: pear/pear-core/trunk/PEAR/Command/Install.php =================================================================== --- pear/pear-core/trunk/PEAR/Command/Install.php 2009-08-02 14:12:04 UTC (rev 286669) +++ pear/pear-core/trunk/PEAR/Command/Install.php 2009-08-02 14:16:06 UTC (rev 286670) @@ -563,8 +563,7 @@ } } - $abstractpackages = array(); - $otherpackages = array(); + $abstractpackages = $otherpackages = array(); // parse params PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); @@ -658,7 +657,7 @@ } $this->downloader = &$this->getDownloader($this->ui, $options, $this->config); - $errors = $downloaded = $binaries = array(); + $errors = $downloaded = $binaries = array(); $downloaded = &$this->downloader->download($packages); if (PEAR::isError($downloaded)) { return $this->raiseError($downloaded); @@ -703,8 +702,7 @@ return true; } - $extrainfo = array(); - $binaries = array(); + $binaries = $extrainfo = array(); foreach ($downloaded as $param) { PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $info = $this->installer->install($param, $options); Modified: pear/pear-core/trunk/PEAR/Downloader.php =================================================================== --- pear/pear-core/trunk/PEAR/Downloader.php 2009-08-02 14:12:04 UTC (rev 286669) +++ pear/pear-core/trunk/PEAR/Downloader.php 2009-08-02 14:16:06 UTC (rev 286670) @@ -306,7 +306,8 @@ } if ($params[$i] && !isset($channelschecked[$params[$i]->getChannel()]) && - !isset($this->_options['offline'])) { + !isset($this->_options['offline']) + ) { $channelschecked[$params[$i]->getChannel()] = true; PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); if (!class_exists('System')) { Modified: pear/pear-core/trunk/PEAR/PackageFile.php =================================================================== --- pear/pear-core/trunk/PEAR/PackageFile.php 2009-08-02 14:12:04 UTC (rev 286669) +++ pear/pear-core/trunk/PEAR/PackageFile.php 2009-08-02 14:16:06 UTC (rev 286670) @@ -205,9 +205,10 @@ return $pf; } - if (!$pf->validate($state)) { + if (!$pf->validate($state)) {; if ($this->_config->get('verbose') > 0 - && $this->_logger && $pf->getValidationWarnings(false)) { + && $this->_logger && $pf->getValidationWarnings(false) + ) { foreach ($pf->getValidationWarnings(false) as $warning) { $this->_logger->log(0, 'ERROR: ' . $warning['message']); } @@ -323,13 +324,13 @@ $ret = PEAR::raiseError("Could not get contents of package \"$file\"". '. Invalid tgz file.'); return $ret; - } else { - if (!count($content) && !@is_file($file)) { - $ret = PEAR::raiseError("could not open file \"$file\""); - return $ret; - } } + if (!count($content) && !@is_file($file)) { + $ret = PEAR::raiseError("could not open file \"$file\""); + return $ret; + } + $xml = null; $origfile = $file; foreach ($content as $file) { Modified: pear/pear-core/trunk/PEAR/REST/11.php =================================================================== --- pear/pear-core/trunk/PEAR/REST/11.php 2009-08-02 14:12:04 UTC (rev 286669) +++ pear/pear-core/trunk/PEAR/REST/11.php 2009-08-02 14:16:06 UTC (rev 286670) @@ -79,8 +79,8 @@ continue; } - $info = $packageinfo['p']; - $package = $info['n']; + $info = $packageinfo['p']; + $package = $info['n']; $releases = isset($packageinfo['a']) ? $packageinfo['a'] : false; unset($latest); unset($unstable); @@ -91,6 +91,7 @@ if (!isset($releases['r'][0])) { $releases['r'] = array($releases['r']); } + foreach ($releases['r'] as $release) { if (!isset($latest)) { if ($dostable && $release['s'] == 'stable') { @@ -102,19 +103,23 @@ $state = $release['s']; } } + if (!isset($stable) && $release['s'] == 'stable') { $stable = $release['v']; if (!isset($unstable)) { $unstable = $stable; } } + if (!isset($unstable) && $release['s'] != 'stable') { $unstable = $release['v']; $state = $release['s']; } + if (isset($latest) && !isset($state)) { $state = $release['s']; } + if (isset($latest) && isset($stable) && isset($unstable)) { break; } @@ -125,6 +130,7 @@ if (!isset($latest)) { $latest = false; } + if ($dostable) { // $state is not set if there are no releases if (isset($state) && $state == 'stable') { @@ -135,11 +141,11 @@ } else { $ret[$package] = array('stable' => $latest); } + continue; } // list-all command - $deps = array(); if (!isset($unstable)) { $unstable = false; $state = 'stable'; @@ -154,46 +160,60 @@ $latest = false; } + $deps = array(); if ($latest && isset($packageinfo['deps'])) { if (!is_array($packageinfo['deps']) || - !isset($packageinfo['deps'][0])) { + !isset($packageinfo['deps'][0]) + ) { $packageinfo['deps'] = array($packageinfo['deps']); } + $d = false; foreach ($packageinfo['deps'] as $dep) { if ($dep['v'] == $latest) { $d = unserialize($dep['d']); } } + if ($d) { if (isset($d['required'])) { if (!class_exists('PEAR_PackageFile_v2')) { require_once 'PEAR/PackageFile/v2.php'; } + if (!isset($pf)) { $pf = new PEAR_PackageFile_v2; } + $pf->setDeps($d); $tdeps = $pf->getDeps(); } else { $tdeps = $d; } + foreach ($tdeps as $dep) { if ($dep['type'] !== 'pkg') { continue; } + $deps[] = $dep; } } } - $info = array('stable' => $latest, 'summary' => $info['s'], - 'description' => - $info['d'], 'deps' => $deps, 'category' => $info['ca']['_content'], - 'unstable' => $unstable, 'state' => $state); + $info = array( + 'stable' => $latest, + 'summary' => $info['s'], + 'description' => $info['d'], + 'deps' => $deps, + 'category' => $info['ca']['_content'], + 'unstable' => $unstable, + 'state' => $state + ); $ret[$package] = $info; } } + PEAR::popErrorHandling(); return $ret; } @@ -210,13 +230,16 @@ if (PEAR::isError($categorylist)) { return $categorylist; } + if (!is_array($categorylist) || !isset($categorylist['c'])) { return array(); } + if (isset($categorylist['c']['_content'])) { // only 1 category $categorylist['c'] = array($categorylist['c']); } + return $categorylist['c']; } @@ -259,35 +282,36 @@ $packagelist = $packagelist['p']; } return $packagelist; + } + + // info == true + if (!isset($packagelist['pi'])) { + return array(); + } + + if (!is_array($packagelist['pi']) || + !isset($packagelist['pi'][0])) { // only 1 pkg + $packagelist_pre = array($packagelist['pi']); } else { - // info == true - if (!isset($packagelist['pi'])) { - return array(); + $packagelist_pre = $packagelist['pi']; + } + + $packagelist = array(); + foreach ($packagelist_pre as $i => $item) { + // compatibility with r/.xml + if (isset($item['a']['r'][0])) { + // multiple releases + $item['p']['v'] = $item['a']['r'][0]['v']; + $item['p']['st'] = $item['a']['r'][0]['s']; + } elseif (isset($item['a'])) { + // first and only release + $item['p']['v'] = $item['a']['r']['v']; + $item['p']['st'] = $item['a']['r']['s']; } - if (!is_array($packagelist['pi']) || - !isset($packagelist['pi'][0])) { // only 1 pkg - $packagelist_pre = array($packagelist['pi']); - } else { - $packagelist_pre = $packagelist['pi']; - } - $packagelist = array(); - foreach ($packagelist_pre as $i => $item) { - // compatibility with r/.xml - if (isset($item['a']['r'][0])) { - // multiple releases - $item['p']['v'] = $item['a']['r'][0]['v']; - $item['p']['st'] = $item['a']['r'][0]['s']; - } elseif (isset($item['a'])) { - // first and only release - $item['p']['v'] = $item['a']['r']['v']; - $item['p']['st'] = $item['a']['r']['s']; - } - - $packagelist[$i] = array('attribs' => $item['p']['r'], - '_content' => $item['p']['n'], - 'info' => $item['p']); - } + $packagelist[$i] = array('attribs' => $item['p']['r'], + '_content' => $item['p']['n'], + 'info' => $item['p']); } return $packagelist; Modified: pear/pear-core/trunk/PEAR.php =================================================================== --- pear/pear-core/trunk/PEAR.php 2009-08-02 14:12:04 UTC (rev 286669) +++ pear/pear-core/trunk/PEAR.php 2009-08-02 14:16:06 UTC (rev 286670) @@ -886,6 +886,7 @@ unset($this->backtrace[0]['object']); } } + if ($mode & PEAR_ERROR_CALLBACK) { $this->level = E_USER_NOTICE; $this->callback = $options; @@ -893,20 +894,25 @@ if ($options === null) { $options = E_USER_NOTICE; } + $this->level = $options; $this->callback = null; } + if ($this->mode & PEAR_ERROR_PRINT) { if (is_null($options) || is_int($options)) { $format = "%s"; } else { $format = $options; } + printf($format, $this->getMessage()); } + if ($this->mode & PEAR_ERROR_TRIGGER) { trigger_error($this->getMessage(), $this->level); } + if ($this->mode & PEAR_ERROR_DIE) { $msg = $this->getMessage(); if (is_null($options) || is_int($options)) { @@ -919,11 +925,13 @@ } die(sprintf($format, $msg)); } + if ($this->mode & PEAR_ERROR_CALLBACK) { if (is_callable($this->callback)) { call_user_func($this->callback, $this); } } + if ($this->mode & PEAR_ERROR_EXCEPTION) { trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING); eval('$e = new Exception($this->message, $this->code);throw($e);');