php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20939 PHP stops executing script when using sax handlers
Submitted: 2002-12-11 09:31 UTC Modified: 2002-12-30 08:18 UTC
From: saltwater at saltwater dot be Assigned:
Status: Closed Package: XSLT related
PHP Version: 4.2.3 OS: Debian GNU/Linux 2.4.19
Private report: No CVE-ID: None
 [2002-12-11 09:31 UTC] saltwater at saltwater dot be
When using xslt_set_sax_handlers, php stops executing after xslt_process. Below a script that should reproduce the problem (I tested it on 2 servers to be sure):
<?php
	$resXSL=xslt_create();
	xslt_set_sax_handlers($resXSL,array('element'=>array('start_element','end_element')));
	$aryArg['xml']=implode("\n",file(dirname(__FILE__).'/test.xml'));
	$aryArg['xsl']=implode("\n",file(dirname(__FILE__).'/test.xsl'));
	$strHTML = xslt_process($resXSL,'arg:xml','arg:xsl',NULL,$aryArg);
	xslt_free($resXSL);
	echo $strHTML;
	function start_element($resParser,$strName,$aryAttribs) {
		echo 'Start of '.$strName;
	}
	function end_element($resParser,$strName) {
		echo 'End of '.$strName;
	}
?>

When this is executed there is no output, when I comment the line where I use xslt_set_sax_handlers, it works fine (the html is shown). When I enable xslt logging sablotron seems to be in an endless loop:
Sablotron Message on line none, level log: Parsing 'arg:/xsl'...
Sablotron Message on line none, level log: Parse done in 0.002 seconds
Sablotron Message on line none, level log: Parsing 'arg:/xml'...
Sablotron Message on line none, level log: Parse done in 0.000 seconds
Sablotron Message on line none, level log: Executing stylesheet 'arg:/xsl'...

These lines are printed into the logfile about let's say 30 times, the first time the message 
Sablotron Message on line none, level log: Execution done in 0.002 seconds
appears, the other let's say 29 times not.

When I comment the xslt_set_sax_handlers line the logfile only shows the 5 lines mentioned before and also the 'Execution don in .... seconds' line as you would expect

My guess is that sablotron is stuck in a loop...

PHP is compiled with: --with-dom --with-sablot --with-expat -with-dom-xslt --with-dom-exslt --enable-xslt' --with-xslt-sablot

If you want to get the xml/xsl files I used, you can get them at http://bruno.webfx.be/xslt_test/

Thanks in advance,
Bruno

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-11 10:19 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

I cannot replicate this problem with PHP 4.3.0 & Sablotron 0.96. If you try the snapshot and still experience problems please include the Sablotron version you are using in your report.
 [2002-12-11 12:37 UTC] msopacua@php.net
1) remove --with-sablot from your configure line.
2) If iconv is linked in with Sablotron, then use --with-iconv-dir as well.

3) This is most likely fixed already as this loop is actually a segfault. (see my mail)
 [2002-12-13 10:48 UTC] Bruno <saltwater at saltwater dot be>
We would like to avoid installing an unstable version of PHP ... and removing --with-sablot didn't help either
 [2002-12-30 08:17 UTC] Bruno Windels <saltwater at saltwater dot be>
The bug is in PHP 4.3! thanx ;)
 [2002-12-30 08:18 UTC] derick@php.net
good, let's close it then.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC