ID:               29573
 Updated by:       [EMAIL PROTECTED]
 Reported By:      x-penguin at tut dot by
-Status:           Open
+Status:           Verified
 Bug Type:         XSLT related
 Operating System: Linux
 PHP Version:      5CVS-2004-08-08 (dev)
 New Comment:

That's not supposed to work this way ;)

I'm not sure, if we can pass exceptions from php function called within
XSLT back to the PHP script starting the transformation (we have libxml2
twice in the middle of that, that's the problem).

But of course, it shouldn't segfault and that's fixable. Expect a patch
for that soon






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

[2004-08-08 18:08:49] x-penguin at tut dot by

Description:
------------
Child httpd process segfault, when php function(called from XSLT
template) throw exception, and when exception was throwed from steream
wrapper, used in XSLT template.

PHP Version 5.1.0-dev, configure with:
'./configure' '--prefix=/usr/' '--with-apxs2' '--with-gettext'
'--with-iconv' '--with-mysql' '--enable-mbstring=ru' '--enable-mbregex'
'--enable-mbstr-enc-trans' '--disable-short-tags' '--with-xsl'
'--with-libxml' '--without-sqlite' '--enable-soap'

libxslt Version         1.1.8
libxml Version  2.6.11
libexslt Version        1.1.8

apache 2.0.48

Reproduce code:
---------------
<?php
try {
    function throwFunction() {
        throw new Exception('exception messaage');
    }
    
    $xsl = new DomDocument();
    $xsl->loadXML(
    '<?xml version="1.0" encoding="iso-8859-1" ?>
    <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:php="http://php.net/xsl";>
    <xsl:template match="/">
    <xsl:value-of select="php:function(\'throwFunction\')" />
    </xsl:template>
    </xsl:stylesheet>'
    );
    
    $xml = new DomDocument;
    $xml->loadXML(
    '<?xml version="1.0" encoding="iso-8859-1" ?>
    <null></null>'
    );
    
    $proc = new XSLTProcessor();
    $proc->registerPhpFunctions();
    $proc->importStylesheet($xsl);
    
    $dom = $proc->transformToDoc($xml);
} catch(Exception $exception) {
    echo $exception;
}
?>

Expected result:
----------------
exception 'Exception' with message 'exception messaage' in
/mnt/data/www/html/web/test.php:4
Stack trace:
#0 /mnt/data/www/html/web/test.php(27): XSLTProcessor->throwFunction()
#1 /mnt/data/www/html/web/test.php(27):
XSLTProcessor->transformToDoc(Object(DOMDocument))
#2 {main}

Actual result:
--------------
from apache error log:
[Sun Aug 08 18:55:33 2004] [notice] child pid 1337 exit signal
Segmentation fault (11)


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


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

Reply via email to