php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67012 Percent sign within NOTATION is incorrectly parsed as a parameter entity refere
Submitted: 2014-04-03 17:35 UTC Modified: 2014-04-05 16:49 UTC
From: petrhudecek2010 at gmail dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.5.11 OS: Windows
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: petrhudecek2010 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-04-03 17:35 UTC] petrhudecek2010 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/class.domdocumenttype
---
The string 

<!NOTATION image SYSTEM "%SYSTEMROOT%/paint.exe">

causes a libxml error.
Per the XML specification, a parameter entity reference cannot be recognized inside a SystemLiteral. The percent sign itself is permitted in the NOTATION.

4.4
Reference in DTD
as a reference within either the internal or external subsets of the DTD, but outside of an EntityValue, AttValue, PI, Comment, SystemLiteral, PubidLiteral, or the contents of an ignored conditional section (see 3.4 Conditional Sections).

2.3
[11]   	SystemLiteral	   ::=   	('"' [^"]* '"') | ("'" [^']* "'")

Test script:
---------------
$xmlDom = new DOMDocument();
$xmlDom->load("test.xml", LIBXML_DTDLOAD | LIBXML_DTDVALID | LIBXML_NOENT);

test.xml:
<?xml version="1.0" ?>
<!DOCTYPE root SYSTEM "test.dtd">
<root />

test.dtd:
<!ELEMENT root EMPTY>
<!NOTATION image SYSTEM "%SYSTEMROOT%/paint.exe">

Expected result:
----------------
No LIBXML error is generated and the document is correctly parsed and loaded.

Actual result:
--------------
Warning: DOMDocument::load(): PEReference: expecting ';' in file:///D:/XAMPP/htdocs/preview/tests/test.dtd, line: 2 in D:\XAMPP\htdocs\preview\tests\test.php on line 49

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-05 16:49 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2014-04-05 16:49 UTC] ab@php.net
$ xmllint --noout --dtdvalid --loaddtd test.xml
test.dtd:2: parser error : PEReference: expecting ';'
<!NOTATION image SYSTEM "%SYSTEMROOT%/paint.exe">

Getting this on your test XML code with libxml 2.9.1 . So looks like you could file a bug against libxml2 as this is not a PHP bug.

Thanks for reporting.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 16:01:31 2024 UTC