[xdebug-dev] Bug 0000113: XSLT PHP functions registered

From: <xdebug-dev[@]lists.xdebug.org>
Date: Thu, 10 Mar 2005 22:40:48 +0100

A BUGNOTE has been added to this bug.
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000113
======================================================================
Reporter: LupusMichaelis
Handler:
======================================================================
Project: Xdebug
Bug ID: 113
Category: Debug client (console)
Reproducibility: always
Severity: crash
Priority: normal
Status: feedback
Operating System: GNU/Linux Debian Sarge
PHP Version: 5.0.2
Xdebug Version: 1.3.2
======================================================================
Date Submitted: 2005-02-05 11:24 CET
Last Modified: 2005-03-10 22:40 CET
======================================================================
Summary: XSLT PHP functions registered
Description:
If I use a registered PHP function in an XSLT file, xdebug crash PHP5.
======================================================================

----------------------------------------------------------------------
 derick - 2005-02-16 11:48 CET
----------------------------------------------------------------------
Can you please provide a reproducing script, and are you really using
version 1.3.2?

----------------------------------------------------------------------
 LupusMichaelis - 2005-02-16 16:43 CET
----------------------------------------------------------------------
The version I give is the php_info version for x-debug !
Here an exemple :
<?php

$xml = <<<EOS
<foo>
  <bar>Blah !</bar>
</foo>
EOS;

$xsl = <<<EOS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<xsl:stylesheet
  version="1.0"
  xmlns:php="http://php.net/xsl"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output
  encoding="utf-8"
  doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  indent="yes"
  />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
  <head><title>Toto don't love me !'</title></head>
  <body>
    <xsl:apply-templates/>
    <xsl:value-of select="php:function('php_func', node())"
disable-output-escaping="yes" />
  </body>
</html>
</xsl:template>

<xsl:template match="foo">
  <p>Completly foo !</p>
</xsl:template>
<xsl:template match="bar">
  <p>I got a bar !</p>
</xsl:template>
</xsl:stylesheet >
EOS;

function php_func($node)
{
        if(get_class($node[0]) == 'DOMNode')
                return 'I\'ve got a Node !' ;
        else
                return 'I\'ve got something strange...' ;
}
$model = DOMDocument::loadXML($xml) ;
$xslt = DOMDocument::loadXML($xsl) ;
$proc = new XSLTProcessor() ;
$proc->importStyleSheet($xslt) ;
$proc->registerPhpFunctions();
$out = $proc->transformToDoc($model) ;

echo $out->saveXML()

?>

edited on: 2005-02-16 16:43

----------------------------------------------------------------------
 derick - 2005-03-10 22:40 CET
----------------------------------------------------------------------
I can not reproduce this with the latest CVS version (both 1.3.3-rev or
2.0.0-dev). Please try one of those versions and provide feedback.

Bug History
Date Modified Username Field Change
======================================================================
2005-02-05 11:24LupusMichaelis New Bug
2005-02-05 11:24LupusMichaelis Bug Monitored: LupusMichaelis
2005-02-16 11:48derick Bugnote Added: 0000228
2005-02-16 11:48derick Status new => feedback
2005-02-16 16:39LupusMichaelis Bugnote Added: 0000232
2005-02-16 16:43LupusMichaelis Bugnote Edited: 0000232
2005-03-10 22:40derick Bugnote Added: 0000247
======================================================================
Received on Thu Mar 10 2005 - 22:40:53 GMT

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST