php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71086 Invalid numeric literal parse error within highlight_string() function
Submitted: 2015-12-10 21:06 UTC Modified: 2015-12-10 21:13 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: chris at xenforo dot com Assigned: nikic
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0Git-2015-12-10 (Git) OS: Ubuntu 14.04 x64
Private report: No CVE-ID:
 [2015-12-10 21:06 UTC] chris at xenforo dot com
Description:
------------
I have reproduced this issue with PHP 7.0 stable and have since updated to:
PHP 7.0.2-dev (cli) (built: Dec  9 2015 20:09:53) ( NTS )


If you test the script below, you will see a parse error, "Invalid numeric literal".

Although, technically, the code used within highlight_string function below is indeed invalid, I don't believe this should actually manifest itself as a parse error. After all, you can throw pretty much anything in there, valid or invalid, and not otherwise get any problems, so a parse error here for this specific case seems unexpected.

Test script:
---------------
<?php

$highlightedString = highlight_string("<?php \n 09;", true);
var_dump($highlightedString);

?>

Expected result:
----------------
The parse error should be suppressed.

Actual result:
--------------
ParseError: Invalid numeric literal

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-10 21:13 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2015-12-11 15:06 UTC] nikic@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fd3ece8578326410ccd045332c57e6fec5a88bad
Log: Fix bug #71086
 [2015-12-11 15:06 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 [2016-07-20 11:34 UTC] davey@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fd3ece8578326410ccd045332c57e6fec5a88bad
Log: Fix bug #71086
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Feb 19 11:01:37 2017 UTC