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:
Here is the info from the original 32bit machine that also sees the bug
in
5.3.3-dev:
# ./php -v
PHP 5.3.3-dev (cli) (built: Jun 11 2010 09:48:12)
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
# gcc -v
Using built-in specs.
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --
enable-bootstrap --enable-shared --enable-threads=posix --enable-
checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-
exceptions --enable-gnu-unique-object
--enable-languages=c,c++,objc,obj-
c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi
--enable-plugin --
with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile
--enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --
disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic
--with-
arch=i686 --build=i686-redhat-linux
Thread model: posix
gcc version 4.4.3 20100127 (Red Hat 4.4.3-4) (GCC)
Previous Comments:
------------------------------------------------------------------------
[2010-06-11 15:35:56] will at flourishlib dot com
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)
------------------------------------------------------------------------
[2010-06-11 15:27:41] [email protected]
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
------------------------------------------------------------------------
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