PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » PEAR » PEAR » Bug #9206

PEAR package info is not retrieved correctly for package with single release

Details

Submitted2006-11-01 00:13 UTC
Fromakalura at gmail dot com
Assignedcellog
StatusClosed
PackagePEAR
PHP Version5.1.6
OSWindows XP
Roadmaps(Not assigned)

Comments

[2006-11-01 00:13 UTC] akalura at gmail dot com

Description:
------------
Pear Version: 1.4.9

While issuing “pear remote-info [packagename]” command if the package only has one release associated with it (in r/packagename/allreleases.xml), the console returns following error

“Notice: Undefined variable: latest in PEAR\REST\10.php on line 595
PACKAGE DETAILS:
================
Latest “

Fix/Solution
Line #556 of 10.php under PEAR\REST folder (function packageInfo() ) should be modified

Current Code
if (!is_array($allreleases['r'])) {
$allreleases['r'] = array($allreleases['r']);
}

Should be replaced by
if (!is_array($allreleases['r']) || !isset($allreleases['r'][0])) {
$allreleases['r'] = array($allreleases['r']);
}

Test script:
---------------
Create a package with single release

i.e. allreleases.xml should be somewhat like this

<?xml version="1.0" encoding="UTF-8" ?>
<a xmlns="http://pear.php.net/dtd/rest.allreleases"
xsi:schemaLocation="http://pear.php.net/dtd/rest.allreleases
http://pear.php.net/dtd/rest.allreleases.xsd">
<p>Package</p>
<c>pear.mydomain.com</c>
<r><v>0.0.1</v><s>alpha</s></r>
</a>

Expected result:
----------------
pear remote-info mydomain\Package will result in error.