Skip to content

Commit f907a00

Browse files
committed
Align highlight_string|file with HTML standard and modern browsers
Closes GH-11913
1 parent 4a77a1e commit f907a00

28 files changed

+143
-125
lines changed

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ PHP 8.3 UPGRADE NOTES
221221
only paths starting with `..` were disallowed. This could easily be
222222
circumvented by prepending `./` to the path.
223223
. User exception handlers now catch exceptions during shutdown.
224+
. The resultant HTML of highlight_string and highlight_file has changed.
225+
Whitespace between outer HTML tags is removed. Newlines and spaces
226+
are no longer converted to HTML entities. The whole HTML is now wrapped in
227+
<pre> tag. The outer <span> has been merged with <code>.
224228

225229
- Calendar
226230
. easter_date() now supports years from 1970 to 2,000,000,000 on 64-bit systems,

Zend/tests/bug35655.phpt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ EOT
1919
highlight_string($code);
2020
?>
2121
--EXPECT--
22-
<code><span style="color: #000000">
23-
<br /><span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;$x&nbsp;</span><span style="color: #007700">=&nbsp;&lt;&lt;&lt;EOT<br /></span><span style="color: #DD0000">some&nbsp;string&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #007700">EOT<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
24-
</span>
25-
</code>
22+
<pre><code style="color: #000000">
23+
<span style="color: #0000BB">&lt;?php
24+
$x </span><span style="color: #007700">= &lt;&lt;&lt;EOT
25+
</span><span style="color: #DD0000">some string
26+
</span><span style="color: #007700">EOT
27+
</span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;
28+
</span><span style="color: #0000BB">?&gt;</span></code></pre>

Zend/tests/bug42767.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,4 @@ highlight.html = #000000
1111
highlight_string('<?php /*some comment..');
1212
?>
1313
--EXPECT--
14-
<code><span style="color: #000000">
15-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #FF8000">/*some&nbsp;comment..</span>
16-
</span>
17-
</code>
14+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #FF8000">/*some comment..</span></code></pre>

Zend/tests/bug71086.phpt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ var_dump($highlightedString);
88

99
?>
1010
--EXPECT--
11-
string(169) "<code><span style="color: #000000">
12-
<span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;09&nbsp;09&nbsp;09</span><span style="color: #007700">;</span>
13-
</span>
14-
</code>"
11+
string(139) "<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
12+
09 09 09</span><span style="color: #007700">;</span></code></pre>"

Zend/tests/nowdoc_013.phpt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ EOF;
2020
highlight_string($code);
2121
?>
2222
--EXPECT--
23-
<code><span style="color: #000000">
24-
<span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;$x&nbsp;</span><span style="color: #007700">=&nbsp;&lt;&lt;&lt;'EOT'<br /></span><span style="color: #DD0000">some&nbsp;string&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #007700">EOT<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
25-
</span>
26-
</code>
23+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
24+
$x </span><span style="color: #007700">= &lt;&lt;&lt;'EOT'
25+
</span><span style="color: #DD0000">some string
26+
</span><span style="color: #007700">EOT
27+
</span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;
28+
</span><span style="color: #0000BB">?&gt;</span></code></pre>

Zend/tests/nowdoc_014.phpt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ EOF;
1818
highlight_string($code);
1919
?>
2020
--EXPECT--
21-
<code><span style="color: #000000">
22-
<span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;$x&nbsp;</span><span style="color: #007700">=&nbsp;&lt;&lt;&lt;'EOT'<br />EOT<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
23-
</span>
24-
</code>
21+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
22+
$x </span><span style="color: #007700">= &lt;&lt;&lt;'EOT'
23+
EOT
24+
</span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;
25+
</span><span style="color: #0000BB">?&gt;</span></code></pre>

Zend/zend_highlight.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
ZEND_API void zend_html_putc(char c)
2929
{
3030
switch (c) {
31-
case '\n':
32-
ZEND_PUTS("<br />");
33-
break;
3431
case '<':
3532
ZEND_PUTS("&lt;");
3633
break;
@@ -40,11 +37,8 @@ ZEND_API void zend_html_putc(char c)
4037
case '&':
4138
ZEND_PUTS("&amp;");
4239
break;
43-
case ' ':
44-
ZEND_PUTS("&nbsp;");
45-
break;
4640
case '\t':
47-
ZEND_PUTS("&nbsp;&nbsp;&nbsp;&nbsp;");
41+
ZEND_PUTS(" ");
4842
break;
4943
default:
5044
ZEND_PUTC(c);
@@ -88,8 +82,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
8882
char *last_color = syntax_highlighter_ini->highlight_html;
8983
char *next_color;
9084

91-
zend_printf("<code>");
92-
zend_printf("<span style=\"color: %s\">\n", last_color);
85+
zend_printf("<pre><code style=\"color: %s\">", last_color);
9386
/* highlight stuff coming back from zendlex() */
9487
while ((token_type=lex_scan(&token, NULL))) {
9588
switch (token_type) {
@@ -162,10 +155,9 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
162155
}
163156

164157
if (last_color != syntax_highlighter_ini->highlight_html) {
165-
zend_printf("</span>\n");
158+
zend_printf("</span>");
166159
}
167-
zend_printf("</span>\n");
168-
zend_printf("</code>");
160+
zend_printf("</code></pre>");
169161

170162
/* Discard parse errors thrown during tokenization */
171163
zend_clear_exception();

ext/phar/tests/cache_list/frontcontroller15.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@ files/frontcontroller8.phar
1414
--EXPECTHEADERS--
1515
Content-type: text/html; charset=UTF-8
1616
--EXPECT--
17-
<code><span style="color: #000000">
18-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
19-
</span>
20-
</code>
17+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/cache_list/frontcontroller3.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@ files/frontcontroller.phar
1414
--EXPECTHEADERS--
1515
Content-type: text/html; charset=UTF-8
1616
--EXPECT--
17-
<code><span style="color: #000000">
18-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
19-
</span>
20-
</code>
17+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/cache_list/frontcontroller9.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@ files/frontcontroller3.phar
1414
--EXPECTHEADERS--
1515
Content-type: text/html; charset=UTF-8
1616
--EXPECT--
17-
<code><span style="color: #000000">
18-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
19-
</span>
20-
</code>
17+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/frontcontroller15.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ files/frontcontroller8.phar
1313
--EXPECTHEADERS--
1414
Content-type: text/html; charset=UTF-8
1515
--EXPECT--
16-
<code><span style="color: #000000">
17-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
18-
</span>
19-
</code>
16+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/frontcontroller3.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ files/frontcontroller.phar
1313
--EXPECTHEADERS--
1414
Content-type: text/html; charset=UTF-8
1515
--EXPECT--
16-
<code><span style="color: #000000">
17-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
18-
</span>
19-
</code>
16+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/frontcontroller9.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ files/frontcontroller3.phar
1313
--EXPECTHEADERS--
1414
Content-type: text/html; charset=UTF-8
1515
--EXPECT--
16-
<code><span style="color: #000000">
17-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
18-
</span>
19-
</code>
16+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/tar/frontcontroller15.phar.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ files/frontcontroller8.phar.tar
1313
--EXPECTHEADERS--
1414
Content-type: text/html; charset=UTF-8
1515
--EXPECT--
16-
<code><span style="color: #000000">
17-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
18-
</span>
19-
</code>
16+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/tar/frontcontroller3.phar.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ files/frontcontroller.phar.tar
1313
--EXPECTHEADERS--
1414
Content-type: text/html; charset=UTF-8
1515
--EXPECT--
16-
<code><span style="color: #000000">
17-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
18-
</span>
19-
</code>
16+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/tar/frontcontroller9.phar.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ files/frontcontroller3.phar.tar
1313
--EXPECTHEADERS--
1414
Content-type: text/html; charset=UTF-8
1515
--EXPECT--
16-
<code><span style="color: #000000">
17-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
18-
</span>
19-
</code>
16+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/zip/frontcontroller15.phar.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,4 @@ files/frontcontroller8.phar.zip
1515
--EXPECTHEADERS--
1616
Content-type: text/html; charset=UTF-8
1717
--EXPECT--
18-
<code><span style="color: #000000">
19-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
20-
</span>
21-
</code>
18+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/zip/frontcontroller3.phar.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,4 @@ files/frontcontroller.phar.zip
1515
--EXPECTHEADERS--
1616
Content-type: text/html; charset=UTF-8
1717
--EXPECT--
18-
<code><span style="color: #000000">
19-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
20-
</span>
21-
</code>
18+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/phar/tests/zip/frontcontroller9.phar.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ files/frontcontroller3.phar.zip
1313
--EXPECTHEADERS--
1414
Content-type: text/html; charset=UTF-8
1515
--EXPECT--
16-
<code><span style="color: #000000">
17-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>
18-
</span>
19-
</code>
16+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">function </span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span></code></pre>

ext/standard/tests/general_functions/highlight_heredoc.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ DDDD;
1616
highlight_string($str);
1717
?>
1818
--EXPECT--
19-
<code><span style="color: #000000">
20-
<br />$x=&lt;&lt;&lt;DD<br />jhdsjkfhjdsh<br />DD<br />."";<br />$a=&lt;&lt;&lt;DDDD<br />jhdsjkfhjdsh<br />DDDD;<br /></span>
21-
</code>
19+
<pre><code style="color: #000000">
20+
$x=&lt;&lt;&lt;DD
21+
jhdsjkfhjdsh
22+
DD
23+
."";
24+
$a=&lt;&lt;&lt;DDDD
25+
jhdsjkfhjdsh
26+
DDDD;
27+
</code></pre>

ext/standard/tests/strings/highlight_file.phpt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,14 @@ Warning: highlight_file(%shighlight_file.dat): Failed to open stream: No such fi
4242

4343
Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d
4444
bool(false)
45-
<code><span style="color: #000000">
46-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"test"</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">?&gt;</span>
47-
</span>
48-
</code>bool(true)
49-
<code><span style="color: #000000">
50-
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"test&nbsp;?&gt;</span>
51-
</span>
52-
</code>bool(true)
53-
<code><span style="color: #000000">
54-
<br /><span style="color: #0000BB">&lt;?php<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;public&nbsp;</span><span style="color: #0000BB">$var&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">()&nbsp;{&nbsp;echo&nbsp;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">bar</span><span style="color: #007700">()&nbsp;{&nbsp;</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">());&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
55-
</span>
56-
</code>bool(true)
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)
5755
Done

ext/standard/tests/strings/show_source_basic.phpt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,19 @@ show_source(__FILE__);
2121
?>
2222
--EXPECT--
2323
*** Test by calling method or function with its expected arguments ***
24-
<code><span style="color: #000000">
25-
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"***&nbsp;Test&nbsp;by&nbsp;calling&nbsp;method&nbsp;or&nbsp;function&nbsp;with&nbsp;its&nbsp;expected&nbsp;arguments&nbsp;***\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$baz&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"something&nbsp;"</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&nbsp;(&nbsp;</span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'bar'&nbsp;</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$baz&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'baz'</span><span style="color: #007700">;<br />}<br /><br />&nbsp;</span><span style="color: #FF8000">/*&nbsp;some&nbsp;code&nbsp;here&nbsp;*/<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">?&gt;<br /></span>
26-
</span>
27-
</code>
24+
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
25+
</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">;
26+
</span><span style="color: #0000BB">$foo </span><span style="color: #007700">= </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;
27+
</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">;
28+
29+
if ( </span><span style="color: #0000BB">$foo </span><span style="color: #007700">== </span><span style="color: #DD0000">'bar' </span><span style="color: #007700">)
30+
{
31+
</span><span style="color: #0000BB">$baz </span><span style="color: #007700">= </span><span style="color: #DD0000">'baz'</span><span style="color: #007700">;
32+
}
33+
34+
</span><span style="color: #FF8000">/* some code here */
35+
36+
</span><span style="color: #0000BB">show_source</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);
37+
38+
</span><span style="color: #0000BB">?&gt;
39+
</span></code></pre>

0 commit comments

Comments
 (0)