Skip to content

Commit fd3ece8

Browse files
committed
Fix bug #71086
1 parent 7a5c7e0 commit fd3ece8

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ PHP NEWS
1010
. Fixed bug #70781 (Extension tests fail on dynamic ext dependency).
1111
(Francois Laupretre)
1212
. Fixed bug #71089 (No check to duplicate zend_extension). (Remi)
13+
. Fixed bug #71086 (Invalid numeric literal parse error within
14+
highlight_string() function). (Nikita)
1315

1416
- DBA:
1517
. Fixed key leak with invalid resource. (Laruence)

Zend/tests/bug71086.phpt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Bug #71086: Invalid numeric literal parse error within highlight_string() function
3+
--FILE--
4+
<?php
5+
6+
$highlightedString = highlight_string("<?php \n 09 09 09;", true);
7+
var_dump($highlightedString);
8+
9+
?>
10+
--EXPECT--
11+
string(169) "<code><span style="color: #000000">
12+
<span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;</span><span style="color: #007700">09&nbsp;09&nbsp;09;</span>
13+
</span>
14+
</code>"

Zend/zend_highlight.c

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "zend_highlight.h"
2626
#include "zend_ptr_stack.h"
2727
#include "zend_globals.h"
28+
#include "zend_exceptions.h"
2829

2930
ZEND_API void zend_html_putc(char c)
3031
{
@@ -168,6 +169,9 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
168169
}
169170
zend_printf("</span>\n");
170171
zend_printf("</code>");
172+
173+
/* Discard parse errors thrown during tokenization */
174+
zend_clear_exception();
171175
}
172176

173177
ZEND_API void zend_strip(void)

0 commit comments

Comments
 (0)