From: dandrikop at cosmote dot gr
Operating system: Fedora Core 5
PHP version: 5.1.5
PHP Bug Type: DOM XML related
Bug description: Can't resolve external character entities
Description:
------------
The PHP DOM extension cannot resolve entities declared in an external DTD
file.
Reproduce code:
---------------
<?php
$imp = new DOMImplementation();
$dtd = $imp->createDocumentType( 'clickAPI', null,
'clickatell.dtd' );
$xml_request = $imp->createDocument( null, null, $dtd );
$xml_request->version = '1.0';
$xml_request->encoding = 'ISO-8859-1';
$xml_request->formatOutput = true;
$xml_request->resolveExternals = true;
$xml_request->substituteEntities = true;
$xml_request->standalone = false;
// Create the tag 'clickAPI'.
$clickAPI = $xml_request->appendChild( new DOMElement( 'clickAPI'
) );
// Create the tag 'sendMsg'.
$sendMsg = $clickAPI->appendChild( new DOMElement( 'sendMsg' )
);
// Add elements under the 'auth' tag.
$sendMsg->appendChild( new DOMElement( 'session_id',
'aaaaaaaaaaaaaaaaa' ) );
$sendMsg->appendChild( new DOMElement( 'text', "Test &testme;" )
);
$sendMsg->appendChild( new DOMElement( 'to', '306978888888' )
);
if( $xml_request->validate() ){
echo "OK\n";
} else {
echo "Not OK!\n";
}
echo "\n" . $xml_request->saveXML() . "\n";
?>
Expected result:
----------------
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE clickAPI SYSTEM "clickatell.dtd">
<clickAPI>
<sendMsg>
<session_id>aaaaaaaaaaaaaaaaa</session_id>
<text>Test HELLO</text>
<to>306978888888</to>
</sendMsg>
</clickAPI>
Actual result:
--------------
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE clickAPI SYSTEM "clickatell.dtd">
<clickAPI>
<sendMsg>
<session_id>aaaaaaaaaaaaaaaaa</session_id>
<text>Test &testme;</text>
<to>306978888888</to>
</sendMsg>
</clickAPI>
--
Edit bug report at http://bugs.php.net/?id=38580&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38580&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38580&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38580&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38580&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38580&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38580&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38580&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38580&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38580&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38580&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38580&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38580&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38580&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38580&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38580&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38580&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38580&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38580&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38580&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38580&r=mysqlcfg