Bug #17579 Updated: Handler set by xslt_set_sax_handlers gets random data.

From: Date: Mon, 03 Jun 2002 22:10:05 +0000
Subject: Bug #17579 Updated: Handler set by xslt_set_sax_handlers gets random data.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-9386@lists.php.net to get a copy of this message
ID: 17579 Updated by: cywulf@ottawa.com Reported By: cywulf@ottawa.com -Status: Feedback +Status: Open Bug Type: XSLT related Operating System: Linux 2.4.19 PHP Version: 4.2.1 New Comment: As I said above, it is only segfaulting on character data handlers. Using a modified sample script, this was the backtrace I obtained. I suspect that it indicates the problem lies with Sablotron, in which case I guess you can just close the bug? (gdb) bt #0 0x4023472c in memcpy () from /lib/libc.so.6 #1 0x081080d7 in _estrndup (s=0x81c0628 "`+\034\bÀ\030\034\b", length=136080488, __zend_filename=0x815e98b "sablot.c", __zend_lineno=1223, __zend_orig_filename=0x0, __zend_orig_lineno=0) at zend_alloc.c:346 #2 0x080fe187 in sax_characters (ctx=0x81c6b0c, contents=0x81c0628 "`+\034\bÀ\030\034\b", length=136080488) at sablot.c:1223 #3 0x40094b6e in OutputterObj::reportCurrData () from /usr/lib/libsablot.so.0 #4 0x400949cf in OutputterObj::eventEndOutput () from /usr/lib/libsablot.so.0 #5 0x4009acf8 in Processor::run () from /usr/lib/libsablot.so.0 #6 0x400a091d in SablotRunProcessor () from /usr/lib/libsablot.so.0 #7 0x080fc72a in zif_xslt_process (ht=5, return_value=0x81c0eec, this_ptr=0x0, return_value_used=0) at sablot.c:512 #8 0x0814039a in execute (op_array=0x81c080c) at ./zend_execute.c:1598 #9 0x081195f9 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:810 #10 0x08062a81 in php_execute_script (primary_file=0xbffff754) at main.c:1381 #11 0x0805ffd1 in main (argc=2, argv=0xbffff7e4) at cgi_main.c:778 #12 0x401d33c1 in __libc_start_main () from /lib/libc.so.6 (gdb) frame 8 #8 0x0814039a in execute (op_array=0x81c080c) at ./zend_execute.c:1598 1598 ((zend_internal_function *) EX(function_state).function)->handler(EX(opline)->extended_value, EX(Ts)[EX(opline)->result.u.var].var.ptr, EX(object).ptr, return_value_used TSRMLS_CC); Previous Comments: ------------------------------------------------------------------------ [2002-06-03 14:35:28] mfischer@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. ------------------------------------------------------------------------ [2002-06-03 14:32:30] cywulf@ottawa.com I have since verified that the same behaviour applies to comment handlers. Interestingly, if a PI handler and comment handler are both triggered on the same page, they will both receive the SAME random data in their content fields. When trying to check the behaviour of character data handlers, Apache segfaulted every time. [notice] child pid 5537 exit signal Segmentation fault (11) Forgot to specify that my expat version is 1.95.2. ------------------------------------------------------------------------ [2002-06-03 11:58:24] cywulf@ottawa.com SAX handlers attached to an XSL transform via xslt_set_sax_handlers are not performing as expected when the target is a processing instruction. In fact, the handler is passed completely random data, generally non-printing characters, in place of the PI content. Test system is running Sablotron 0.90, on Apache 1.3.24. PHP is configured using --enable-xslt and --with-xslt-sablot (among many other options). Minimal sample code follows. <?php $xslt = xslt_create(); $args = array( "/_xml" => '<?xml version="1.0" encoding="UTF-8"?> <test />', "/_xsl" => '<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="test"> <xsl:processing-instruction name="php"><![CDATA[ print "hello world"; ]]></xsl:processing-instruction> </xsl:template> </xsl:stylesheet>' ); function handle_pi($processor, $content, $target) { echo '<pre>'; echo "processor: $processor\n"; echo "target: $target\n"; echo "content: $content\n"; echo '</pre>'; } xslt_set_sax_handlers($xslt, array('pi'=>'handle_pi')); xslt_process($xslt, "arg:/_xml", "arg:/_xsl", NULL, $args); xslt_free($xslt); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17579&edit=1

« previous php.bugs (#9386) next »