bug71540.phpt 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. --TEST--
  2. Bug #71540 (NULL pointer dereference in xsl_ext_function_php())
  3. --EXTENSIONS--
  4. xsl
  5. --SKIPIF--
  6. <?php
  7. if (LIBXML_VERSION >= 20903) die('skip this test is for PHP linked with libxml2 < 2.9.3 only')
  8. ?>
  9. --FILE--
  10. <?php
  11. $xml = <<<EOB
  12. <allusers>
  13. <user>
  14. <uid>bob</uid>
  15. </user>
  16. </allusers>
  17. EOB;
  18. $xsl = <<<EOB
  19. <?xml version="1.0" encoding="UTF-8"?>
  20. <xsl:stylesheet version="1.0"
  21. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  22. xmlns:php="http://php.net/xsl">
  23. <xsl:output method="html" encoding="utf-8" indent="yes"/>
  24. <xsl:template match="allusers">
  25. <html><body>
  26. <h2>Users</h2>
  27. <table>
  28. <xsl:for-each select="user">
  29. <tr><td>
  30. <xsl:value-of
  31. select="php:function('test',uid,test(test))"/>
  32. </td></tr>
  33. </xsl:for-each>
  34. </table>
  35. </body></html>
  36. </xsl:template>
  37. </xsl:stylesheet>
  38. EOB;
  39. $xmldoc = new DOMDocument();
  40. $xmldoc->loadXML($xml);
  41. $xsldoc = new DOMDocument();
  42. $xsldoc->loadXML($xsl);
  43. $proc = new XSLTProcessor();
  44. $proc->registerPHPFunctions();
  45. $proc->importStyleSheet($xsldoc);
  46. echo $proc->transformToXML($xmldoc);
  47. ?>
  48. DONE
  49. --EXPECTF--
  50. Warning: XSLTProcessor::transformToXml(): xmlXPathCompOpEval: function test not found in %sbug71540.php on line %d
  51. Warning: XSLTProcessor::transformToXml(): Unregistered function in %sbug71540.php on line %d
  52. Warning: XSLTProcessor::transformToXml(): Stack usage error in %sbug71540.php on line %d
  53. Warning: XSLTProcessor::transformToXml(): Stack usage error in %sbug71540.php on line %d
  54. Warning: XSLTProcessor::transformToXml(): Handler name must be a string in %sbug71540.php on line %d
  55. Warning: XSLTProcessor::transformToXml(): xmlXPathCompiledEval: 2 objects left on the stack. in %sbug71540.php on line %d
  56. Warning: XSLTProcessor::transformToXml(): runtime error: file %s line 13 element value-of in %sbug71540.php on line %d
  57. Warning: XSLTProcessor::transformToXml(): XPath evaluation returned no result. in %sbug71540.php on line %d
  58. <html xmlns:php="http://php.net/xsl"><body>
  59. <h2>Users</h2>
  60. <table><tr><td></td></tr></table>
  61. </body></html>
  62. DONE