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