008.phpt 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --TEST--
  2. syntax highlighting
  3. --SKIPIF--
  4. <?php include "skipif.inc"; ?>
  5. --FILE--
  6. <?php
  7. include "include.inc";
  8. $php = get_cgi_path();
  9. reset_env_vars();
  10. $filename = __DIR__."/008.test.php";
  11. $code = '
  12. <?php
  13. $test = "var"; //var
  14. /* test class */
  15. class test {
  16. private $var = array();
  17. public static function foo(Test $arg) {
  18. echo "hello";
  19. var_dump($this);
  20. }
  21. }
  22. $o = new test;
  23. ?>
  24. ';
  25. file_put_contents($filename, $code);
  26. var_dump(`"$php" -n -s "$filename"`);
  27. var_dump(`"$php" -n -s "unknown"`);
  28. @unlink($filename);
  29. echo "Done\n";
  30. ?>
  31. --EXPECTF--
  32. string(%d) "X-Powered-By: PHP/%s
  33. Content-type: text/html%r; charset=.*|%r
  34. <code><span style="color: #000000">
  35. <br /><span style="color: #0000BB">&lt;?php<br />$test&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"var"</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//var<br />/*&nbsp;test&nbsp;class&nbsp;*/<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;private&nbsp;</span><span style="color: #0000BB">$var&nbsp;</span><span style="color: #007700">=&nbsp;array();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;static&nbsp;function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">Test&nbsp;$arg</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"hello"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #0000BB">$o&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">test</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>
  36. </span>
  37. </code>"
  38. string(%d) "Status: 404 Not Found
  39. X-Powered-By: PHP/%s
  40. Content-type: text/html%r; charset=.*|%r
  41. No input file specified.
  42. "
  43. Done