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($filename));
17
18var_dump(highlight_file('data:,<?php echo "test"; ?>'));
19
20var_dump(highlight_file('data:,<?php echo "test ?>'));
21
22$data = '
23<?php
24class test {
25    public $var = 1;
26    private function foo() { echo "foo"; }
27    public function bar() { var_dump(test::foo()); }
28}
29?>';
30
31file_put_contents($filename, $data);
32var_dump(highlight_file($filename));
33
34
35@unlink($filename);
36echo "Done\n";
37?>
38--EXPECTF--
39Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
40
41Warning: highlight_file(%shighlight_file.dat): Failed to open stream: No such file or directory in %s on line %d
42
43Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d
44bool(false)
45<code><span style="color: #000000">
46<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>
47</span>
48</code>bool(true)
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&nbsp;?&gt;</span>
51</span>
52</code>bool(true)
53<code><span style="color: #000000">
54<br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">test&nbsp;</span><span style="color: #007700">{<br />&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">;<br />&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;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 />}<br /></span><span style="color: #0000BB">?&gt;</span>
55</span>
56</code>bool(true)
57Done
58