|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-08-17 18:59 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2016-08-17 18:59 UTC] cmb@php.net
[2016-08-28 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 06:00:01 2025 UTC |
Description: ------------ A couple of weeks ago, we upgraded php to 5.3.19. Eversince the following bug appears: When I try to get the regex out of a XML file, he only gives the last piece as result. <?xml version="1.0" encoding="utf-8" ?> <simplexml> <regex><![CDATA[/(^[a-zA-Z0- 9._-]+@[a-zA-Z0-9-]+.[a-zA-Z.]{2,5}\$)|^\$/i]]></regex> </simplexml> The result is ']{2,5}\$)|^\$/i': > FileHandler_Xml Object ( [_filename:protected] => [_parser:protected] => [_children:protected] => Array ( [regex] => FileHandler_Xml_Element Object ( [_cdata:protected] => ]{2,5}\$)|^\$/i [_attributes:protected] => [_children:protected] => ) ) [obj] => ) I use 'XML Parser' to parse the XML to the object above. I hope somebody can help me out with this problem? With kind regards, Pim Test script: --------------- public function addXml($xml){ $this->_parserMemory = array(); $parser = xml_parser_create( 'UTF-8' ); xml_set_object($parser, $this); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_set_element_handler($parser, "_xmlTagOpen", "_xmlTagClose"); xml_set_character_data_handler($parser, "_xmlCdata"); if (!xml_parse($parser, $xml)) { $this->_children = array(); $error_code = xml_get_error_code($parser); $error_string = xml_error_string($error_code); $current_line = xml_get_current_line_number($parser); $current_column = xml_get_current_column_number($parser); } unset($this->_parserMemory); xml_parser_free($parser); } protected function _xmlCdata($parser, $cdata) { if ( trim($cdata) != '' && count($this->_parserMemory)>1 ) { $obj = $this->getCurrentObject(); $obj->setValue($this->_xmlConvertValueFromString($cdata)); } } Expected result: ---------------- > FileHandler_Xml Object ( [_filename:protected] => [_parser:protected] => [_children:protected] => Array ( [regex] => FileHandler_Xml_Element Object ( [_cdata:protected] => /(^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+.[a- zA-Z.]{2,5}\$)|^\$/i [_attributes:protected] => [_children:protected] => ) ) [obj] => ) Actual result: -------------- The result is ']{2,5}\$)|^\$/i': > FileHandler_Xml Object ( [_filename:protected] => [_parser:protected] => [_children:protected] => Array ( [regex] => FileHandler_Xml_Element Object ( [_cdata:protected] => ]{2,5}\$)|^\$/i [_attributes:protected] => [_children:protected] => ) ) [obj] => )