Bug #71806 [Csd]: php_strip_whitespace() fails on some numerical values

From: Date: Sat, 12 Mar 2016 05:13:29 +0000
Subject: Bug #71806 [Csd]: php_strip_whitespace() fails on some numerical values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199774@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71806&edit=1 ID: 71806 Updated by: requinix@php.net Reported by: gregzem at inbox dot ru Summary: php_strip_whitespace() fails on some numerical values Status: Closed Type: Bug Package: Scripting Engine problem Operating System: ANY PHP Version: 7.0.4 -Assigned To: +Assigned To: requinix Block user comment: N Private report: N New Comment: To be clear, 0987654321 *isn't* a valid number: the leading 0 indicates octal and '9' and '8' are not allowed in octal. Trying to execute testfile.php (in PHP 7) will produce the parse error. http://php.net/manual/en/language.types.integer.php#language.types.integer.syntax > Warning > Prior to PHP 7, if an invalid digit was given in an octal integer (i.e. 8 or > 9), the rest of the number was ignored. Since PHP 7, a parse error is emitted. @nikic's fix only *suppresses* the error when running that code through php_strip_whitespace(). Previous Comments: ------------------------------------------------------------------------ [2016-03-11 21:46:45] nikic@php.net Automatic comment on behalf of nikic Revision: http://git.php.net/?p=php-src.git;a=commit;h=02743f43c2de313e30320f2fb2d995937ce9881b Log: Fixed bug #71806 ------------------------------------------------------------------------ [2016-03-11 21:25:12] gregzem at inbox dot ru Description: ------------ If the source contains digits starting with 0, php_strip_whitespace() fails to process the source and produces the parser error. <?php echo 0987654321; ?> This source will generate the following error: PHP Parse error: Invalid numeric literal in testfile.php on line 2 Test script: --------------- testfile.php <?php echo 0987654321; ?> test.php: <?php $test = php_strip_whitespace('testfile.php'); ?> Expected result: ---------------- php_strip_whitespace processes the file without any errors. Actual result: -------------- php_strip_whitespace generates PHP Parse error: Invalid numeric literal in testfile.php on line 2 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71806&edit=1

« previous php.bugs (#199774) next »