|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29573 Segmentation fault when php function(called from XSLT templat) throw exception
Submitted: 2004-08-08 18:08 UTC Modified: 2004-08-08 20:09 UTC
From: x-penguin at tut dot by Assigned:
Status: Closed Package: XSLT related
PHP Version: 5CVS-2004-08-08 (dev) OS: Linux
Private report: No CVE-ID: None
 [2004-08-08 18:08 UTC] x-penguin at tut dot by
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:
try {
    function throwFunction() {
        throw new Exception('exception messaage');
    $xsl = new DomDocument();
    '<?xml version="1.0" encoding="iso-8859-1" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="" xmlns:php="">
    <xsl:template match="/">
    <xsl:value-of select="php:function(\'throwFunction\')" />
    $xml = new DomDocument;
    '<?xml version="1.0" encoding="iso-8859-1" ?>
    $proc = new XSLTProcessor();
    $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)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-08 18:59 UTC]
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

 [2004-08-08 20:09 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

Fixed in PHP_5_0 branch as well.

And, surprisingly, the exceptions bubbles up to the calling transformation function... Everything should now work as expected.

PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 08:01:25 2019 UTC