php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46827 disappearing xi:include tags?
Submitted: 2008-12-11 00:29 UTC Modified: 2009-05-03 01:00 UTC
Votes:12
Avg. Score:4.4 ± 0.9
Reproduced:7 of 7 (100.0%)
Same Version:3 (42.9%)
Same OS:2 (28.6%)
From: danny at isratrade dot co dot il Assigned:
Status: No Feedback Package: DOM XML related
PHP Version: 5.2.8 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: danny at isratrade dot co dot il
New email:
PHP Version: OS:

 

 [2008-12-11 00:29 UTC] danny at isratrade dot co dot il
Description:
------------
I'm trying to include all the xi:include tags in a file but PHP seems 
to just ignore some of them. 

I'm using XML's that are known to work 100%. You can see the XML 
files here:
http://postbooks.svn.sourceforge.net/viewvc/postbooks/xtupledocs/trun
k/referenceguide.tar.gz?view=tar

Basically the problematic file is products.xml which is included from 
referenceguide.xml and contains more includes. They all get ignored.

Reproduce code:
---------------
...
echo "Importing XML document...\n";
	$document = new DOMDocument();
	$document->load( DOCBOOK_PATH );
	
	echo "Parsing <xi:include> tags...\n";
	xinclude_all( $document );
...

	function xinclude_all( &$document ){
		$counter = 0;

		$xpath = new DOMXPath($document);
		$xpath->registerNamespace('xi', $ns = 'http://www.w3.org/2001/XInclude');
		$includes = $xpath->query( "//xi:include" );
		
		while($includes->length){			
			$counter++;
			echo "Parsing <xi:include> layer number $counter. {$includes->length} <xi:include> tags on this layer. ";
			$document->xinclude();
			$includes = $xpath->query( "//xi:include" );
			echo "{$includes->length} includes to process on next layer\n";
		}
		
		echo "$counter <xi:include> tag levels parsed.\n";
	}


Expected result:
----------------
I expect all the includes to be parsed and included.

Actual result:
--------------
Only the 12 includes in the main referenceguide.xml file get 
included, then it just says that there is no need to further include 
as if there were 0 more includes in the DOM tree.
But the included data isn't there.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-11 00:57 UTC] danny at isratrade dot co dot il
I read the manual page about this function and a comment there 
suggests to just call xinclude() multiple times.

As a test, I've also tried just calling "$document->xinclude();" a 
bunch of times instead of doing the search/loop.\

So even if all that code is replaced by:
			$document->xinclude();
			$document->xinclude();
			$document->xinclude();
It still doesn't include these other includes.
 [2009-04-25 14:07 UTC] jani@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2009-05-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC