Bug #10994 [Com]: DOMXML CDATA Node Bug

From: Date: Mon, 29 Aug 2011 09:01:23 +0000
Subject: Bug #10994 [Com]: DOMXML CDATA Node Bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-163093@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=10994&edit=1

 ID:                 10994
 Comment by:         qing0088 at hotmail dot com
 Reported by:        dennis at svitonline dot com
 Summary:            DOMXML CDATA Node Bug
 Status:             Closed
 Type:               Bug
 Package:            DOM XML related
 Operating System:   Winnt
 PHP Version:        4.0.5
 Block user comment: N
 Private report:     N

 New Comment:

http://www.officialbuffalobillsshop.com/ryan-fitzpatrick-jersey-c-13_32.html	Ryan
Fitzpatrick Jersey
http://www.officialbuffalobillsshop.com/steve-johnson-jersey-c-13_30.html	Stevie
Johnson Jersey
http://www.officialbuffalobillsshop.com/thurman-thomas-jersey-c-13_21.html	Thurman
Thomas Throwback Jersey


Previous Comments:
------------------------------------------------------------------------
[2001-12-01 14:46:15] mfischer@php.net

Should be fixed in CVS. Closing.

------------------------------------------------------------------------
[2001-11-30 21:00:47] mfischer@php.net

Update: Fix is coming, assigned to me.

Btw, the syntax has changed since then, you'll have to use:

  print_r($arr[2]->children());

to see your CDATA node then.


------------------------------------------------------------------------
[2001-11-22 03:36:00] mfischer@php.net

Can you try with latest RC and see if it works

http://www.php.net/~zeev/php-4.1.0RC3.tar.gz

Feedback.


------------------------------------------------------------------------
[2001-05-21 13:49:12] dennis at svitonline dot com

Hello Dear PHP Support.
I have compatability problem with PHP 4.04 - PHP 4.05, exactly in DOMXML (i mean) module.

This is piece of my code:

-------------------------------------------------------------

<?

	function XML_Def_Parse($xml_file) {

	  $doc = xmldoc(join("", file($xml_file)) );  
	  $ctx = xpath_new_context($doc );  
	
	  //
	
	
	  $doc_vars = xml_parse_vars($ctx, "//DOC/VAR");  	
	        
	  $obj = xpath_eval($ctx, "//DOC/BLOCKS/BLOCK");
	  $arr = $obj->nodeset;
	    
	  
	    for($block_n=1; $block_n<sizeof($arr)+1; ++$block_n) {
	            
	  	$block_vars = xml_parse_vars($ctx, "//DOC/BLOCKS/BLOCK[$block_n]/VAR");
		  	  	  	
	  	
	  
	  	  	
	   	
	  	$obj2 = xpath_eval($ctx, "//DOC/BLOCKS/BLOCK[$block_n]/BLOCKSET");
	 	$arr2 = $obj2->nodeset; 
	  	
			
			for($blockset_n=1; $blockset_n<sizeof($arr2)+1; ++$blockset_n) {
			
			$myobj = xpath_eval($ctx, "//DOC/BLOCKS/BLOCK[$block_n]/BLOCKSET[$blockset_n]");		
			$myarr = $myobj->nodeset;
			
			$blockset_type = $myarr[0]->getattr("type");
							
			//						
					
			$obj3 = xpath_eval($ctx,
"//DOC/BLOCKS/BLOCK[$block_n]/BLOCKSET[$blockset_n]/BLOCKSETELEMENT");
			$arr3 = $obj3->nodeset; 
	  	
	  			$blocksetelements = array();
	  	
	  			for($blocksetelement_n=1; $blocksetelement_n<sizeof($arr3)+1; ++$blocksetelement_n) {
	  				  	  				  	
	  					$blocksetelement_vars = xml_parse_vars($ctx,
"//DOC/BLOCKS/BLOCK[$block_n]/BLOCKSET[$blockset_n]/BLOCKSETELEMENT[$blocksetelement_n]/VAR");
				  				  		
						$blocksetelements[] = $blocksetelement_vars;
		  				
				}
			
			
			//$blocksets[$blockset_type] =
array(array("sa"=>"as"),array("s2"=>"a2"));
			
			$blocksets[$blockset_type] = $blocksetelements;
				
			}
	  			
	  	
	
		
	  	$blocks[] = array_merge($block_vars, $blocksets);
	
	 	}		



	$blocks_arr = array("BLOCKS"=>$blocks);
	$doc_v = array_merge($doc_vars, $blocks_arr);
			
	}
	

	
	
	function xml_parse_vars($ctx,$path) {

	  $obj = xpath_eval($ctx, $path);
	  $arr = $obj->nodeset;

	  if($path == "//DOC/BLOCKS/BLOCK[1]/BLOCKSET[2]/BLOCKSETELEMENT[1]/VAR") {
	  print_r($arr);
	  }
	      
	  	for($x=0; $x<sizeof($arr); ++$x) {
	
			$name  = $arr[$x]->getattr("name");
			$value = $arr[$x]->content;
	              
	                $results[$name] = $value;
	                  		
	  		}
	     	
	  return $results;
	  		
	 } //function


XML_Def_Parse("kulichki.xml");

?>

-------------------------------------------------------

This is "kulichki.xml":

------------------------------------------------------


<?xml version="1.0"?>

<DOC version="1.0" copyright="(c) Denis Torbichuk, 2000">
	
	<VAR name="DOC_CODE">KULICHKI.TV</VAR>
	<VAR name="DOC_DESC">Ïðîãðàììà òåëåïåðåäà÷ íà
Kulichki</VAR>
	<VAR name="DOC_URL">tv6.htm</VAR>
	
	
	<BLOCKS>	
		
	  <BLOCK number="1">
		
		<VAR name="BLOCK_DESC">Îáùèé áëîê</VAR>
		<VAR name="BLOCK_BEGIN"></VAR>
		<VAR name="BLOCK_END"></VAR>
		
			
			<BLOCKSET type="SINGLE">
			</BLOCKSET>
		
		
			<BLOCKSET type="MULTIPLE">
			
				<BLOCKSETELEMENT>

<!--
<P><FONT SIZE=+2><B>Ïîíåäåëüíèê. 09 Àïðåëÿ. 41
ÊÀÍÀË<br></B></FONT><HR>
-->
				
				<VAR name="EL_DESC">Êàíàë/äåíü</VAR>
	
				<VAR name="EL_PATTERN_BEGIN"/>
				<VAR name="EL_PATTERN"><![CDATA[<P>.*?<FONT.*?><B>{%%:day}.
{%%:day} {%%:month}.
{%%:channel}<br>.*?<HR>.*?<pre>{%%:programs}</pre>]]></VAR>
				<VAR name="EL_PATTERN_END"/>
				
				</BLOCKSETELEMENT>
												
			
			</BLOCKSET>		
		
		
		</BLOCK>
	
	
	
	
	
	</BLOCKS>



</DOC>

-----------------------------------------------------


This script output in PHP 4.04 (it is right):

X-Powered-By: PHP/4.0.4
Content-type: text/html

Array
(
    [0] => DomNode Object
        (
            [type] => 1
            [name] => VAR
            [content] => Êàíàë/äåíü
            [node] => Resource id #24
        )

    [1] => DomNode Object
        (
            [type] => 1
            [name] => VAR
            [node] => Resource id #25
        )

    [2] => DomNode Object
        (
            [type] => 1
            [name] => VAR
            [content] => <P>.*?<FONT.*?><B>{%%:day}. {%%:day} {%%:month}.
{%%:channel}<br>.*?<HR>.*?<pre>{%%:programs}</pre>
            [node] => Resource id #26
        )

    [3] => DomNode Object
        (
            [type] => 1
            [name] => VAR
            [node] => Resource id #27
        )

)


But this is output from PHP 4.05 (it is wrong):

X-Powered-By: PHP/4.0.5
Content-type: text/html

Array
(
    [0] => DomNode Object
        (
            [type] => 1
            [name] => VAR
            [content] => Êàíàë/äåíü
            [node] => Resource id #24
        )

    [1] => DomNode Object
        (
            [type] => 1
            [name] => VAR
            [content] => 
            [node] => Resource id #25
        )

    [2] => DomNode Object
        (
            [type] => 1
            [name] => VAR
            [content] => 
            [node] => Resource id #26
        )

    [3] => DomNode Object
        (
            [type] => 1
            [name] => VAR
            [content] => 
            [node] => Resource id #27
        )

)

-----

As you see my CDATA node content is empty in PHP 4.05 case.
Why? It is bug?
When I insert text in node instead CDATA it is works.
Can you explain me problem?

P.S. I'm using PHP 4.04 & PHP 4.05 on WinNT (W2k) platform.

Thanks.

Sincerely yours,
Denis Torbichuk.
dennis@svitonline.com


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=10994&edit=1


Thread (1 message)

  • qing0088 at hotmail dot com
  • Unknown Message
    • qing0088 at hotmail dot com
« previous php.bugs (#163093) next »