php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23889 xslt transform stop working after upgrade from 4.2.3 into 4.3.2
Submitted: 2003-05-30 03:45 UTC Modified: 2004-02-08 11:20 UTC
From: sitnikov at infonet dot ee Assigned: msopacua (profile)
Status: Closed Package: XSLT related
PHP Version: 4.3.3RC4-dev OS: Linux
Private report: No CVE-ID: None
 [2003-05-30 03:45 UTC] sitnikov at infonet dot ee
After upgrade PHP from 4.2.3 into 4.3.2 xslt transformation stop working.

1.php (not working)
<? 

// Allocate a new XSLT processor 
$xh = xslt_create() or die('Can not do; xslt_create()'); 

$arguments = array( 
    '/_xml' => file_get_contents('xml/1.xml'), 
    '/_xsl' => file_get_contents('xsl/1.xsl'), 
); 

// Process the document 
if ( $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments) ) { 
    print "SUCCESS, test.xml was transformed by test.xsl into result.xml"; 
    print ", result.xml has the following contents\n<br>\n"; 
    print "<pre>\n"; 
    echo $result; 
    print "</pre>\n"; 
} 
else { 
    print "Sorry, test.xml could not be transformed by test.xsl into"; 
    print "  result.xml the reason is that " . xslt_error($xh) . " and the "; 
    print "error code is " . xslt_errno($xh); 
} 

xslt_free($xh); 
?> 

2.php - working
<? 

// Allocate a new XSLT processor 
$xh = xslt_create() or die('Can not do; xslt_create()'); 

$arguments = array( 
    '/_xml' => file_get_contents('xml/1.xml'), 
); 

// Process the document 
if ( $result = xslt_process($xh, 'arg:/_xml', 'xsl/1.xsl', NULL, $arguments) ) { 
    print "SUCCESS, test.xml was transformed by test.xsl into result.xml"; 
    print ", result.xml has the following contents\n<br>\n"; 
    print "<pre>\n"; 
    echo $result; 
    print "</pre>\n"; 
} 
else { 
    print "Sorry, test.xml could not be transformed by test.xsl into"; 
    print "  result.xml the reason is that " . xslt_error($xh) . " and the "; 
    print "error code is " . xslt_errno($xh); 
} 

xslt_free($xh); 
?> 

Test full suite: http://si.infonet.ee/sablot.rar
xml & xsl you can see in rar file.

after some research i found what problem in http://cvs.php.net/diff.php/php4/ext/xslt/sablot.c?login=2&r1=1.63&r2=1.64&ty=u patch.

after removing this patch my code again work.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-06 02:29 UTC] sniper@php.net
Melvyn, you broke it, you fix it. :)

 [2003-06-06 14:20 UTC] msopacua@php.net
Check bug http://bugs.php.net/20177 (which is mentioned in the commit).

Before the fix of that bug, many people complained. After - you're the only one of seen. You also have a work-around: set xslt_set_base hardcoded yourself, then the library doesn't (see http://bugs.php.net/20518 ).
If you could make the 'full test suite' available in zip or tar/gz, then I'll look into your scenario, to see how common it is and perhaps look for an option to set via xslt_set_option. Either way - you'll probably have to recode.
 [2003-06-16 05:22 UTC] sitnikov at infonet dot ee
"full test suite"
http://si.infonet.ee/sablot.tar.gz
 [2003-08-09 10:43 UTC] sniper@php.net
Is this still a problem..?

 [2003-08-09 11:01 UTC] sitnikov at infonet dot ee
Yes, problem still exists with 4.3.3RC3

This problem will appear if xsl contains: <xsl:variable name="sort-images" select="document('')/xsl:stylesheet/xxxx"/> and sablot try parse not current xsl, but it parse current PHP file as xsl

Workaroud for this problem use xslt_set_base($xh,''); before xslt_process().
 [2003-08-09 11:27 UTC] sniper@php.net
Assigning back to Melvyn who should fix this BC breakage or document it at least..

 [2004-02-08 11:20 UTC] sniper@php.net
There is a workaround and there's new extension in PHP 5 -> closing.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 19:01:29 2024 UTC