php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11440 PHP Seg faults with xslt_output_begintransform("xsl_file");
Submitted: 2001-06-12 13:08 UTC Modified: 2001-07-30 18:39 UTC
From: micah at auctionservices dot com Assigned:
Status: Closed Package: Sablotron XSL
PHP Version: 4.0 Latest CVS (2001-06-12) OS: Linux Mandrake 8.0
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: micah at auctionservices dot com
New email:
PHP Version: OS:

 

 [2001-06-12 13:08 UTC] micah at auctionservices dot com
-------------------
System:
-------------------
Linux Mandrake 8.0
Apache 1.3.19
PHP 4.0.6 RC3 (as DSO)
Sablot 0.52
libxml2.3.10
expat 1.95.1

--------------------
Compile options
--------------------
./configure \
--mandir=/usr/share/man \
--with-apxs=/usr/local/apache/bin/apxs \
--with-config-file-path=/etc/httpd \
--enable-magic-quotes \
--enable-bcmath \
--enable-calendar \
--with-dom=/usr/local \
--with-zlib-dir \
--enable-ftp \
--enable-gd-native-ttf \
--with-mysql=/usr/local/mysql \
--with-pgsql=/usr/local/pgsql \
--with-expat-dir=/usr/local \
--with-sablot=/usr/local \
--enable-trans-sid \
--with-regex=system \
--with-swf=/usr/local/openswf \
--enable-wddx \
--enable-memory-limit \
--with-gnu-ld \
--with-gd=/usr/local \
--with-jpeg-dir=/usr/local \
--with-png=/usr/local \
--with-freetype=/usr/local/include/freetype2

----------------------
Back Trace
----------------------
(gdb) run -X
Starting program: /usr/local/apache/bin/httpd -X

Program received signal SIGSEGV, Segmentation fault.
0x403c3ee2 in Processor::useArg (this=0x8121f68, name=0xcc4a090 <Address 0xcc4a090 out of bounds>,
    val=0x40322b84 "?A\024") at proc.cpp:1077
1077        if (*name != '/')
Current language:  auto; currently c++
(gdb) bt
#0  0x403c3ee2 in Processor::useArg (this=0x8121f68, name=0xcc4a090 <Address 0xcc4a090 out of bounds>,
    val=0x40322b84 "?A\024") at proc.cpp:1077
#1  0x403c4954 in SablotRunProcessor (processor_=0x8121f68, sheetURI=0x80d9b1c "index.xsl",
    inputURI=0x402ee293 "arg:/_xmlinput", resultURI=0x402ee286 "arg:/_output", params=0x0, arguments=0xbfffdbd0)
    at sablot.cpp:144
#2  0x4026de47 in php_if_xslt_output_endtransform (ht=0, return_value=0x8120afc, this_ptr=0x0, return_value_used=0)     at sablot.c:322
#3  0x4021a10c in execute (op_array=0x811e51c) at ./zend_execute.c:1504
#4  0x40228a4d in zend_execute_scripts (type=8, file_count=3) at zend.c:749
#5  0x4023af64 in php_execute_script (primary_file=0xbffff560) at main.c:1206
#6  0x4023757e in apache_php_module_main (r=0x8119684, display_source_mode=0) at sapi_apache.c:89
#7  0x40237fbc in send_php (r=0x8119684, display_source_mode=0, filename=0x0) at mod_php4.c:536
#8  0x40237ff3 in send_parsed_php (r=0x8119684) at mod_php4.c:547
#9  0x0805b797 in ap_invoke_handler ()
#10 0x0807029b in process_request_internal ()
#11 0x08070310 in ap_process_request ()
#12 0x080673b2 in child_main ()
#13 0x08067564 in make_child ()
#14 0x080676d8 in startup_children ()
#15 0x08067d57 in standalone_main ()
#16 0x0806858f in main ()
#17 0x400970de in __libc_start_main () from /lib/libc.so.6

--------------------------
All files PHP has contact with
--------------------------
################
index.php
################
<?php
$xmlData2 = '<?xml version="1.0"?>
<page>
<html_header>
	<html_title>This is a test of the multi-template</html_title>
	<html_body bgcolor="bgcolor=\'#000066\'" />
</html_header>
<article>
	<title>How &#60;u>NOT&#60;/u> to a B millionare</title>
	<author>Micah Almond</author>
	<first>Micah</first>
	<second>Almond</second>
	<body>This is the body of the document</body>
	<form>&#60;input type="text" value="Test of form" /></form>
	<form2>Test of Form 2</form2>
	<auction_state state_abbrev="VA">Virginia</auction_state>
</article>
</page>';

  $xsl_file = "index.xsl"; 
  xslt_output_begintransform($xsl_file);
   print($xmlData2);
   xslt_output_endtransform();
?>

################
index.xsl
################
<?xml version='1.0'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='html' />
<xsl:include href='form.xsl' />

<xsl:template name='prod_cells'>
	<xsl:param name='count' />
	<xsl:if test='$count != 0'>
		<td>Table Cell</td>
		<xsl:call-template name='prod_cells'>
			<xsl:with-param name='count' select='$count - 1' />
		</xsl:call-template>
	</xsl:if>
</xsl:template>
<xsl:template match='page'>
<html>
<body>
<form method='post'>
	<xsl:apply-templates />

</form>
</body>
</html>
</xsl:template>

<xsl:template match='article'>
<table border='1' cellpadding='2' cellspacing='1'>
<tr>
       <td width='40%'>
           <h2><xsl:value-of select='title'/></h2>
       </td>
       <td width='60%'>
           <h3><xsl:value-of select='author'/></h3>
           <br/>
           <xsl:value-of select='body'/>
	   <br />
	   Form: <xsl:value-of select='form' disable-output-escaping='yes' />
	   <br />
	 <table align='center' border='1'>
	 <tr>
	 <xsl:call-template name='prod_cells'>
	 	<xsl:with-param name='count' select='4' />
	</xsl:call-template>
	 </tr>
	 </table>
	 
	 <br />
	 <B>This is a function test</B>
	 <br />
	 <xsl:text>
	 <xsl:call-template name='test_form'>
		<xsl:with-param name='form_type' select='string("text")' />
		<xsl:with-param name='form_name' select='string("micahs_form")' />
		<xsl:with-param name='form_value' select='form2' />
	 </xsl:call-template>
	 </xsl:text>
	 <br /><br />
	 <p>Micah Says Another One</p>
	 <xsl:text>
	 <xsl:call-template name='test_form'>
		<xsl:with-param name='form_type' select='string("text")' />
		<xsl:with-param name='form_name' select='string("micahs_form2")' />
		<xsl:with-param name='form_value' select='form2' />
	 </xsl:call-template>
	 </xsl:text>
       </td>
   </tr>
</table>
</xsl:template>


</xsl:stylesheet>

##################
form.xsl
##################
<?xml version="1.0"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template name='test_form'>
	<xsl:param name='form_name' />
	<xsl:param name='form_type' />
	<xsl:param name='form_value' />
	<xsl:value-of select='concat("&#60;input type=",$form_type," name=",$form_name, " size=15 value=&#39;",$form_value,"&#39; />")' disable-output-escaping='yes' />
</xsl:template>
</xsl:stylesheet>

------------------------
Discussion
------------------------
The only xslt_xxx function that is useable to transform xsl with Sablotron is the xslt_process which only takes the information as strings.  Ntoe: Everything works fine with this.  However, you can use <xsl:include> with a string for xslt_process, so I need to send the string with xslt_output_begintransform() in order for all includes to happen.  I need to use that function, because I will not know what all xsl files will need to be included with every parsing; template designers add and change things all the time; plus it would be nice if the transformation was as close to standards as possible. Note: This seg fault problem has been a problem from php 4.0.3+; I have also tried the CVS copies and xslt does not seem to work in that distribution at all (compile with --with-sablot-xslt; according to configure --help).  I can take these same three files (converting the php file to straight XML) and use sabcmd -L log -m index.xsl index.xml index.html and it is transformed without a hitch.  This is definitely an issue with PHP.  I have also created the XML file with the PHP DOM functions and echoing the tree out (as per the manual example) in between xslt_output_begintransform() and xslt_output_endtransform() and it seg faults as well. 

Any questions let me know.

Micah

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-30 18:39 UTC] sterling@php.net
This is fixed by omission in the new XSLT extension (we no 
longer have the xslt_output_*() functions).  Please 
upgrade to that extension as that is where all new 
development is focused.

Thanks.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 14:01:30 2024 UTC