com php-src: Fix bug #71086: NEWS Zend/tests/bug71086.phpt Zend/zend_highlight.c
| From: | Nikita Popov | Date: | Fri, 11 Dec 2015 15:05:49 +0000 |
| Subject: | com php-src: Fix bug #71086: NEWS Zend/tests/bug71086.phpt Zend/zend_highlight.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90232@lists.php.net to get a copy of this message | ||
Commit: fd3ece8578326410ccd045332c57e6fec5a88bad
Author: Nikita Popov <nikic@php.net> Fri, 11 Dec 2015 16:04:32 +0100
Parents: 7a5c7e00cda34ecc5cfff8c614bbeab884aea282
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fd3ece8578326410ccd045332c57e6fec5a88bad
Log:
Fix bug #71086
Bugs:
https://bugs.php.net/71086
Changed paths:
M NEWS
A Zend/tests/bug71086.phpt
M Zend/zend_highlight.c
Diff:
diff --git a/NEWS b/NEWS
index 7f45f98..89c5fa8 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ PHP NEWS
. Fixed bug #70781 (Extension tests fail on dynamic ext dependency).
(Francois Laupretre)
. Fixed bug #71089 (No check to duplicate zend_extension). (Remi)
+ . Fixed bug #71086 (Invalid numeric literal parse error within
+ highlight_string() function). (Nikita)
- DBA:
. Fixed key leak with invalid resource. (Laruence)
diff --git a/Zend/tests/bug71086.phpt b/Zend/tests/bug71086.phpt
new file mode 100644
index 0000000..a7600c5
--- /dev/null
+++ b/Zend/tests/bug71086.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #71086: Invalid numeric literal parse error within highlight_string() function
+--FILE--
+<?php
+
+$highlightedString = highlight_string("<?php \n 09 09 09;", true);
+var_dump($highlightedString);
+
+?>
+--EXPECT--
+string(169) "<code><span style="color: #000000">
+<span style="color: #0000BB"><?php <br
/> </span><span style="color:
#007700">09 09 09;</span>
+</span>
+</code>"
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
index 4f870af..94ba948 100644
--- a/Zend/zend_highlight.c
+++ b/Zend/zend_highlight.c
@@ -25,6 +25,7 @@
#include "zend_highlight.h"
#include "zend_ptr_stack.h"
#include "zend_globals.h"
+#include "zend_exceptions.h"
ZEND_API void zend_html_putc(char c)
{
@@ -168,6 +169,9 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
}
zend_printf("</span>\n");
zend_printf("</code>");
+
+ /* Discard parse errors thrown during tokenization */
+ zend_clear_exception();
}
ZEND_API void zend_strip(void)