ID: 29590
Updated by: [EMAIL PROTECTED]
Reported By: x-penguin at tut dot by
-Status: Open
+Status: Bogus
Bug Type: XSLT related
Operating System: Linux
PHP Version: 5CVS-2004-08-09 (dev)
New Comment:
I wonder, if that really worked in PHP 5.0.0 ... (doesn't here on
5.0.0-dev)
but change
return $xml->saveXML();
to
return $xml;
and it works
(you have to return a DomDocument if you want to access the nodes
later...)
Previous Comments:
------------------------------------------------------------------------
[2004-08-09 20:11:31] x-penguin at tut dot by
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
final class Menu {
public static function createXML() {
$xml = new DomDocument;
$xml->loadXML('<?xml version="1.0" encoding="iso-8859-1" ?>
<menus><menu>1</menu><menu>2</menu><menu>3</menu></menus>');
return $xml->saveXML();
}
}
$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:variable name="menus"
select="php:function(\'Menu::createXML\')/menus"/>
<xsl:template match="/">
<xsl:value-of select="$menus" />
</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);
echo $dom->saveXML();
?>
Expected result:
----------------
<?xml version="1.0"?>
123
Actual result:
--------------
<br />
<b>Warning</b>: XSLTProcessor::transformToDoc() [<a
href='function.transformToDoc'>function.transformToDoc</a>]: Invalid
type in <b>/mnt/data/www/html/linux.grodno.by/web/test.php</b> on line
<b>30</b><br />
<br />
<b>Warning</b>: XSLTProcessor::transformToDoc() [<a
href='function.transformToDoc'>function.transformToDoc</a>]: runtime
error: file /mnt/data/www/html/linux.grodno.by/web/ element variable in
<b>/mnt/data/www/html/linux.grodno.by/web/test.php</b> on line
<b>30</b><br />
<br />
<b>Warning</b>: XSLTProcessor::transformToDoc() [<a
href='function.transformToDoc'>function.transformToDoc</a>]: Evaluating
global variable being computed ... failed in
<b>/mnt/data/www/html/linux.grodno.by/web/test.php</b> on line
<b>30</b><br />
<?xml version="1.0"?>
------------------------------------------------------------------------
[2004-08-09 18:42:33] [EMAIL PROTECTED]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
please provide a self running example.
------------------------------------------------------------------------
[2004-08-09 18:38:33] x-penguin at tut dot by
Description:
------------
In php5.0.0 I can use next select syntax:
<xsl:variable name="menus"
select="php:function('Menu::createXML')/menus"/>
but in php5.1.0-dev I see this warning
>>>
Warning: XSLTProcessor::transformToDoc() [function.transformToDoc]:
Invalid type in
/mnt/data/www/html/web/Includes/Theme.php on line 117
Warning: XSLTProcessor::transformToDoc() [function.transformToDoc]:
runtime error: file
/mnt/data/www/html/linux.grodno.by/web/Themes/FreeWay/Templates/Modules/module.xsl
line 22 element
variable in /mnt/data/www/html/web/Includes/Theme.php on line 117
Warning: XSLTProcessor::transformToDoc() [function.transformToDoc]:
Evaluating global variable being
computed ... failed in /mnt/data/www/html/web/Includes/Theme.php on
line 117
>>>
Menu::createXML() static method, returns XML document... in php5.0 all
work fine,
but in 5.1.0-dev dasn't. How i can do this in php5.1... or it's a bug?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29590&edit=1