Bug #73172 [Csd]: parse error: Invalid numeric literal

From: Date: Mon, 26 Sep 2016 17:33:53 +0000
Subject: Bug #73172 [Csd]: parse error: Invalid numeric literal
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204288@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73172&edit=1 ID: 73172 Updated by: ab@php.net Reported by: elbazmichael92 at gmail dot com Summary: parse error: Invalid numeric literal Status: Closed Type: Bug Package: *General Issues Operating System: Windows 7 PHP Version: 7.0.11 -Assigned To: +Assigned To: ab Block user comment: N Private report: N New Comment: Nice catch, Nikita! In PHP 5 strtod implementation the locale is simply ignored, but in the upgraded strtod code it handles the decimal point. But strings from PHP should only be accepted with '.'. @elbazmichael92, please check the latest http://windows.php.net/snapshots/ . Thanks. Previous Comments: ------------------------------------------------------------------------ [2016-09-26 16:56:12] ab@php.net Automatic comment on behalf of ab Revision: http://git.php.net/?p=php-src.git;a=commit;h=39e599170532f64fd433dd68aa79bc0dcbda4689 Log: Fixed bug #73172 parse error: Invalid numeric literal ------------------------------------------------------------------------ [2016-09-26 09:46:06] nikic@php.net It looks like we're using strtod compiled with USE_LOCALE, something we probably shouldn't be doing. ------------------------------------------------------------------------ [2016-09-26 09:01:02] elbazmichael92 at gmail dot com to reproduc the bug you need use two file: a.php <?php setlocale(LC_ALL, 'fr_FR.utf8', 'fra'); //LC_ALL require 'patch.php'; then in patch.php <?php function t($a, $x, $y){ return; } t('test', 2147483649, 'test'); the probleme is with the setlocal function in cli mode and php > 7 version its not happen with previous version. ------------------------------------------------------------------------ [2016-09-26 08:14:46] elbazmichael92 at gmail dot com this is happen only with this configuration setlocale(LC_ALL, 'fr_FR.utf8', 'fra'); ------------------------------------------------------------------------ [2016-09-26 07:44:29] elbazmichael92 at gmail dot com Description: ------------ On php cli only (all version > 7) this code will throw parse error: Invalid numeric literal the problem only with int parameter greater than 2147483647 (unsigned int) function test($a, $x, $y){ return; } test('test', 2147483648, 'test'); the only solution i found is to add space after the int parameter: test('test', 2147483648 , 'test'); i found this bug using the phpseclib lib class SFTP line 1294. Test script: --------------- function test($a, $x, $y){ return; } test('test', 2147483648, 'test'); Expected result: ---------------- running without error Actual result: -------------- Parse error: Invalid numeric literal ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73172&edit=1

« previous php.bugs (#204288) next »