Edit report at http://bugs.php.net/bug.php?id=51897&edit=1

 ID:               51897
 Updated by:       rricha...@php.net
 Reported by:      rquadl...@php.net
 Summary:          LIBXML_NOWARNING does not suppress warnings when
                   passed to xinclude().
-Status:           Feedback
+Status:           Bogus
 Type:             Bug
 Package:          DOM XML related
 Operating System: Windows XP SP3
 PHP Version:      5.3.2
 Assigned To:      rrichards

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

the underlying xinclude code is not checking those options when issuing
warnings 

so needs to be fixed on the libxml2 layer. You either need to surpress
warnings 

for that call or use internal error handling so they are not directly
issued to 

output/log.


Previous Comments:
------------------------------------------------------------------------
[2010-06-21 13:05:51] rquadl...@php.net

OOI, this code is using ...





PHP 5.3.3-RC1 (cli) (built: Jun 17 2010 22:43:29)

Copyright (c) 1997-2010 The PHP Group

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies



and



Extension [ <persistent> extension #23 libxml version <no_version> ] {



  - Constants [22] {

    Constant [ integer LIBXML_VERSION ] { 20707 }

    Constant [ string LIBXML_DOTTED_VERSION ] { 2.7.7 }

    Constant [ string LIBXML_LOADED_VERSION ] { 20707 }

------------------------------------------------------------------------
[2010-06-21 13:04:52] rquadl...@php.net

This is about as short as I can get. I can't work out how to get the
xinclude 

working in this 

example, but that is not the issue. The warning that is generated is the
issue. 

Only the code 

below is required - no PHPDoc or DocBook, etc.





<?php

file_put_contents('my.dtd', <<< END_DTD

<!ENTITY % db.common.attributes

  "xml:id ID #IMPLIED">

<!ENTITY % db.common.linking.attributes

  "xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'">

<!ELEMENT people_list (person*)>

<!ATTLIST people_list

  %db.common.attributes;

  %db.common.linking.attributes;>

<!ELEMENT person (name, birthdate?, gender?, socialsecuritynumber?)>

<!ATTLIST person

  %db.common.attributes;

  %db.common.linking.attributes;>

<!ELEMENT name (#PCDATA)>

<!ELEMENT birthdate (#PCDATA)>

<!ELEMENT gender (#PCDATA)>

<!ELEMENT socialsecuritynumber (#PCDATA)>

END_DTD

);



file_put_contents('my.xml', <<< END_XML

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE people_list SYSTEM "my.dtd">

<people_list xmlns:xi="http://www.w3.org/2001/XInclude";>

  <person xml:id="fred">

    <name>Fred Bloggs</name>

    <birthdate>27/11/2008</birthdate>

    <gender>Male</gender>

  </person>

  <person xml:id="john">

    <name>John Bloggs</name>

    <gender>Male</gender>

    <!-- Include fred's birthdate -->

    <xi:include xpointer="xmlns(db=my.dtd)
xpointer(id('fred')/db:birthdate)">

      <xi:fallback />

    </xi:include>

  </person>

</people_list>

END_XML

);



echo

  file_get_contents('my.dtd'), PHP_EOL, PHP_EOL,

  file_get_contents('my.xml'), PHP_EOL, PHP_EOL;



$doc = new DOMDocument();

$doc->load('my.xml', LIBXML_NOENT);

var_dump($doc->xinclude(LIBXML_NOWARNING));

var_dump($doc->validate());

$doc->save('final.xml');



echo PHP_EOL, file_get_contents('final.xml');



unlink('final.xml');

unlink('my.dtd');

unlink('my.xml');

?>



Other than the XML and the DTD, the output is ...



Warning: DOMDocument::xinclude(): XPointer evaluation failed:
#xmlns(db=my.dtd) 

xpointer(id('fred')/db:birthdate) in Z:\testinc.php on line 49

int(-1)

bool(true)



The Warning is present, even though LIBXML_NOWARNING is present. I
believe that 

the issue is 

that xinclude processing doesn't look at the same flags as the xml
parser. But 

that's just a 

half-arsed guess at trying to read the c code of something I'm clearly
not 

understanding 100%



Richard.

------------------------------------------------------------------------
[2010-06-18 20:19:45] rricha...@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.

please submit a test case that doesnt require phpdoc to be pulled

------------------------------------------------------------------------
[2010-05-24 12:35:56] rquadl...@php.net

Description:
------------
This issue is in relation to http://news.php.net/php.doc/969381854



Trying to standardise the documentation in relation to including class
synopsis, 

I'm including constructor and destructor synopsis via an xinclude with
an 

pointer and a xfallback...



    <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.datetime')/db:refentry/db:refsec...@role='description']/desce

ndant::db:destructorsynopsis[not(@role='procedural')])">

     <xi:fallback />

    </xi:include>



As there is no destructor for datetime, the fallback is used (which is
empty).



All would seem to be well.



The problem is that the xinclude processing generates a warning when
using the 

online documentation editor - but not when I run this locally via
phpdoc's 

configure.



I've been supplied a test script (http://news.php.net/php.doc/969381870)
which 

will generate the errors locally.



And so to the bug.



In the example the xinclude() call has no parameters.



Supplying LIBXML_NOWARNING does _NOT_ suppress the warnings.



To run the test script, you will need the doc-base/manual.xml file
produced by 

running the doc-base/configure.php script (part of PHPDoc).

Test script:
---------------
<?php

$doc = new DOMDocument();

$doc->load('doc-base/manual.xml', LIBXML_NOENT);

var_dump($doc->xinclude(LIBXML_NOWARNING));

var_dump($doc->validate());

?>

Expected result:
----------------
int(-1)

bool(true)

Actual result:
--------------
Warning: DOMDocument::xinclude(): XPointer evaluation failed: 

#xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.datetime')/db:refentry/db:refsec...@role='description']/desce

ndant::db:destructorsynopsis[not(@role='procedural')]) in - on line 4



Warning: DOMDocument::xinclude(): XPointer evaluation failed: 

#xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.datetimezone')/db:refentry/db:refsec...@role='description']/d

escendant::db:destructorsynopsis[not(@role='procedural')]) in - on line
4



Warning: DOMDocument::xinclude(): XPointer evaluation failed: 

#xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.dateinterval')/db:refentry/db:refsec...@role='description']/d

escendant::db:destructorsynopsis[not(@role='procedural')]) in - on line
4



Warning: DOMDocument::xinclude(): XPointer evaluation failed: 

#xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.dateperiod')/db:refentry/db:refsec...@role='description']/des

cendant::db:destructorsynopsis[not(@role='procedural')]) in - on line 4



Warning: DOMDocument::xinclude(): XPointer evaluation failed: 

#xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.dateperiod')/db:refentry/db:refsec...@role='description']/des

cendant::db:methodsynopsis[not(@role='procedural')]) in - on line 4

int(-1)

bool(true)


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



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

Reply via email to