php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22903 when parsing xml php crashes
Submitted: 2003-03-26 09:13 UTC Modified: 2003-03-31 02:04 UTC
Votes:4
Avg. Score:2.5 ± 1.1
Reproduced:1 of 3 (33.3%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: spoerri at duke dot edu Assigned:
Status: No Feedback Package: XML related
PHP Version: 4.3.1 OS: linux
Private report: No CVE-ID: None
 [2003-03-26 09:13 UTC] spoerri at duke dot edu
Hi, 
while parsing an XML response (using expat) from a 3rd party 
server. The parsing works fine, with the exception for one 
tag for which the info for an attribute is droped (empty). The 
thing is that the tag occur more than once and is parsed 
correctly the other times. 
 
I also tried to print the attributes for each of those tags, but 
php seems crash (seg. fault error in apache log) after the 
second occurance of the LAYINFO tag (this is also the tag 
which loses the ID attribut value). 
 
When I switched back to php 4.2.3, the parsing works fine 
again. 
 
Thanks for your help, 
Christoph 
 
**** sample XML file (partial file only) ***** 
<LAYERINFO type="image" name="ocean1prj2.tif" 
visible="true" id="12"> 
<ENVELOPE minx="-178.183334350586" 
miny="-72.0226440429688" maxx="180.016647338867" 
maxy="71.9773483276367" /> 
</LAYERINFO> 
<LAYERINFO type="featureclass" visible="true" 
name="world_usa_canada" id="14"> 
<FCLASS type="polygon"> 
<ENVELOPE minx="-180" miny="-90" maxx="180" 
maxy="83.6235961914062" /> 
</FCLASS> 
<SIMPLERENDERER> 
<SIMPLEPOLYGONSYMBOL fillcolor="99,172,99" 
filltransparency="1" boundarycolor="51,102,51" 
boundarytransparency="1" boundarycaptype="round" /> 
</SIMPLERENDERER> 
</LAYERINFO> 
<LAYERINFO type="featureclass" visible="true" name="latlong" 
id="13"> 
<FCLASS type="line"> 
<ENVELOPE minx="-180" miny="-90" maxx="180" maxy="90" 
/> 
</FCLASS> 
<SIMPLERENDERER> 
<SIMPLELINESYMBOL color="192,192,192" width="1" 
captype="round" /> 
</SIMPLERENDERER> 
</LAYERINFO> 
 
 
 
********************* 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-26 09:23 UTC] iliaa@php.net
What is your XML parsing code?
 [2003-03-26 09:40 UTC] spoerri at duke dot edu
I'm sending you here only code snippets, in case you need 
the rest of the code let me know. Note: the code is 
embedded in the code for an object. 
 
** here's the code used to setup the parser: *** 
      
$this->xml_parser=xml_parser_create($this->encode_type); 
      xml_set_object($this->xml_parser,&$this); 
      
xml_set_element_handler($this->xml_parser,"startElement","endElement"); 
      
xml_set_character_data_handler($this->xml_parser,"cdata"); 
      $this->depth=0; 
      $this->parent=array(); 
      $this->pobject=array(); 
		$this->$IMSError=array(); 
      xml_parse($this->xml_parser,$XMLText); 
      xml_parser_free($this->xml_parser); 
 
 
** here's the code I use to parse the 'LAYERINFO' tag: ** 
 
		case 'LAYERINFO': 
			//parent tag is always RESPONSE 
			$l = new arcLayer($attrs['ID'], 
$attrs['TYPE'], 
($attrs['NAME']?$attrs['NAME']:''),($attrs['MINSCALE']?$attrs['MINSCALE']:0),($attrs['MAXSCALE']?$attrs['MAXSCALE']:0), 
(strtolower($attrs['VISIBLE'])=='true'?1:0), 1); 
			if ($this->returnLayer($l->Name,$index)) { 
				if ($this->Layers[$index]->Service) { 
					$this->Layers[$index]=$l; 
					
$this->CurrentLayer=&$this->Layers[$index]; 
				} 
			}else{ 
				$this->Layers[]=$l; 
				
$this->CurrentLayer=&$this->Layers[count($this->Layers)-1]; 
			} 
			break;
 [2003-03-26 09:41 UTC] spoerri at duke dot edu
I'm sending you here only code snippets, in case you need 
the rest of the code let me know. Note: the code is 
embedded in the code for an object. 
 
** here's the code used to setup the parser: *** 
      
$this->xml_parser=xml_parser_create($this->encode_type); 
      xml_set_object($this->xml_parser,&$this); 
      
xml_set_element_handler($this->xml_parser,"startElement","endElement"); 
      
xml_set_character_data_handler($this->xml_parser,"cdata"); 
      $this->depth=0; 
      $this->parent=array(); 
      $this->pobject=array(); 
		$this->$IMSError=array(); 
      xml_parse($this->xml_parser,$XMLText); 
      xml_parser_free($this->xml_parser); 
 
 
** here's the code I use to parse the 'LAYERINFO' tag: ** 
 
		case 'LAYERINFO': 
			//parent tag is always RESPONSE 
			$l = new arcLayer($attrs['ID'], 
$attrs['TYPE'], 
($attrs['NAME']?$attrs['NAME']:''),($attrs['MINSCALE']?$attrs['MINSCALE']:0),($attrs['MAXSCALE']?$attrs['MAXSCALE']:0), 
(strtolower($attrs['VISIBLE'])=='true'?1:0), 1); 
			if ($this->returnLayer($l->Name,$index)) { 
				if ($this->Layers[$index]->Service) { 
					$this->Layers[$index]=$l; 
					
$this->CurrentLayer=&$this->Layers[$index]; 
				} 
			}else{ 
				$this->Layers[]=$l; 
				
$this->CurrentLayer=&$this->Layers[count($this->Layers)-1]; 
			} 
			break;
 [2003-03-26 09:52 UTC] iliaa@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


Unable to replicate the bug given the source code given.
 [2003-03-26 12:30 UTC] spoerri at duke dot edu
I compiled php-4.3.1 with debugging enabled and got the 
following error: 
 
Warning: String is not zero-terminated 
(Z???*?*ZZZZZZZZZ1 ) (source: 
/usr/src/php-4.3.1/Zend/zend_execute.c:446) in 
/var/www/obis_test/ims/phpConnector/phparcims.php on line 
1104
 [2003-03-26 12:45 UTC] iliaa@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


Please provide the shortest possible version of the code (that can be ran as is) as well as the xml data that causes the problem. Without it the problem cannot and will not be resolved.
 [2003-03-31 02:04 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 09 06:01:26 2024 UTC