php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61740 base_convert skips over out-of-range or unknown characters
Submitted: 2012-04-15 21:44 UTC Modified: 2016-06-30 12:12 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: hholzgra@php.net Assigned:
Status: Verified Package: Math related
PHP Version: master-Git-2012-04-15 (Git) OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hholzgra@php.net
New email:
PHP Version: OS:

 

 [2012-04-15 21:44 UTC] 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

Patches

base-convert-notice (last revision 2016-06-30 12:10 UTC by cmb@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-30 11:35 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2016-06-30 11:35 UTC] cmb@php.net
Confirmed: <https://3v4l.org/kqOBk>. Apparently, *any* invalid
characters in $number are silently ignored.
 [2016-06-30 11:43 UTC] 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 12:10 UTC] 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 12:12 UTC] cmb@php.net
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.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Wed Dec 12 10:01:25 2018 UTC