php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14762 DTD entities freeze xmldocfile()
Submitted: 2001-12-30 04:19 UTC Modified: 2001-12-30 04:50 UTC
From: mark at chesneycorp dot com Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.1.1 OS: FreeBSD 4.5-PRERELEASE
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mark at chesneycorp dot com
New email:
PHP Version: OS:

 

 [2001-12-30 04:19 UTC] mark at chesneycorp dot com
The XML document site.xml causes test.php to freeze:

site.xml:
---
<?xml version="1.0"?>
<!DOCTYPE site [
<!ENTITY reg "&#174;">
]>
<site>
	<title>Don't Be Dirty&reg;</title>
</site>
---

test.php:
---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Untitled</title>
</head>
<body>
<?php
error_reporting(E_ALL);
$doc = xmldocfile("site.xml");
print "\$doc: ";
print_r($doc);
print "<br>";
$context = $doc->xpath_new_context();
print "\$context: ";
print_r($context);
?>
</body>
</html>
---

This version of site.xml yeilded expected output:

site.xml:
---
<?xml version="1.0"?>
<!DOCTYPE site [
]>
<site>
	<title>Don't Be Dirty</title>
</site>
---

output:
---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Untitled</title>
</head>
<body>
$doc: DomDocument Object
(
    [name] => 
    [url] => site.xml
    [version] => 1.0
    [standalone] => -1
    [type] => 9
    [compression] => -1
    [charset] => 1
    [0] => 1
    [1] => 136235776
    [doc] => Resource id #673363016
)
<br>$context: XPathContext Object
(
    [0] => 2
    [1] => 136235904
)
</body>
</html>
---

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-30 04:50 UTC] mfischer@php.net
This has been fixed in CVS already, unfortunately the fix didn't make it into the release.

Thanks for the report. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 18:01:28 2024 UTC