ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#50080 [NEW]: 1 bit short of an 8 byte integer
by Aidevelopment At Gmail Dot Com other posts by this author
Nov 4 2009 8:17AM messages near this date
#50082 [Opn->Bgs]: Incorrect test vector CFB/OFB results for Blowfish encryption | #50080 [Bgs]: 1 bit short of an 8 byte integer
From:             aidevelopment at gmail dot com
Operating system: Linux 2.6.15-26-server
PHP version:      5.2.11
PHP Bug Type:     Variables related
Bug description:  1 bit short of an 8 byte integer

Description:
------------
Despite having PHP_INT_MAX set to 8 bytes, It is impossible to have an int
greater than
1000000000000000000000000000000000000000000000000000000000000000.
8 Byte, or 64 bit maximum should be
1111111111111111111111111111111111111111111111111111111111111111.

In my included example, it is clear that when attempting to increase the
value above(by adding 1), simply nothing happens.

Attempting to assign a variable to a number greater than the above number
produces unpredictable results.


Reproduce code:
---------------
<?php
echo "Int Size = ".PHP_INT_SIZE." bytes.<br> ";
$status = 0x7FFFFFFFFFFFFFFF;
for($i=0;$i<=4;$i++)
{
        printf ("status = '%b'<br> ", $status);
        $status++;
}
?> 


Expected result:
----------------
Int Size = 8 bytes.
status =
'111111111111111111111111111111111111111111111111111111111111111'
status =
'1000000000000000000000000000000000000000000000000000000000000000'
status =
'1000000000000000000000000000000000000000000000000000000000000001'
status =
'1000000000000000000000000000000000000000000000000000000000000010'
status =
'1000000000000000000000000000000000000000000000000000000000000011'

Actual result:
--------------
Int Size = 8 bytes.
status =
'111111111111111111111111111111111111111111111111111111111111111'
status =
'1000000000000000000000000000000000000000000000000000000000000000'
status =
'1000000000000000000000000000000000000000000000000000000000000000'
status =
'1000000000000000000000000000000000000000000000000000000000000000'
status =
'1000000000000000000000000000000000000000000000000000000000000000'

-- 
Edit bug report at http://bugs.php.net/?id=50080&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=50080&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=50080&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=50080&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=50080&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50080&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=50080&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=50080&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=50080&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=50080&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=50080&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=50080&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=50080&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=50080&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=50080&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50080&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50080&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=50080&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=50080&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=50080&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=50080&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=50080&r=mysqlcfg
Thread:
Aidevelopment At Gmail Dot Com
Aidevelopment At Gmail Dot Com
jani
Aidevelopment At Gmail Dot Com
sjoerd

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved