1--TEST--
2Check XSLTProcessor::transformToDoc() with string parameter
3--CREDITS--
4Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
5--SKIPIF--
6<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
7--FILE--
8<?php
9$xml = <<<EOB
10<allusers>
11 <user>
12  <uid>bob</uid>
13 </user>
14 <user>
15  <uid>joe</uid>
16 </user>
17</allusers>
18EOB;
19$xsl = <<<EOB
20<?xml version="1.0" encoding="UTF-8"?>
21<xsl:stylesheet version="1.0"
22     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
23     xmlns:php="http://php.net/xsl">
24<xsl:output method="html" encoding="utf-8" indent="yes"/>
25 <xsl:template match="allusers">
26  <html><body>
27    <h2>Users</h2>
28    <table>
29    <xsl:for-each select="user">
30      <tr><td>
31        <xsl:value-of
32             select="php:function('ucfirst',string(uid))"/>
33      </td></tr>
34    </xsl:for-each>
35    </table>
36  </body></html>
37 </xsl:template>
38</xsl:stylesheet>
39EOB;
40
41$xmldoc = new DOMDocument('1.0', 'utf-8');
42$xmldoc->loadXML($xml);
43
44$xsldoc = new DOMDocument('1.0', 'utf-8');
45$xsldoc->loadXML($xsl);
46
47$proc = new XSLTProcessor();
48$proc->registerPHPFunctions();
49$proc->importStyleSheet($xsldoc);
50
51$wrong_parameter = 'stringValue';
52
53echo $proc->transformToDoc($wrong_parameter);
54?>
55--EXPECTF--
56Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, string given in %s on line %i