cvs: pear-core /PEAR XMLParser.php

From: Date: Sat, 12 Jul 2008 14:24:51 +0000
Subject: cvs: pear-core /PEAR XMLParser.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7638@lists.php.net to get a copy of this message
dufuz Sat Jul 12 14:24:51 2008 UTC Modified files: /pear-core/PEAR XMLParser.php Log: Bug #14274 PEAR packager mangles package.xml encoding, then complains about it Now we have fixed both proper detection of various version of the xml dec and also if we decide to change the encoding for the xml file we do output it in the same encoding format http://cvs.php.net/viewvc.cgi/pear-core/PEAR/XMLParser.php?r1=1.18&r2=1.19&diff_format=u Index: pear-core/PEAR/XMLParser.php diff -u pear-core/PEAR/XMLParser.php:1.18 pear-core/PEAR/XMLParser.php:1.19 --- pear-core/PEAR/XMLParser.php:1.18 Fri Jul 11 20:50:43 2008 +++ pear-core/PEAR/XMLParser.php Sat Jul 12 14:24:51 2008 @@ -16,7 +16,7 @@ * @author Stephan Schmidt (original XML_Unserializer code) * @copyright 1997-2008 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: XMLParser.php,v 1.18 2008/07/11 20:50:43 dufuz Exp $ + * @version CVS: $Id: XMLParser.php,v 1.19 2008/07/12 14:24:51 dufuz Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -66,6 +66,12 @@ var $_depth = 0; /** + * The XML encoding to use + * @var string $encoding + */ + var $encoding = 'ISO-8859-1'; + + /** * @return array */ function getData() @@ -87,21 +93,20 @@ $this->_dataStack = array(); $this->_depth = 0; - $encoding = 'ISO-8859-1'; if ( strpos($data, 'encoding="UTF-8"') || strpos($data, 'encoding="utf-8"') || strpos($data, "encoding='UTF-8'") || strpos($data, "encoding='utf-8'") ) { - $encoding = 'UTF-8'; + $this->encoding = 'UTF-8'; } - if (version_compare(phpversion(), '5.0.0', 'lt') && $encoding == 'UTF-8') { + if (version_compare(phpversion(), '5.0.0', 'lt') && $this->encoding == 'UTF-8') { $data = utf8_decode($data); } - $xp = xml_parser_create($encoding); + $xp = xml_parser_create($this->encoding); xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0); xml_set_object($xp, $this); xml_set_element_handler($xp, 'startHandler', 'endHandler');

« previous php.pear.core (#7638) next »