ID: 8928
User Update by: [EMAIL PROTECTED]
Status: Open
Bug Type: Sablotron XSL
Description: xslt_process randomly fails on valid xml/xsl data (xslt_run works fine)

It's probably just enough to remove <?xml version="1.0" encoding="utf-8"?> from XSL 
data to make it
working stable. Is it bug or feature ?

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

[2001-01-26 02:04:10] [EMAIL PROTECTED]
This script randomly fails (on the same xml/xsl data it works or randomly fails with 
the only error:
    Fatal error: msgtype: error in /home/httpd/html/photo/tstxsl1.php on line 29  
, which is xslt_process call.
I can't set the user error handler while using xslt_process to get more error 
information, because can't pass $parser to this function.)  :


<?php
function xsl_error($parser, $code, $level, $errors)
{
        echo "Parser: $parsern<br>n";
        echo "Code:   $coden<br>n";
        echo "Level:  $leveln<br>n";
        echo "Errors: n<br>n<br>n";
        var_dump($errors);
}

$fp = fopen("pic1.xsl", "r");
$lenxsl = filesize("pic1.xsl");
$xslData = fread($fp, $lenxsl);
fclose($fp);

$fp = fopen("pic.xml", "r");
$lenxml = filesize("pic.xml");
$xmlData = fread($fp, $lenxml);
fclose($fp);

/* 
  Parser creation could be omitted, it doesn't influence on the random crashes 
*/
$parser = xslt_create();
print "Parser Handle[$parser]<br>";
xslt_set_error_handler($parser, "xsl_error");

if (xslt_process($xslData, $xmlData, $result))
{
      echo $result;
} else {
      echo "tError number: " . xslt_errno() . "n";
      echo "tError string: " . xslt_error() . "n";
      exit;
}

/* this should be omitted if xsl_creat() is commented out */
xslt_free($parser);
?>

Sablotron comand line utility sabcmd parses xml/xsl data from the files pic1.xsl and 
pic.xml without any errors/warnings.
The following script, which doesn't use xslt_process, works stable and without errors 
on the same data files:

<?php
function xsl_error($parser, $code, $level, $errors)
{
        echo "Parser: $parsern<br>n";
        echo "Code:   $coden<br>n";
        echo "Level:  $leveln<br>n";
        echo "Errors: n<br>n<br>n";
        var_dump($errors);
}

$parser = xslt_create();
print "Parser Handle[$parser]<br>";

xslt_set_error_handler($parser, "xsl_error");

xslt_run($parser, './pic1.xsl', './pic.xml');
print "<br>Here is the output:<br>".xslt_fetch_result($parser);
xslt_free($parser);
?>

But I need at least xml "in-memory" data for my application, so I can't use xslt_run 
for my production purposes.
Suggestion - something wrong with xslt_process :)

php.ini - standard configuration from php4.04pl1 distribution
Sablotron 0.50
Expat 1.95.1
php4 configuration:
--with-apxs --prefix=/usr --with-gd --with-gettext --with-yp --with-system-regex 
--with-mysql=/usr --enable-safe-mode --enable-sysvsem --enable-sysvshm 
--with-exec-dir=/home/httpd/php/bin --with-zlib --with-config-file-path=/etc/httpd 
--disable-debug --enable-magic-quotes --enable-bcmath --with-mod_charset --with-pdflib 
--with-cpdflib --enable-calendar --with-sablot
configure script was hacked a little to provide libexpat and libiconv (glibc-2.0.7 has 
no native iconv) for Sablotron
instead of old libxmlparse and libxmltok. There were no any problem with compilation 
of php4.


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


Full Bug description available at: http://bugs.php.net/?id=8928


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to