diff options
author | Greg Beaver <cellog@php.net> | 2003-11-29 19:42:19 +0000 |
---|---|---|
committer | Greg Beaver <cellog@php.net> | 2003-11-29 19:42:19 +0000 |
commit | 24409dc035553a408291a1bc221b0e9ab86b5755 (patch) | |
tree | 8b9d6f607660c9e6e2c5ae435607ed2202ceb142 /pear | |
parent | 595b433b25d6176109892b790ddaf209598696e6 (diff) | |
download | php-git-24409dc035553a408291a1bc221b0e9ab86b5755.tar.gz |
fix some bugs found in the unit test
Diffstat (limited to 'pear')
-rw-r--r-- | pear/PEAR/Common.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pear/PEAR/Common.php b/pear/PEAR/Common.php index 920cbd0167..60933bc6c3 100644 --- a/pear/PEAR/Common.php +++ b/pear/PEAR/Common.php @@ -136,6 +136,12 @@ class PEAR_Common extends PEAR * @var object */ var $source_analyzer = null; + /** + * Flag variable used to mark a valid package file + * @var boolean + * @access private + */ + var $_validPackageFile; // }}} @@ -333,6 +339,7 @@ class PEAR_Common extends PEAR $this->current_attributes = $attribs; switch ($name) { case 'package': { + $this->_validPackageFile = true; if (isset($attribs['version'])) { $vs = preg_replace('/[^0-9a-z]/', '_', $attribs['version']); } else { @@ -345,6 +352,7 @@ class PEAR_Common extends PEAR !method_exists($this, $elem_end) || !method_exists($this, $cdata)) { $this->raiseError("No handlers for package.xml version $attribs[version]"); + return; } xml_set_element_handler($xp, $elem_start, $elem_end); xml_set_character_data_handler($xp, $cdata); @@ -790,6 +798,7 @@ class PEAR_Common extends PEAR $this->in_changelog = false; $this->d_i = 0; $this->cdata = ''; + $this->_validPackageFile = false; if (!xml_parse($xp, $data, 1)) { $code = xml_get_error_code($xp); @@ -802,6 +811,9 @@ class PEAR_Common extends PEAR xml_parser_free($xp); + if (!$this->_validPackageFile) { + return $this->raiseError('Invalid Package File, no <package> tag'); + } foreach ($this->pkginfo as $k => $v) { if (!is_array($v)) { $this->pkginfo[$k] = trim($v); |