php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53632 PHP hangs on numeric value 2.2250738585072011e-308
Submitted: 2010-12-30 06:58 UTC Modified: 2011-01-10 19:15 UTC
Votes:164
Avg. Score:4.4 ± 1.0
Reproduced:80 of 103 (77.7%)
Same Version:47 (58.8%)
Same OS:45 (56.2%)
From: exploringbinary at gmail dot com Assigned: pajoye (profile)
Status: Closed Package: Math related
PHP Version: 5.3.4 OS:
Private report: No CVE-ID: 2010-4645
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: exploringbinary at gmail dot com
New email:
PHP Version: OS:

Further comment on this bug is unnecessary.

 

 [2010-12-30 06:58 UTC] exploringbinary at gmail dot com
Description:
------------
If I assign the value 2.2250738585072011e-308 to a variable, e.g. $d = 2.2250738585072011e-308, PHP hangs (loops). I am using PHP 5.3.1 XAMPP 1.7.3 on Windows.

2.2250738585072011e-308 represents the largest subnormal double-precision floating-point number, 0.1111111111111111111111111111111111111111111111111111 x 2^-1022. Interestingly, nearby decimal literals 2.2250738585072008e-308, 2.2250738585072009e-308, 2.2250738585072010e-308 and 2.2250738585072012e-308 -- which all convert to the same floating-point value -- do not cause this problem.




Test script:
---------------
<?php $d = 2.2250738585072011e-308; ?>

Expected result:
----------------
No Hang.

Actual result:
--------------
Hang.

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-02 16:44 UTC] exploringbinary at gmail dot com
(Remove 2.2250738585072012e-308 from my list of examples; it does NOT map to the same floating-point number as 2.2250738585072011e-308 -- when converted correctly!)
 [2011-01-02 16:49 UTC] pajoye@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: dmitry
 [2011-01-02 16:49 UTC] pajoye@php.net
Dmitry, can you take a look at it please?
 [2011-01-02 16:52 UTC] exploringbinary at gmail dot com
I also get the same problem on Linux (PHP Version 5.3.2-1ubuntu4.5).
 [2011-01-02 17:05 UTC] pajoye@php.net
-Operating System: Windows +Operating System:
 [2011-01-04 06:48 UTC] cswarth at gmail dot com
Doesn't happen on a mac.

$ php -v
PHP 5.3.1 (cli) (built: Feb 11 2010 02:32:22) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

$ php -r "print 2.2250738585072011e-308;"
2.2250738585072E-308
 [2011-01-04 08:31 UTC] yuv dot adm at gmail dot com
Does not reproduce on a mac, confirmed:

mac:junk yuval$ cat p.php 
<?php
echo "a";
$d = 2.2250738585072011e-308; 
echo "b\n";
mac:junk yuval$ php p.php 
ab
mac:junk yuval$ php -v
PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
 [2011-01-04 08:55 UTC] aquilax at gmail dot com
It hangs on Debian:


aquilax@zelda /tmp> php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/lib/php5/20090626+lfs/adodb.so' - /usr/lib/php5/20090626+lfs/adodb.so: 
cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.3.3-6 with Suhosin-Patch (cli) (built: Dec  7 2010 18:23:49) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
aquilax@zelda /tmp> cat t.php 
<?php $d = 2.2250738585072011e-308; ?>
aquilax@zelda /tmp> time php t.php 
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/lib/php5/20090626+lfs/adodb.so' - /usr/lib/php5/20090626+lfs/adodb.so: 
cannot open shared object file: No such file or directory in Unknown on line 0
^CCommand terminated by signal 2
7.55user 0.02system 0:07.61elapsed 99%CPU (0avgtext+0avgdata 36720maxresident)k
0inputs+0outputs (0major+2620minor)pagefaults 0swaps
 [2011-01-04 08:59 UTC] yuv dot adm at gmail dot com
Check out the strace:

  lstat64("/home/ubuntu/junk/p.php", {st_mode=S_IFREG|0644, st_size=59, ...}) = 0
  lstat64("/home/ubuntu/junk", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
  lstat64("/home/ubuntu", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
  lstat64("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
  ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfe51238) = -1  ENOTTY (Inappropriate ioctl for device)
  fstat64(3, {st_mode=S_IFREG|0644, st_size=59, ...}) = 0
  mmap2(NULL, 68, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb78d1000

and then it hangs...
 [2011-01-04 09:02 UTC] scottmac@php.net
This only seems to affect 32-bit systems.
 [2011-01-04 09:37 UTC] scottmac@php.net
looking like a gcc optimizer bug, -O0 is fine where -O2 hangs
 [2011-01-04 09:54 UTC] rasmus@php.net
How about -O2 -ffloat-store ?
 [2011-01-04 10:17 UTC] pajoye@php.net
Happens here too 64bit CPU 32bit builds (win or linux)
 [2011-01-04 10:57 UTC] stuart dot caie at gmail dot com
Appears to hang when compiled for 32bit Intel code, but not 64bit code.

Hangs in zend_strtod() according to gdb.
 [2011-01-04 12:21 UTC] chx1975 at gmail dot com
Excellent analysis at http://news.ycombinator.com/item?id=2066084
 [2011-01-04 14:36 UTC] brandonkirsch at hotmail dot com
I have the same problem on PHP 5.3.2 on 32-bit Linux.

Configure:

'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-
mssql=/usr/local/freetds' '--with-ldap' '--prefix=/usr/local/php5' '--with-
config-file-path=/usr/local/php5/etc' '--enable-sockets' '--enable-soap' '--
with-openssl' '--with-unixODBC=/usr' '--with-gd' '--with-jpeg-dir=/usr/lib' '--
with-pdo-odbc=unixODBC,/usr' '--with-pdo-dblib=/usr/local/freetds'


uname -a:

Linux servername 2.6.16.60-0.42.5-default #1 Mon Aug 24 09:41:41 UTC 2009 i686 
i686 i386 GNU/Linux
 [2011-01-04 16:08 UTC] brandonkirsch at hotmail dot com
Update:  PHP 5.2.6 is NOT affected by this bug on the same 32-bit architecture as 
my previous post.
 [2011-01-04 16:50 UTC] abowling1 at gmail dot com
Same problem on 2 systems (hangs with CPU pegged at 100%).

I have two CentOS 5.5 systems running i386 PHP packages:
PHP 5.3.2 (cli) (built: Mar  4 2010 21:52:46), Zend Engine v2.3.0, with eAccelerator v0.9.6
CPU: 
processor       : 0 (and 1)
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Core(TM)2 CPU          6420  @ 2.13GHz
stepping        : 6
cpu MHz         : 800.000
cache size      : 4096 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni mon itor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
bogomips        : 2139.82

AND

PHP 5.3.3 (cli) (built: Jul 22 2010 16:41:20), Zend Engine v2.3.0, with eAccelerator v0.9.6

CPU:
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Pentium(R) 4 CPU 2.00GHz
stepping        : 4
cpu MHz         : 1993.668
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm up
bogomips        : 3987.33

Package's build settings:
./configure --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-libdir=lib --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --disable-debug --with-pic --disable-rpath --without-pear --with-bz2 --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --enable-gd-native-ttf --with-t1lib=/usr --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-zlib --with-layout=GNU --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --with-kerberos --enable-ucd-snmp-hack --enable-shmop --enable-calendar --with-libxml-dir=/usr --enable-xml --with-system-tzdata --with-apxs2=/usr/sbin/apxs --enable-maintainer-zts --with-config-file-scan-dir=/etc/php-zts.d --enable-force-cgi-redirect --enable-pcntl --with-imap=shared --with-imap-ssl --enable-mbstring=shared --enable-mbregex --with-gd=shared --enable-bcmath=shared --enable-dba=shared --with-db4=/usr --with-xmlrpc=shared --with-ldap=shared --with-ldap-sasl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --enable-mysqlnd-threading --with-oci8=shared,instantclient,/usr/lib/oracle/11.1.0.7/client/lib,11.1.0.7 --with-pdo-oci=shared,instantclient,/usr,11.1.0.7 --with-interbase=shared,/usr/lib/firebird --with-pdo-firebird=shared,/usr/lib/firebird --enable-dom=shared --with-pgsql=shared --enable-wddx=shared --with-snmp=shared,/usr --enable-soap=shared --with-xsl=shared,/usr --enable-xmlreader=shared --enable-xmlwriter=shared --with-curl=shared,/usr --enable-fastcgi --enable-pdo=shared --with-pdo-odbc=shared,unixODBC,/usr --with-pdo-mysql=shared,mysqlnd --with-pdo-pgsql=shared,/usr --with-pdo-sqlite=shared,/usr --with-pdo-dblib=shared,/usr --without-sqlite3 --with-sqlite=shared,/usr --enable-json=shared --enable-zip=shared --without-readline --with-libedit --with-pspell=shared --enable-phar=shared --with-mcrypt=shared,/usr --with-tidy=shared,/usr --with-mssql=shared,/usr --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared --enable-posix=shared --with-unixODBC=shared,/usr --enable-fileinfo=shared --enable-intl=shared --with-icu-dir=/usr --with-enchant=shared,/usr --with-recode=shared,/usr
 [2011-01-04 17:41 UTC] rasmus@php.net
This is an interesting bug.  How about we just mark these as volatile doubles in 
that part of the code to make sure they don't end up in registers.  My guess is 
that it would fix it.  Need to track down a 32-bit machine to test this though.
 [2011-01-04 17:55 UTC] hion2000 at yahoo dot ca
Same happens on my Ubuntu box as well.

$ php -v
PHP 5.3.3-1ubuntu9.1 with Suhosin-Patch (cli) (built: Oct 15 2010 14:17:04)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies


$ uname -a
Linux Server2 2.6.35-23-generic-pae #41-Ubuntu SMP Wed Nov 24 10:35:46 UTC 2010 
i686 GNU/Linux
 [2011-01-04 18:36 UTC] chris dot tandiono at gmail dot com
[christandiono@hang1 ~]$ uname -a
FreeBSD hang1 8.0-RELEASE-p3 FreeBSD 8.0-RELEASE-p3 #0: Wed May 26 05:45:12 UTC 
2010     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
[christandiono@hang1 ~]$ php -v
PHP 5.3.4 with Suhosin-Patch (cli) (built: Dec 20 2010 18:00:57) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

[chris@hang2 ~]$ uname -a
Linux hang2 2.6.36-ARCH #1 SMP PREEMPT Wed Nov 24 06:44:11 UTC 2010 i686 
Intel(R) Core(TM) Duo CPU T2400 @ 1.83GHz GenuineIntel GNU/Linux
[chris@hang2 ~]$ php -v
PHP 5.3.4 with Suhosin-Patch (cli) (built: Dec 16 2010 21:19:01) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

[chris@nohang ~]$ uname -a
Darwin nohang 10.5.0 Darwin Kernel Version 10.5.0: Fri Nov  5 23:20:39 PDT 2010; 
root:xnu-1504.9.17~1/RELEASE_I386 i386 i386
[chris@nohang ~]$ php -v
PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:57) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Hangs on FreeBSD and Linux, not on Mac OS X. It might be worth noting that the 
last two machines have the same CPU (the Linux and Mac OS X machines).
 [2011-01-04 19:06 UTC] hieu dot ld at vnnb dot net
Does not reproduce on php 5.3.4 (with gentoo patches, compiled -O2).

driana@undine ~/h $ cat numericval.php
<?php $d = 2.2250738585072011e-308; echo $d + 0; echo "\n"; ?>

driana@undine ~/h $ php numericval.php
2.2250738585072E-308

driana@undine ~/h $ php -v
PHP 5.3.4-pl0-gentoo (cli) (built: Dec 24 2010 14:24:29)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

driana@undine ~/h $ uname -a
Linux undine 2.6.28-hardened-r9-hrd-undine #1 SMP Thu Nov 12 02:29:42 CET 2009 i686 Intel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz GenuineIntel GNU/Linux

Configure Command =>  './configure'  '--prefix=/usr' '--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--prefix=/usr/lib/php5.3' '--mandir=/usr/lib/php5.3/man' '--infodir=/usr/lib/php5.3/info' '--libdir=/usr/lib/php5.3/lib' '--with-libdir=lib' '--without-pear' '--enable-maintainer-zts' '--disable-bcmath' '--with-bz2' '--disable-calendar' '--with-curl' '--without-curlwrappers' '--without-enchant' '--enable-exif' '--enable-ftp' '--with-gettext' '--without-gmp' '--disable-intl' '--without-kerberos' '--enable-mbstring' '--with-mcrypt' '--without-mssql' '--with-onig=/usr' '--with-openssl' '--with-openssl-dir=/usr' '--enable-pcntl' '--with-pgsql' '--without-pspell' '--without-recode' '--disable-shmop' '--without-snmp' '--disable-soap' '--disable-sockets' '--without-sybase-ct' '--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm' '--with-tidy' '--disable-wddx' '--with-xmlrpc' '--without-xsl' '--enable-zip' '--with-zlib' '--disable-debug' '--enable-dba' '--without-cdb' '--without-db4' '--disable-flatfile' '--with-gdbm' '--disable-inifile' '--without-qdbm' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--enable-gd-jis-conv' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--without-xpm-dir' '--with-gd' '--with-imap' '--with-imap-ssl' '--without-interbase' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-mysqli=/usr/bin/mysql_config' '--without-oci8' '--without-pdo-dblib' '--with-pdo-mysql=/usr' '--with-pdo-pgsql' '--with-pdo-sqlite=/usr' '--without-pdo-odbc' '--with-readline' '--without-libedit' '--without-mm' '--with-sqlite=/usr' '--enable-sqlite-utf8' '--with-pic' '--with-pcre-regex=/usr' '--with-pcre-dir=/usr' '--with-config-file-path=/etc/php/cli-php5.3' '--with-config-file-scan-dir=/etc/php/cli-php5.3/ext-active' '--enable-cli' '--disable-cgi' '--disable-fpm' '--disable-embed' '--without-apxs2'

CFLAGS="-march=core2 -mfpmath=sse -O2 -pipe -fforce-addr -fomit-frame-pointer"
 [2011-01-04 19:11 UTC] hieu dot ld at vnnb dot net
Re: last comment, I believe "-mfpmath=sse" did the trick. apologies for cluttering the bug report.
 [2011-01-04 19:30 UTC] rasmus@php.net
Guys, we already know the problem.  We are hitting an annoying x87 FPU design 
flaw.  You can read all about it here if you are interested:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323

And there is a good paper on it here:

http://hal.archives-ouvertes.fr/docs/00/28/14/29/PDF/floating-point-article.pdf

We don't need any more compile reports.  If you are on an architecture that uses 
the x87 FPU and you haven't forced SSE or float-store then you will see this 
problem.
 [2011-01-04 20:21 UTC] aloucks at cofront dot net
PHP 5.2.6-1+lenny9 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug  4 2010 03:25:57)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

The bug is NOT present in this version.
 [2011-01-04 23:36 UTC] scottmac@php.net
Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=307095
Log: Fix bug #53632 with x87 fpu
 [2011-01-05 00:19 UTC] scottmac@php.net
-Status: Assigned +Status: Closed -Assigned To: dmitry +Assigned To: scottmac
 [2011-01-05 00:19 UTC] scottmac@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.


 [2011-01-05 00:33 UTC] pajoye@php.net
-Status: Closed +Status: Assigned -Assigned To: scottmac +Assigned To: pajoye
 [2011-01-05 00:33 UTC] pajoye@php.net
Taking the hand, another bug (crash) happens here. Will post bt&co as soon as possible.
 [2011-01-05 00:36 UTC] scottmac@php.net
Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=307097
Log: Add test for bug #53632
 [2011-01-05 00:47 UTC] pajoye@php.net
-Status: Assigned +Status: Closed -Assigned To: pajoye +Assigned To: scottmac
 [2011-01-05 00:47 UTC] pajoye@php.net
My bad, forgot to revert a change in my previous attempt to fix this issue. Fresh co & build works, tests pass.
 [2011-01-05 09:50 UTC] pajoye@php.net
Seems that the commit did not make it here:

Fix: http://svn.php.net/viewvc?view=revision&revision=307095
Test case: http://svn.php.net/viewvc?view=revision&revision=307097
 [2011-01-05 10:28 UTC] zdv2010 at gmail dot com
I have this problem on PHP-5.2.14 on Windows XP SP3
C:\Documents and Settings\user>php -v
PHP 5.2.14 (cli) (built: Jul 21 2010 18:43:55)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
 [2011-01-05 14:32 UTC] johannes@php.net
Automatic comment from SVN on behalf of johannes
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=307119
Log: Merge rev. 307095
- Fix bug #53632 with x87 fpu (scottmac)
 [2011-01-05 14:35 UTC] johannes@php.net
Automatic comment from SVN on behalf of johannes
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=307120
Log: Merge rev. 307097
Add test for bug #53632 (scottmac)
 [2011-01-05 15:13 UTC] tyra3l at gmail dot com
Just for the record, because some of my friends missed this:
max_execution_time/set_time_limit cannot help you with this problem, because it's only gets checked between two userland instructions, hence this won't happen in 
this case.

Tyrael
 [2011-01-05 16:11 UTC] tyra3l at gmail dot com
btw. 5.2 support officially ended.
are there any chances that this bug will be fixed in 5.2, or this will be the 
first obstacle which will force the people out there to upgrade to 5.3?

Tyrael
 [2011-01-05 16:27 UTC] jannhorn at googlemail dot com
@Tyrael: Seems like it was already fixed for 5.2.
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_2/Zend/zend_strtod.c?
view=log&pathrev=307095
 [2011-01-05 19:39 UTC] xpipe at hotmail dot de
Considering the official Windows binaries are affected by this, will there be new binaries or a new PHP version released to reflect this issue?

I'm asking because it is possible to take down vulnerable PHP apps by this as easily as finding a request variable that is actually accessed. Requesting viewtopic.php?f=2.2250738585072011e-308 for phpBB or index.php?q=2.2250738585072011e-308 for Drupal is enough to freeze the PHP installation if it is affected.
 [2011-01-05 19:43 UTC] pajoye@php.net
@ cswarth at gmail dot com 

Thanks for all the feedbacks, we had enough info and details to fix the issue and 
new releases will be done shortly.
 [2011-01-06 01:38 UTC] lukemoynihan at gmail dot com
As a workaround until I can patch php I have used the following pure php solution:

http://stackoverflow.com/questions/4610651/any-problems-with-the-following-work-
around-for-php-bug-53632
 [2011-01-06 02:29 UTC] liaogz82 at singnet dot com dot sg
hang on mine. 32 bit

gangzheng@CDPL-PC-08:~$ php -v
PHP 5.3.3-1ubuntu9.1 with Suhosin-Patch (cli) (built: Oct 15 2010 14:17:04) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
gangzheng@CDPL-PC-08:~$ uname -a
Linux CDPL-PC-08 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 01:41:57 UTC 2010 i686 GNU/Linux
 [2011-01-06 02:32 UTC] scottmac@php.net
-Block user comment: N +Block user comment: Y
 [2011-01-06 13:52 UTC] pajoye@php.net
-CVE-ID: +CVE-ID: 2010-4645
 [2011-01-06 14:38 UTC] boris at insert-coin dot org
My script:
# cat bug.php 
<?php 
$d = 2.2250738585072011e-308; 
?>

Result: NO HANG.
Php version:
# php -v
PHP 5.1.6 (cli) (built: Nov 29 2010 16:47:37) 
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

OS: CentOS 5.4 32-bit
Kernel: 2.6.18-164.el5xen
CPU:
# cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 15
model		: 4
model name	: Intel(R) Pentium(R) 4 CPU 3.00GHz
stepping	: 3
cpu MHz		: 3000.084
cache size	: 2048 KB
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 5
wp		: yes
flags		: fpu de tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc up pni cid
bogomips	: 7505.37
 [2011-01-06 14:41 UTC] aharvey@php.net
-Block user comment: N +Block user comment: Y
 [2011-01-06 14:41 UTC] pajoye@php.net
ok, let block the comments here for now. Bug has been identified, releases on 
their way. Thanks everyone for your feedback.
 [2011-01-06 17:29 UTC] pajoye@php.net
-Status: Closed +Status: Assigned -Assigned To: scottmac +Assigned To: pajoye
 [2011-01-06 17:29 UTC] pajoye@php.net
Reopen, assign to me, VC6 5.2 does not work as it should everywhere.
 [2011-01-06 18:08 UTC] pajoye@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=307168
Log: - fix vc6 random behavior for Fix bug #53632 with x87 fpu
 [2011-01-06 18:19 UTC] pajoye@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=307169
Log: - fix vc6 random behavior for Fix bug #53632 with x87 fpu
 [2011-01-06 19:26 UTC] pajoye@php.net
VC6 builds are now fixed. 5.2.17 and 5.3.5 have been retaged. windows.php.net has the updated binaries. SVN php web distributions contain 5.2.17 updated binaries as well but be sure that you get the right one (md5 or use windows.php.net) if you rely on a mirror.
 [2011-01-10 19:15 UTC] iliaa@php.net
-Status: Assigned +Status: Closed
 [2011-01-10 19:15 UTC] iliaa@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC