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<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"test"</span><span style="color: #007700">; </span><span style="color: #0000BB">?&gt;</span></code></pre>bool(true)
46<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"test ?&gt;</span></code></pre>bool(true)
47<pre><code style="color: #000000">
48<span style="color: #0000BB">&lt;?php
49</span><span style="color: #007700">class </span><span style="color: #0000BB">test </span><span style="color: #007700">{
50    public </span><span style="color: #0000BB">$var </span><span style="color: #007700">= </span><span style="color: #0000BB">1</span><span style="color: #007700">;
51    private function </span><span style="color: #0000BB">foo</span><span style="color: #007700">() { echo </span><span style="color: #DD0000">"foo"</span><span style="color: #007700">; }
52    public function </span><span style="color: #0000BB">bar</span><span style="color: #007700">() { </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">()); }
53}
54</span><span style="color: #0000BB">?&gt;</span></code></pre>bool(true)
55Done
56