From 5ec41d83b49ba79a1f41e942fb293a7ce91e987e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 18 Jul 2012 14:22:46 +0200 Subject: [PATCH] Fix non-array return value in some cases on php 5.3.2, fixes #927 --- .../Repository/Pear/ChannelRest11Reader.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Composer/Repository/Pear/ChannelRest11Reader.php b/src/Composer/Repository/Pear/ChannelRest11Reader.php index 42d52c928..22cd61cc0 100644 --- a/src/Composer/Repository/Pear/ChannelRest11Reader.php +++ b/src/Composer/Repository/Pear/ChannelRest11Reader.php @@ -115,13 +115,16 @@ class ChannelRest11Reader extends BaseChannelReader } $releases = array(); - foreach ($packageInfo->xpath('ns:a/ns:r') as $node) { - $releaseVersion = (string) $node->v; - $releaseStability = (string) $node->s; - $releases[$releaseVersion] = new ReleaseInfo( - $releaseStability, - isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array()) - ); + $releasesInfo = $packageInfo->xpath('ns:a/ns:r'); + if ($releasesInfo) { + foreach ($releasesInfo as $node) { + $releaseVersion = (string) $node->v; + $releaseStability = (string) $node->s; + $releases[$releaseVersion] = new ReleaseInfo( + $releaseStability, + isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array()) + ); + } } return new PackageInfo(