Bug #61740 [Ver]: base_convert skips over out-of-range or unknown characters

From: Date: Thu, 30 Jun 2016 12:12:58 +0000
Subject: Bug #61740 [Ver]: base_convert skips over out-of-range or unknown characters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201937@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61740&edit=1 ID: 61740 Updated by: cmb@php.net Reported by: hholzgra@php.net Summary: base_convert skips over out-of-range or unknown characters Status: Verified Type: Bug Package: Math related Operating System: linux PHP Version: master-Git-2012-04-15 (Git) Block user comment: N Private report: N New Comment: While fixing this issue is trivial (for instance, the attached patch base-convert-notice would raise E_NOTICE, but continue processing), it would cause BC break: I got 9 failing PHPTs and maybe even worse, _php_math_basetozval() is declared as PHP_API. Previous Comments: ------------------------------------------------------------------------ [2016-06-30 12:10:07] cmb@php.net The following patch has been added/updated: Patch Name: base-convert-notice Revision: 1467288606 URL: https://bugs.php.net/patch-display.php?bug=61740&patch=base-convert-notice&revision=1467288606 ------------------------------------------------------------------------ [2016-06-30 11:43:08] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339532 Log: Address #61740: base_convert skips over out-of-range or unknown characters ------------------------------------------------------------------------ [2016-06-30 11:35:46] cmb@php.net Confirmed: <https://3v4l.org/kqOBk>. Apparently, *any* invalid characters in $number are silently ignored. ------------------------------------------------------------------------ [2012-04-15 21:44:29] hholzgra@php.net Description: ------------ e.g. base_convert(101,10,10) and base_convert(10.1,10,10) return the same result as the decimal dot character is simply ignored/skipped over (found in the user notes on base_convert() in the manual) Test script: --------------- echo base_convert("10@23",10,10); Expected result: ---------------- 10 // or an error Actual result: -------------- 1023 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61740&edit=1

« previous php.bugs (#201937) next »