php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55378 binary number literal returns float number though its value is enough small
Submitted: 2011-08-07 01:37 UTC Modified: 2013-10-05 08:26 UTC
Votes:7
Avg. Score:2.6 ± 1.0
Reproduced:2 of 4 (50.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: for-bugs at hnw dot jp Assigned: krakjoe (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.4.0alpha3 OS: MacOSX
Private report: No CVE-ID: None
 [2011-08-07 01:37 UTC] for-bugs at hnw dot jp
Description:
------------
The binary numbers format(see #50648, https://bugs.php.net/bug.php?id=50648)
was introduced to PHP 5.4.0alpha3.

However, its boundary value is wrong for judging whether return value shoud be integer or floating point number. See test script.

Test script:
---------------
<?php
var_dump(0b1111111);
var_dump(0b1111111111111111);


Expected result:
----------------
int(127)
int(65535)

Actual result:
--------------
int(127)
float(65535)

Patches

fix-binary-numbers-format-returns-int-or-float (last revision 2011-08-07 01:38 UTC by for-bugs at hnw dot jp)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-07 17:13 UTC] derick@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: derickr
 [2011-08-07 17:13 UTC] derick@php.net
-Assigned To: derickr +Assigned To: derick
 [2011-08-07 17:36 UTC] derick@php.net
Automatic comment from SVN on behalf of derick
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=314443
Log: - Fixed bug #55378: binary number literal returns float number though its value
  is enough small
 [2011-08-07 17:37 UTC] derick@php.net
-Status: Assigned +Status: To be documented
 [2011-08-07 17:37 UTC] derick@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fixed in SVN, but binary literals need to be mentioned at http://www.php.net/manual/en/language.types.integer.php
 [2011-11-25 14:10 UTC] derick@php.net
-Package: Scripting Engine problem +Package: Documentation problem -Assigned To: derick +Assigned To:
 [2012-04-18 09:49 UTC] laruence@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=20936960b5abaefa184372cc23fee1230f2f66f4
Log: - Fixed bug #55378: binary number literal returns float number though its value   is enough small
 [2012-07-24 23:40 UTC] rasmus@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=20936960b5abaefa184372cc23fee1230f2f66f4
Log: - Fixed bug #55378: binary number literal returns float number though its value   is enough small
 [2013-10-05 08:26 UTC] krakjoe@php.net
Automatic comment from SVN on behalf of krakjoe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=331688
Log: #55378 add a binary example in docs, original bug resolved for some time.
 [2013-10-05 08:26 UTC] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2013-10-05 08:26 UTC] krakjoe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2013-11-17 09:37 UTC] laruence@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=20936960b5abaefa184372cc23fee1230f2f66f4
Log: - Fixed bug #55378: binary number literal returns float number though its value   is enough small
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC