Bug #75475 [Opn->Nab]: Libxml 2.9.6 breaks custom stream wrappers in XSLT
Edit report at https://bugs.php.net/bug.php?id=75475&edit=1
ID: 75475
Updated by: cmb@php.net
Reported by: alexey dot belkov at umisoft dot ru
Summary: Libxml 2.9.6 breaks custom stream wrappers in XSLT
-Status: Open
+Status: Not a bug
Type: Bug
Package: XSLT related
Operating System: macOS
PHP Version: 7.1.11
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
If the regression happened in libxml2 2.9.6 or 2.9.5, this doesn't
appear to be a PHP issue at all. If still relevant, consider to
file a bug report upstream[1].
[1] <http://xmlsoft.org/bugs.html>
Previous Comments:
------------------------------------------------------------------------
[2017-11-02 14:50:33] alexey dot belkov at umisoft dot ru
Description:
------------
I'm working on a CMS that uses custom stream wrappers extensively in XSL templates. We received
a bug report from one of our users who installed PHP with Homebrew on macOS, which includes the
newest version of libxml 2.9.6. For some reason, this particular version breaks all our XSL
templates, which worked fine on 2.9.4. (2.9.5 may also be broken but I didn't check this
myself.)
Here's essentially what's happening. We register a custom stream wrapper and use it in
XSLT to load external entities and include XSL files dynamically. The custom stream _works_ in the
main XSL template to load external entities, but it doesn't work inside <xsl:include>.
Also it doesn't work in the included XSL template to load external entities.
I reproduced this on a fresh PHP install from homebrew:
PHP Version 7.1.11
libxml Version 2.9.6
libxslt Version 1.1.29
libxslt compiled against libxml Version 2.9.4
Test script:
---------------
The whole thing: https://github.com/ltongues/cms2-2053
The main script:
include 'CustomStreamWrapper.php';
stream_wrapper_register('custom', 'CustomStreamWrapper');
$xml = new DOMDocument();
$xml->load('test.xml');
$xsl = new DOMDocument();
$xsl->resolveExternals = true;
$xsl->substituteEntities = true;
$xsl->load('main.xsl');
$proc = new XSLTProcessor();
$proc->importStyleSheet($xsl); // compilation error
Actual result:
--------------
1)
Warning: XSLTProcessor::importStylesheet(): compilation error: file
/Users/knots/Sites/cms2-2053/main.xsl line 20 element include in
/Users/knots/Sites/cms2-2053/index.php on line 15
Warning: XSLTProcessor::importStylesheet(): xsl:include : unable to load
custom://localhost/customInclude.xsl in /Users/knots/Sites/cms2-2053/index.php on line 15
2)
Warning: XSLTProcessor::importStylesheet(): compilation error: file
/Users/knots/Sites/cms2-2053/include.xsl line 16 element text in
/Users/knots/Sites/cms2-2053/index.php on line 15
Warning: XSLTProcessor::importStylesheet(): xsltParseTemplateContent: xslt:text content problem in
/Users/knots/Sites/cms2-2053/index.php on line 15
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75475&edit=1
Thread (2 messages)