|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-06-03 11:58 UTC] cywulf at ottawa dot 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); ?> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 08:00:02 2025 UTC |
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);