Bug #75475 [NEW]: Libxml 2.9.6 breaks custom stream wrappers in XSLT

From: Date: Thu, 02 Nov 2017 14:50:41 +0000
Subject: Bug #75475 [NEW]: Libxml 2.9.6 breaks custom stream wrappers in XSLT
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212408@lists.php.net to get a copy of this message
From:             alexey dot belkov at umisoft dot ru
Operating system: macOS
PHP version:      7.1.11
Package:          XSLT related
Bug Type:         Bug
Bug description:Libxml 2.9.6 breaks custom stream wrappers in XSLT

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 bug report at https://bugs.php.net/bug.php?id=75475&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=75475&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=75475&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=75475&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=75475&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=75475&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=75475&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=75475&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=75475&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=75475&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=75475&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=75475&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=75475&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=75475&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75475&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=75475&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=75475&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=75475&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75475&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=75475&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=75475&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#212408) next »