Bug #51430 [Opn]: Numeric string array key is being implicitly cast to 32bit int and overflowing

From: Date: Fri, 11 Jun 2010 13:35:57 +0000
Subject: Bug #51430 [Opn]: Numeric string array key is being implicitly cast to 32bit int and overflowing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-151336@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51430&edit=1

 ID:               51430
 User updated by:  will at flourishlib dot com
 Reported by:      will at flourishlib dot com
 Summary:          Numeric string array key is being implicitly cast to
                   32bit int and overflowing
 Status:           Open
 Type:             Bug
 Package:          Scripting Engine problem
 Operating System: Fedora 12
 PHP Version:      5.3.2

 New Comment:

Both 5.3.3-dev and trunk were built on the following machine:

# uname -a
Linux vm-opensuse 2.6.31.12-0.1-desktop #1 SMP PREEMPT 2010-01-27
08:20:11 +0100 i686 i686 i386 GNU/Linux

# gcc -v
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib 
--libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-
gxx-include-dir=/usr/include/c++/4.4 --enable-ssp --disable-libssp
--with-bugurl=http://bugs.opensuse.org/ --
with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap
--with-slibdir=/lib --with-system-zlib --
enable-__cxa_atexit --enable-libstdcxx-allocator=new
--disable-libstdcxx-pch --enable-version-specific-runtime-
libs --program-suffix=-4.4 --enable-linux-futex
--without-system-libunwind --with-arch-32=i586 --with-
tune=generic --build=i586-suse-linux
Thread model: posix
gcc version 4.4.1 [gcc-4_4-branch revision 150839] (SUSE Linux)


Previous Comments:
------------------------------------------------------------------------
[2010-06-11 15:27:41] colder@php.net

Apparently it's still reproducible in some environments with the latest
5.3 
snapshot, Not on mine though.

------------------------------------------------------------------------
[2010-06-11 15:24:50] will at flourishlib dot com

I just built php-trunk and got the same bug:

# wget http://snaps.php.net/php-trunk-201006111230.tar.bz2
# tar xvfj php-trunk-201006111230.tar.bz2
# cd php-trunk-201006111230/
# ./configure
# make
# cd sapi/cli/

# ./php -v
PHP 5.3.99-dev (cli) (built: Jun 11 2010 09:19:41)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2010 Zend Technologies

# ./php -r 'print_r(array("-2147483649" => TRUE, "-2147483648" =>
FALSE));'
Array
(
    [2147483647] => 1
    [-2147483648] =>
)

This is on a 32bit OpenSUSE machine:
# uname -a
Linux vm-opensuse 2.6.31.12-0.1-desktop #1 SMP PREEMPT 2010-01-27
08:20:11 +0100 
i686 i686 i386 GNU/Linux

------------------------------------------------------------------------
[2010-06-11 15:05:45] will at flourishlib dot com

I just built 5.3.3-dev and I am still having the same bug:

# wget http://snaps.php.net/php5.3-201006111230.tar.bz2
# tar xvfj php5.3-201006111230.tar.bz2
# cd php5.3-201006111230/
# ./configure
# make
# cd sapi/cli/

# ./php -v
PHP 5.3.3-dev (cli) (built: Jun 11 2010 08:57:11)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

# ./php -r 'print_r(array("-2147483649" => TRUE, "-2147483648" =>
FALSE));'
Array
(
    [2147483647] => 1
    [-2147483648] =>
)

------------------------------------------------------------------------
[2010-06-09 23:10:00] will at flourishlib dot com

On my 32bit Fedora 12 box this does occur with 5.3.2. That seems to
suggest me a 
32/64bit issue. Below is the output:

# php -v
PHP 5.3.2 (cli) (built: Apr 27 2010 17:55:02)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

# php -r 'print_r(array("-2147483649" => TRUE, "-2147483648" =>
FALSE));'
Array
(
    [2147483647] => 1
    [-2147483648] =>
)

# uname -a
Linux vm-fedora 2.6.31.12-174.2.22.fc12.i686.PAE #1 SMP Fri Feb 19
19:10:04 UTC 
2010 i686 i686 i386 GNU/Linux

------------------------------------------------------------------------
[2010-06-08 14:27:40] tony2001@php.net

Not reproducible with 5.3.2, 5.3.3-dev and trunk on 64bit Linux.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=51430


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


Thread (11 messages)

« previous php.bugs (#151336) next »