mirror of
https://github.com/php/php-src.git
synced 2024-11-23 01:44:06 +08:00
Align highlight_string|file with HTML standard and modern browsers
Closes GH-11913
This commit is contained in:
parent
4a77a1ec08
commit
f907a009f9
@ -221,6 +221,10 @@ PHP 8.3 UPGRADE NOTES
|
||||
only paths starting with `..` were disallowed. This could easily be
|
||||
circumvented by prepending `./` to the path.
|
||||
. User exception handlers now catch exceptions during shutdown.
|
||||
. The resultant HTML of highlight_string and highlight_file has changed.
|
||||
Whitespace between outer HTML tags is removed. Newlines and spaces
|
||||
are no longer converted to HTML entities. The whole HTML is now wrapped in
|
||||
<pre> tag. The outer <span> has been merged with <code>.
|
||||
|
||||
- Calendar
|
||||
. easter_date() now supports years from 1970 to 2,000,000,000 on 64-bit systems,
|
||||
|
@ -19,7 +19,10 @@ EOT
|
||||
highlight_string($code);
|
||||
?>
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<br /><span style="color: #0000BB"><?php<br /> $x </span><span style="color: #007700">= <<<EOT<br /></span><span style="color: #DD0000">some string <br /></span><span style="color: #007700">EOT<br /> </span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000">
|
||||
<span style="color: #0000BB"><?php
|
||||
$x </span><span style="color: #007700">= <<<EOT
|
||||
</span><span style="color: #DD0000">some string
|
||||
</span><span style="color: #007700">EOT
|
||||
</span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">?></span></code></pre>
|
||||
|
@ -11,7 +11,4 @@ highlight.html = #000000
|
||||
highlight_string('<?php /*some comment..');
|
||||
?>
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #FF8000">/*some comment..</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #FF8000">/*some comment..</span></code></pre>
|
||||
|
@ -8,7 +8,5 @@ var_dump($highlightedString);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(169) "<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php <br /> 09 09 09</span><span style="color: #007700">;</span>
|
||||
</span>
|
||||
</code>"
|
||||
string(139) "<pre><code style="color: #000000"><span style="color: #0000BB"><?php
|
||||
09 09 09</span><span style="color: #007700">;</span></code></pre>"
|
||||
|
@ -20,7 +20,9 @@ EOF;
|
||||
highlight_string($code);
|
||||
?>
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php<br /> $x </span><span style="color: #007700">= <<<'EOT'<br /></span><span style="color: #DD0000">some string <br /></span><span style="color: #007700">EOT<br /> </span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php
|
||||
$x </span><span style="color: #007700">= <<<'EOT'
|
||||
</span><span style="color: #DD0000">some string
|
||||
</span><span style="color: #007700">EOT
|
||||
</span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">?></span></code></pre>
|
||||
|
@ -18,7 +18,8 @@ EOF;
|
||||
highlight_string($code);
|
||||
?>
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php<br /> $x </span><span style="color: #007700">= <<<'EOT'<br />EOT<br /> </span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php
|
||||
$x </span><span style="color: #007700">= <<<'EOT'
|
||||
EOT
|
||||
</span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">?></span></code></pre>
|
||||
|
@ -28,9 +28,6 @@
|
||||
ZEND_API void zend_html_putc(char c)
|
||||
{
|
||||
switch (c) {
|
||||
case '\n':
|
||||
ZEND_PUTS("<br />");
|
||||
break;
|
||||
case '<':
|
||||
ZEND_PUTS("<");
|
||||
break;
|
||||
@ -40,11 +37,8 @@ ZEND_API void zend_html_putc(char c)
|
||||
case '&':
|
||||
ZEND_PUTS("&");
|
||||
break;
|
||||
case ' ':
|
||||
ZEND_PUTS(" ");
|
||||
break;
|
||||
case '\t':
|
||||
ZEND_PUTS(" ");
|
||||
ZEND_PUTS(" ");
|
||||
break;
|
||||
default:
|
||||
ZEND_PUTC(c);
|
||||
@ -88,8 +82,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
|
||||
char *last_color = syntax_highlighter_ini->highlight_html;
|
||||
char *next_color;
|
||||
|
||||
zend_printf("<code>");
|
||||
zend_printf("<span style=\"color: %s\">\n", last_color);
|
||||
zend_printf("<pre><code style=\"color: %s\">", last_color);
|
||||
/* highlight stuff coming back from zendlex() */
|
||||
while ((token_type=lex_scan(&token, NULL))) {
|
||||
switch (token_type) {
|
||||
@ -162,10 +155,9 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
|
||||
}
|
||||
|
||||
if (last_color != syntax_highlighter_ini->highlight_html) {
|
||||
zend_printf("</span>\n");
|
||||
zend_printf("</span>");
|
||||
}
|
||||
zend_printf("</span>\n");
|
||||
zend_printf("</code>");
|
||||
zend_printf("</code></pre>");
|
||||
|
||||
/* Discard parse errors thrown during tokenization */
|
||||
zend_clear_exception();
|
||||
|
@ -14,7 +14,4 @@ files/frontcontroller8.phar
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -14,7 +14,4 @@ files/frontcontroller.phar
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -14,7 +14,4 @@ files/frontcontroller3.phar
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -13,7 +13,4 @@ files/frontcontroller8.phar
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -13,7 +13,4 @@ files/frontcontroller.phar
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -13,7 +13,4 @@ files/frontcontroller3.phar
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -13,7 +13,4 @@ files/frontcontroller8.phar.tar
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -13,7 +13,4 @@ files/frontcontroller.phar.tar
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -13,7 +13,4 @@ files/frontcontroller3.phar.tar
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -15,7 +15,4 @@ files/frontcontroller8.phar.zip
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -15,7 +15,4 @@ files/frontcontroller.phar.zip
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -13,7 +13,4 @@ files/frontcontroller3.phar.zip
|
||||
--EXPECTHEADERS--
|
||||
Content-type: text/html; charset=UTF-8
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>
|
||||
|
@ -16,6 +16,12 @@ DDDD;
|
||||
highlight_string($str);
|
||||
?>
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<br />$x=<<<DD<br />jhdsjkfhjdsh<br />DD<br />."";<br />$a=<<<DDDD<br />jhdsjkfhjdsh<br />DDDD;<br /></span>
|
||||
</code>
|
||||
<pre><code style="color: #000000">
|
||||
$x=<<<DD
|
||||
jhdsjkfhjdsh
|
||||
DD
|
||||
."";
|
||||
$a=<<<DDDD
|
||||
jhdsjkfhjdsh
|
||||
DDDD;
|
||||
</code></pre>
|
||||
|
@ -42,16 +42,14 @@ Warning: highlight_file(%shighlight_file.dat): Failed to open stream: No such fi
|
||||
|
||||
Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d
|
||||
bool(false)
|
||||
<code><span style="color: #000000">
|
||||
<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>
|
||||
</span>
|
||||
</code>bool(true)
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"test ?></span>
|
||||
</span>
|
||||
</code>bool(true)
|
||||
<code><span style="color: #000000">
|
||||
<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>
|
||||
</span>
|
||||
</code>bool(true)
|
||||
<pre><code style="color: #000000"><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></code></pre>bool(true)
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"test ?></span></code></pre>bool(true)
|
||||
<pre><code style="color: #000000">
|
||||
<span style="color: #0000BB"><?php
|
||||
</span><span style="color: #007700">class </span><span style="color: #0000BB">test </span><span style="color: #007700">{
|
||||
public </span><span style="color: #0000BB">$var </span><span style="color: #007700">= </span><span style="color: #0000BB">1</span><span style="color: #007700">;
|
||||
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">; }
|
||||
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">()); }
|
||||
}
|
||||
</span><span style="color: #0000BB">?></span></code></pre>bool(true)
|
||||
Done
|
||||
|
@ -21,7 +21,19 @@ show_source(__FILE__);
|
||||
?>
|
||||
--EXPECT--
|
||||
*** Test by calling method or function with its expected arguments ***
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"*** Test by calling method or function with its expected arguments ***\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$foo </span><span style="color: #007700">= </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">"something "</span><span style="color: #007700">.</span><span style="color: #0000BB">$foo</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />if ( </span><span style="color: #0000BB">$foo </span><span style="color: #007700">== </span><span style="color: #DD0000">'bar' </span><span style="color: #007700">)<br />{<br /> </span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">'baz'</span><span style="color: #007700">;<br />}<br /><br /> </span><span style="color: #FF8000">/* some code here */<br /><br /></span><span style="color: #0000BB">show_source</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?><br /></span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php
|
||||
</span><span style="color: #007700">echo </span><span style="color: #DD0000">"*** Test by calling method or function with its expected arguments ***\n"</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">$foo </span><span style="color: #007700">= </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">"something "</span><span style="color: #007700">.</span><span style="color: #0000BB">$foo</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;
|
||||
|
||||
if ( </span><span style="color: #0000BB">$foo </span><span style="color: #007700">== </span><span style="color: #DD0000">'bar' </span><span style="color: #007700">)
|
||||
{
|
||||
</span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">'baz'</span><span style="color: #007700">;
|
||||
}
|
||||
|
||||
</span><span style="color: #FF8000">/* some code here */
|
||||
|
||||
</span><span style="color: #0000BB">show_source</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);
|
||||
|
||||
</span><span style="color: #0000BB">?>
|
||||
</span></code></pre>
|
||||
|
@ -22,7 +22,19 @@ echo $foo;
|
||||
--EXPECT--
|
||||
*** Test by calling method or function with its expected arguments and php output ***
|
||||
baz
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"*** Test by calling method or function with its expected arguments and php output ***\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$foo </span><span style="color: #007700">= </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">"something "</span><span style="color: #007700">.</span><span style="color: #0000BB">$foo</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />if ( </span><span style="color: #0000BB">$foo </span><span style="color: #007700">== </span><span style="color: #DD0000">'bar' </span><span style="color: #007700">)<br />{<br /> </span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">"baz\n"</span><span style="color: #007700">;<br />}<br /><br /> </span><span style="color: #FF8000">/* some code here */<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$baz</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">show_source</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$foo</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?><br /></span>
|
||||
</span>
|
||||
</code>bar
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php
|
||||
</span><span style="color: #007700">echo </span><span style="color: #DD0000">"*** Test by calling method or function with its expected arguments and php output ***\n"</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">$foo </span><span style="color: #007700">= </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">"something "</span><span style="color: #007700">.</span><span style="color: #0000BB">$foo</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;
|
||||
|
||||
if ( </span><span style="color: #0000BB">$foo </span><span style="color: #007700">== </span><span style="color: #DD0000">'bar' </span><span style="color: #007700">)
|
||||
{
|
||||
</span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">"baz\n"</span><span style="color: #007700">;
|
||||
}
|
||||
|
||||
</span><span style="color: #FF8000">/* some code here */
|
||||
</span><span style="color: #007700">echo </span><span style="color: #0000BB">$baz</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">show_source</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);
|
||||
echo </span><span style="color: #0000BB">$foo</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">?>
|
||||
</span></code></pre>bar
|
||||
|
@ -21,7 +21,19 @@ var_dump($source);
|
||||
?>
|
||||
--EXPECT--
|
||||
*** Test by calling method or function with its expected arguments and output to variable ***
|
||||
string(1975) "<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"*** Test by calling method or function with its expected arguments and output to variable ***\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$foo </span><span style="color: #007700">= </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">"something "</span><span style="color: #007700">.</span><span style="color: #0000BB">$foo</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />if ( </span><span style="color: #0000BB">$foo </span><span style="color: #007700">== </span><span style="color: #DD0000">'bar' </span><span style="color: #007700">)<br />{<br /> </span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">"baz\n"</span><span style="color: #007700">;<br />}<br /><br /> </span><span style="color: #FF8000">/* some code here */<br /></span><span style="color: #0000BB">$source </span><span style="color: #007700">= </span><span style="color: #0000BB">show_source</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$source</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?><br /></span>
|
||||
</span>
|
||||
</code>"
|
||||
string(1705) "<pre><code style="color: #000000"><span style="color: #0000BB"><?php
|
||||
</span><span style="color: #007700">echo </span><span style="color: #DD0000">"*** Test by calling method or function with its expected arguments and output to variable ***\n"</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">$foo </span><span style="color: #007700">= </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">"something "</span><span style="color: #007700">.</span><span style="color: #0000BB">$foo</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;
|
||||
|
||||
if ( </span><span style="color: #0000BB">$foo </span><span style="color: #007700">== </span><span style="color: #DD0000">'bar' </span><span style="color: #007700">)
|
||||
{
|
||||
</span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">"baz\n"</span><span style="color: #007700">;
|
||||
}
|
||||
|
||||
</span><span style="color: #FF8000">/* some code here */
|
||||
</span><span style="color: #0000BB">$source </span><span style="color: #007700">= </span><span style="color: #0000BB">show_source</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">);
|
||||
|
||||
</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$source</span><span style="color: #007700">);
|
||||
</span><span style="color: #0000BB">?>
|
||||
</span></code></pre>"
|
||||
|
@ -41,10 +41,22 @@ echo "Done\n";
|
||||
string(%d) "X-Powered-By: PHP/%s
|
||||
Content-type: text/html%r; charset=.*|%r
|
||||
|
||||
<code><span style="color: #000000">
|
||||
<br /><span style="color: #0000BB"><?php<br />$test </span><span style="color: #007700">= </span><span style="color: #DD0000">"var"</span><span style="color: #007700">; </span><span style="color: #FF8000">//var<br />/* test class */<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">test </span><span style="color: #007700">{<br /> private </span><span style="color: #0000BB">$var </span><span style="color: #007700">= array();<br /><br /> public static function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">Test $arg</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"hello"</span><span style="color: #007700">;<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">);<br /> }<br />}<br /><br /></span><span style="color: #0000BB">$o </span><span style="color: #007700">= new </span><span style="color: #0000BB">test</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?><br /></span>
|
||||
</span>
|
||||
</code>"
|
||||
<pre><code style="color: #000000">
|
||||
<span style="color: #0000BB"><?php
|
||||
$test </span><span style="color: #007700">= </span><span style="color: #DD0000">"var"</span><span style="color: #007700">; </span><span style="color: #FF8000">//var
|
||||
/* test class */
|
||||
</span><span style="color: #007700">class </span><span style="color: #0000BB">test </span><span style="color: #007700">{
|
||||
private </span><span style="color: #0000BB">$var </span><span style="color: #007700">= array();
|
||||
|
||||
public static function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">Test $arg</span><span style="color: #007700">) {
|
||||
echo </span><span style="color: #DD0000">"hello"</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">);
|
||||
}
|
||||
}
|
||||
|
||||
</span><span style="color: #0000BB">$o </span><span style="color: #007700">= new </span><span style="color: #0000BB">test</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">?>
|
||||
</span></code></pre>"
|
||||
string(%d) "Status: 404 Not Found
|
||||
X-Powered-By: PHP/%s
|
||||
Content-type: text/html%r; charset=.*|%r
|
||||
|
@ -36,10 +36,22 @@ var_dump(`$php -n -s unknown`);
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1478) "<code><span style="color: #000000">
|
||||
<br /><span style="color: #0000BB"><?php<br />$test </span><span style="color: #007700">= </span><span style="color: #DD0000">"var"</span><span style="color: #007700">; </span><span style="color: #FF8000">//var<br />/* test class */<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">test </span><span style="color: #007700">{<br /> private </span><span style="color: #0000BB">$var </span><span style="color: #007700">= array();<br /><br /> public static function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">Test $arg</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"hello"</span><span style="color: #007700">;<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">);<br /> }<br />}<br /><br /></span><span style="color: #0000BB">$o </span><span style="color: #007700">= new </span><span style="color: #0000BB">test</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?><br /></span>
|
||||
</span>
|
||||
</code>"
|
||||
string(1158) "<pre><code style="color: #000000">
|
||||
<span style="color: #0000BB"><?php
|
||||
$test </span><span style="color: #007700">= </span><span style="color: #DD0000">"var"</span><span style="color: #007700">; </span><span style="color: #FF8000">//var
|
||||
/* test class */
|
||||
</span><span style="color: #007700">class </span><span style="color: #0000BB">test </span><span style="color: #007700">{
|
||||
private </span><span style="color: #0000BB">$var </span><span style="color: #007700">= array();
|
||||
|
||||
public static function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">Test $arg</span><span style="color: #007700">) {
|
||||
echo </span><span style="color: #DD0000">"hello"</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">);
|
||||
}
|
||||
}
|
||||
|
||||
</span><span style="color: #0000BB">$o </span><span style="color: #007700">= new </span><span style="color: #0000BB">test</span><span style="color: #007700">;
|
||||
</span><span style="color: #0000BB">?>
|
||||
</span></code></pre>"
|
||||
Could not open input file: unknown
|
||||
NULL
|
||||
Done
|
||||
|
@ -13,9 +13,5 @@ $var = highlight_string("<br /><?php echo \"bar\"; ?><br />", TRUE);
|
||||
echo "\n[$var]\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<br /><span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"foo"</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span><br /></span>
|
||||
</code>
|
||||
[<code><span style="color: #000000">
|
||||
<br /><span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"bar"</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span><br /></span>
|
||||
</code>]
|
||||
<pre><code style="color: #000000"><br /><span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"foo"</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span><br /></code></pre>
|
||||
[<pre><code style="color: #000000"><br /><span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"bar"</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span><br /></code></pre>]
|
||||
|
@ -11,7 +11,4 @@ highlight.html=#000000
|
||||
highlight_string('<?php echo "foo[] $a \n"; ?>');
|
||||
?>
|
||||
--EXPECT--
|
||||
<code><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"foo[] </span><span style="color: #0000BB">$a</span><span style="color: #DD0000"> \n"</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span>
|
||||
</span>
|
||||
</code>
|
||||
<pre><code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"foo[] </span><span style="color: #0000BB">$a</span><span style="color: #DD0000"> \n"</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span></code></pre>
|
||||
|
Loading…
Reference in New Issue
Block a user