1--TEST--
2highlight_file() tests
3--INI--
4highlight.string=#DD0000
5highlight.comment=#FF9900
6highlight.keyword=#007700
7highlight.default=#0000BB
8highlight.html=#000000
9allow_url_include=1
10allow_url_fopen=1
11--FILE--
12<?php
13
14$filename = __DIR__."/highlight_file.dat";
15
16var_dump(highlight_file());
17var_dump(highlight_file($filename));
18
19var_dump(highlight_file('data:,<?php echo "test"; ?>'));
20
21var_dump(highlight_file('data:,<?php echo "test ?>'));
22
23$data = '
24<?php
25 class test {
26	 public $var = 1;
27	 private function foo() { echo "foo"; }
28	 public function bar() { var_dump(test::foo()); }
29 }
30?>';
31
32file_put_contents($filename, $data);
33var_dump(highlight_file($filename));
34
35
36@unlink($filename);
37echo "Done\n";
38?>
39--EXPECTF--
40Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
41
42Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d
43bool(false)
44
45Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d
46
47Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d
48bool(false)
49<code><span style="color: #000000">
50<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"test"</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">?&gt;</span>
51</span>
52</code>bool(true)
53<code><span style="color: #000000">
54<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"test&nbsp;?&gt;</span>
55</span>
56</code>bool(true)
57<code><span style="color: #000000">
58<br /><span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;</span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">test&nbsp;</span><span style="color: #007700">{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;</span><span style="color: #0000BB">$var&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">()&nbsp;{&nbsp;echo&nbsp;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">bar</span><span style="color: #007700">()&nbsp;{&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">test</span><span style="color: #007700">::</span><span style="color: #0000BB">foo</span><span style="color: #007700">());&nbsp;}<br />&nbsp;}&nbsp;&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span>
59</span>
60</code>bool(true)
61Done
62