#30970 [NEW]: 32bits not supported?

2004-12-02 Thread wboring at qualys dot com
From: wboring at qualys dot com
Operating system: linux
PHP version:  5.0.2
PHP Bug Type: Scripting Engine problem
Bug description:  32bits not supported?

Description:

If I set an integer to a value of 0x8000, it works properly in php4,
but in php5 the value becomes 0x7FFF.


My configure line:
./configure \
--with-oci8=/u01/app/oracle/product/8.1.7 \
--enable-sigchild \
--with-mcrypt \
--with-gd \
--with-png-dir=/usr \
--with-jpeg-dir=/usr \
--with-zlib-dir=/usr \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--with-xml \
--with-zlib \
--with-gdbm \
--with-dom \
--with-curl=/usr \
--with-mysql=/usr \
--enable-mbstring \
--enable-tokenizer \
--enable-sockets \
--with-kerberos=/usr/kerberos \
--with-openssl \
--disable-cgi \
--with-xsl \
--with-bz2 \
--with-mhash \
--enable-soap \
--with-flatfile \
--with-inifile \
--with-curlwrappers \
--with-apxs=/usr/local/apache/bin/apxs







Reproduce code:
---
?php
  $n = 0x8000;
  printf('%b', $n);
?


Expected result:

php4.3.9: 1000
php5.0.2: 1000
 

Actual result:
--
php4.3.9: 1000
php5.0.2: 111

-- 
Edit bug report at http://bugs.php.net/?id=30970edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30970r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=30970r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=30970r=trysnapshot51
Fixed in CVS:http://bugs.php.net/fix.php?id=30970r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=30970r=alreadyfixed
Need backtrace:  http://bugs.php.net/fix.php?id=30970r=needtrace
Need Reproduce Script:   http://bugs.php.net/fix.php?id=30970r=needscript
Try newer version:   http://bugs.php.net/fix.php?id=30970r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30970r=support
Expected behavior:   http://bugs.php.net/fix.php?id=30970r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=30970r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=30970r=submittedtwice
register_globals:http://bugs.php.net/fix.php?id=30970r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30970r=php3
Daylight Savings:http://bugs.php.net/fix.php?id=30970r=dst
IIS Stability:   http://bugs.php.net/fix.php?id=30970r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30970r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30970r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30970r=mysqlcfg


#30970 [Opn]: 32bits not supported?

2004-12-02 Thread wboring at qualys dot com
 ID:   30970
 User updated by:  wboring at qualys dot com
 Reported By:  wboring at qualys dot com
 Status:   Open
 Bug Type: Scripting Engine problem
 Operating System: linux
 PHP Version:  5.0.2
 New Comment:

If I do a simple var_dump( 0x8000 ); in php4 and 5 I get the same
result of float(2147483648).

If I try and do something like

$n ^= 0x8000;  //to flip the high bit, then it breaks.

?php 
  $n = -1979053311;
  var_dump( sprintf('%32b',$n).'  '.$n);
  $n ^= 0x8000; // flip the high (sign) bit
  var_dump( sprintf('%32b',$n).'  '.$n );
?

php4.3.9 : 
string(45) 10001010101010110001  -1979053311
string(43) 1010101010110001  168430337

php5.0.2 :
string(32) 10001010101010110001  -1979053311 
string(44) 0101010101001110 -168430338


Previous Comments:


[2004-12-03 00:46:39] wboring at qualys dot com

Description:

If I set an integer to a value of 0x8000, it works properly in
php4, but in php5 the value becomes 0x7FFF.


My configure line:
./configure \
--with-oci8=/u01/app/oracle/product/8.1.7 \
--enable-sigchild \
--with-mcrypt \
--with-gd \
--with-png-dir=/usr \
--with-jpeg-dir=/usr \
--with-zlib-dir=/usr \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--with-xml \
--with-zlib \
--with-gdbm \
--with-dom \
--with-curl=/usr \
--with-mysql=/usr \
--enable-mbstring \
--enable-tokenizer \
--enable-sockets \
--with-kerberos=/usr/kerberos \
--with-openssl \
--disable-cgi \
--with-xsl \
--with-bz2 \
--with-mhash \
--enable-soap \
--with-flatfile \
--with-inifile \
--with-curlwrappers \
--with-apxs=/usr/local/apache/bin/apxs







Reproduce code:
---
?php
  $n = 0x8000;
  printf('%b', $n);
?


Expected result:

php4.3.9: 1000
php5.0.2: 1000
 

Actual result:
--
php4.3.9: 1000
php5.0.2: 111





-- 
Edit this bug report at http://bugs.php.net/?id=30970edit=1