From f7a70ccc132d013c6db4f5f6b2030b675070b5ae Mon Sep 17 00:00:00 2001 From: Greg Beaver Date: Wed, 13 Aug 2003 21:12:15 +0000 Subject: [PATCH] fix optional dependencies in reading, validating, and writing of package.xml --- pear/PEAR/Common.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pear/PEAR/Common.php b/pear/PEAR/Common.php index 81f88b6643..4f511a337c 100644 --- a/pear/PEAR/Common.php +++ b/pear/PEAR/Common.php @@ -924,6 +924,9 @@ class PEAR_Common extends PEAR if (isset($dep['version'])) { $ret .= " version=\"$dep[version]\""; } + if (isset($dep['optional'])) { + $ret .= " optional=\"$dep[optional]\""; + } if (isset($dep['name'])) { $ret .= ">$dep[name]\n"; } else { @@ -1090,6 +1093,11 @@ class PEAR_Common extends PEAR } elseif (!in_array($d['rel'], $_PEAR_Common_dependency_relations)) { $errors[] = "dependency $i: invalid relation, should be one of: ".implode(' ', $_PEAR_Common_dependency_relations); } + if (!empty($d['optional'])) { + if (!in_array($d['optional'], array('yes', 'no'))) { + $errors[] = "dependency $i: invalid relation optional attribute, should be one of: yes no"; + } + } if ($d['rel'] != 'has' && empty($d['version'])) { $warnings[] = "dependency $i: missing version"; } elseif ($d['rel'] == 'has' && !empty($d['version'])) { -- 2.40.0