php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48109 DOM interpolates specific entities (&apos and &quot)
Submitted: 2009-04-29 13:55 UTC Modified: 2009-04-29 14:33 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: robin dot mehner at freak-company dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.2.9 OS: MacOSX / Debian Linux
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: robin dot mehner at freak-company dot com
New email:
PHP Version: OS:

 

 [2009-04-29 13:55 UTC] robin dot mehner at freak-company dot com
Description:
------------
DomDocument interpolates the ' and " entities to their values 
(' and "). Other entities like > etc. are displayed as is.

Tested with php version 5.2.6 (self-compiled under debian), 5.2.9 and 
5.3RC1 on MacOSX. Further version infos can be posted if needed.

Reproduce code:
---------------
<?php

// create document (keep it simple)
$domImp = new DomImplementation();
$dom = $domImp->createDocument(null, 'root');

// create element
$foo = $dom->createElement('foo', '&apos; &quot;'); // bug here
$dom->documentElement->appendChild($foo);

echo $dom->saveXML();

Expected result:
----------------
<?xml version="1.0"?>
<root><foo>&apos; &quot;</foo></root>

Actual result:
--------------
<?xml version="1.0"?>
<root><foo>' "</foo></root>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-29 13:58 UTC] robin dot mehner at freak-company dot com
phpt for this bug can be found at: 
http://friendpaste.com/2jrhQQ0OzJosv243FDwyGe

Hope this helps.
 [2009-04-29 14:33 UTC] rrichards@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Handling of those pre-defined entities is dependent upon the XMl parser 
and that is how libxml handles them.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 09:01:33 2025 UTC