ID:               42050
 User updated by:  andrew at gencon dot co dot uk
 Reported By:      andrew at gencon dot co dot uk
 Status:           Open
-Bug Type:         DOM XML related
+Bug Type:         XML related
 Operating System: Linux 2.6.20 Debian testing
 PHP Version:      5CVS-2007-07-19 (snap)
 New Comment:

Reclassified bug as DOM XML seems to relate more to the PHP4 extension.


Previous Comments:
------------------------------------------------------------------------

[2007-07-19 16:22:35] andrew at gencon dot co dot uk

Description:
------------
When using PHP5 DOM extension relative DTDs specified on a Doctype that
go through a symlink are resolved using (what appears to be) the
canonicalized absolute pathname. This means that relative paths like
../dtd/test.dtd are relative to the path the symlink points to and not
relative to the symlink itself. This means you cannot use normal symlink
'shenanigans' to work around some limitations of DTDs.

Behaviour of sample xml and dtd files tested with PHP4 (4.4.4-9) PHP5
(5.2.0-10 and 5.2.3-1), xmllint using: --loaddtd --noent and rxp.

Snapshot compiled using a simple ./configure and make no options or
flags used. Ran using php5.2-200707191430/sapi/cli/php

Same behavior is also seen using relative DTDs and symlinks in XSLT
files and PHP5.

Reproduce code:
---------------
Sample code for PHP4 and PHP5 with xml and dtd files can be downloaded
from here:

http://www.gencon.co.uk/php_bug_reporting/gencon_php_bug_examples.tgz

In the results below test 1 is not using the symlink and test 2 is
using the symlink.

Expected result:
----------------
Expected to see this output (from PHP4 sample included):

Test XML1:

<?xml version="1.0"?>
<!DOCTYPE doc SYSTEM "../dtd/test.dtd">
<doc><test>a</test></doc>

Test XML2:

<?xml version="1.0"?>
<!DOCTYPE doc SYSTEM "../dtd/test.dtd">
<doc><test>a</test></doc>



Actual result:
--------------
Actually saw this output (any PHP5 version):

Test XML 1:

<?xml version="1.0"?>
<!DOCTYPE doc SYSTEM "../dtd/test.dtd">
<doc><test>a</test></doc>

Test XML 2:

<?xml version="1.0"?>
<!DOCTYPE doc SYSTEM "../dtd/test.dtd">
<doc><test>b</test></doc>

Notice the very last line is now a 'b' and not an 'a' because it has
picked up the wrong DTD defining the entity.


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


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

Reply via email to