php-pear/98.patch
2019-11-19 09:25:09 +01:00

50 lines
1.9 KiB
Diff

From d55d7d1b8756e5981d16852d0cd654cb27aff398 Mon Sep 17 00:00:00 2001
From: Nikita Popov <nikita.ppv@gmail.com>
Date: Tue, 27 Aug 2019 12:31:05 +0200
Subject: [PATCH] Fix use of null/false as array
---
PEAR/Command/Remote.php | 4 ++--
PEAR/DependencyDB.php | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/PEAR/Command/Remote.php b/PEAR/Command/Remote.php
index 706ac9eec..f2d82e8e5 100644
--- a/PEAR/Command/Remote.php
+++ b/PEAR/Command/Remote.php
@@ -222,7 +222,7 @@ function doRemoteInfo($command, $options, $params)
}
$installed = $reg->packageInfo($info['name'], null, $channel);
- $info['installed'] = $installed['version'] ? $installed['version'] : '- no -';
+ $info['installed'] = $installed ? $installed['version'] : '- no -';
if (is_array($info['installed'])) {
$info['installed'] = $info['installed']['release'];
}
@@ -351,7 +351,7 @@ function doListAll($command, $options, $params)
foreach ($available as $name => $info) {
$installed = $reg->packageInfo($name, null, $channel);
- if (is_array($installed['version'])) {
+ if ($installed && is_array($installed['version'])) {
$installed['version'] = $installed['version']['release'];
}
$desc = $info['summary'];
diff --git a/PEAR/DependencyDB.php b/PEAR/DependencyDB.php
index 4f633ff1f..ad48a3626 100644
--- a/PEAR/DependencyDB.php
+++ b/PEAR/DependencyDB.php
@@ -216,9 +216,11 @@ function getDependentPackageDependencies(&$pkg)
if (is_object($pkg)) {
$channel = strtolower($pkg->getChannel());
$package = strtolower($pkg->getPackage());
- } else {
+ } else if (is_array($pkg)) {
$channel = strtolower($pkg['channel']);
$package = strtolower($pkg['package']);
+ } else {
+ return false;
}
$depend = $this->getDependentPackages($pkg);