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 = dirname(__FILE__)."/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-- 40Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d 41bool(false) 42 43Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d 44 45Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d 46bool(false) 47<code><span style="color: #000000"> 48<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> 49</span> 50</code>bool(true) 51<code><span style="color: #000000"> 52<span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"test ?></span> 53</span> 54</code>bool(true) 55<code><span style="color: #000000"> 56<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> 57</span> 58</code>bool(true) 59Done 60