php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28605 bug21523.phpt test never end (-mieee fixes it..)
Submitted: 2004-06-01 22:21 UTC Modified: 2005-06-02 23:32 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: tbp at poly dot polytechnique dot fr Assigned: helly (profile)
Status: Closed Package: Math related
PHP Version: 5CVS, 4CVS (2005-03-21) OS: Compaq Tru64 UNIX v5.1
Private report: No CVE-ID: None
 [2004-06-01 22:21 UTC] tbp at poly dot polytechnique dot fr
Description:
------------
I was upgrading my apache/mod-ssl/php to latest version and I have now trouble to do ?make test?:
I expect ?make test? to give me some results in minute or some, but it continue running for hours.
But I could stop it with CTRL-C

Same results for php 4.3.6/4.3.7RC1/php4-STABLE-200406011430
php 4.3.4 works fine.

My tests shows that php go in to some kind of loop while it try to execute number_format(-2000, 2768):
[root@poly:/Admin/SRC/Apache/php-4.3.4]# ps auxwwa | grep php
root     468861 97.9  0.0 6.38M 1.1M pts/5    R  + 22:04:31     0:08.71 sapi/cli/php bug21523.phpt


Configure:
./configure --with-apache=../apache_1.3.31 --with-ssl=/Local/ssl --prefix=/Local/php --enable-memory-limit --with-zlib=/Local --with-zlib-dir=/Local --with-mysql=/Local/mysql --with-pgsql=/Local/pgsql --enable-ftp

Problem is irrelevant to php.ini (I have also done all tests without any php.ini)




Reproduce code:
---------------
make test

Expected result:
----------------
with php-4.3.4 I have somesing like:
?
PASS GetImageSize() for compressed swf files [ext/standard/tests/image/getimagesize_swc.phpt]
PASS image_type_to_mime_type() [ext/standard/tests/image/image_type_to_mime_type.phpt]
FAIL Simple math tests [ext/standard/tests/math/abs.phpt]
PASS Bug #21523 number_format tries to allocate negative amount of memory [ext/standard/tests/math/bug21523.phpt]
PASS Bug #24142 (round() problems) [ext/standard/tests/math/bug24142.phpt]
?


Actual result:
--------------
make test on php 4.3.6/4.3.7RC1/php4-STABLE-200406011430:

?
PASS image_type_to_mime_type() [ext/standard/tests/image/image_type_to_mime_type.phpt]
PASS Simple math tests [ext/standard/tests/math/abs.phpt]
make: *** [test] Interrupt
(By CTRL-C) <- it was me who stop it


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-11 21:43 UTC] sniper@php.net
run the single test like this:

# gdb sapi/cli/php
(gdb) run ext/standard/tests/math/bug21523.phpt

And if/when it hangs, press ctrl+c and then type:

(gdb) bt

And paste output here.


 [2005-03-20 17:49 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz

The build is fixed now.

 [2005-03-21 13:42 UTC] tbp at poly dot polytechnique dot fr
No hangup anymore, but coredump instead.

[root@poly:/Admin/SRC/Apache/php4-STABLE-200503211130]# sapi/cli/php ext/standard/tests/math/bug21523.phpt
--TEST--
Bug #21523 number_format tries to allocate negative amount of memory
--FILE--
Floating point exception (core dumped)


FAIL Bug #21523 number_format tries to allocate negative amount of memory [ext/standard/tests/math/bug21523.phpt]
 [2005-03-21 22:35 UTC] sniper@php.net
Please provide the GDB backtrace of the crash with the snapshot.
 [2005-03-21 22:56 UTC] tbp at poly dot polytechnique dot fr
[root@poly:/Admin/SRC/Apache/php4-STABLE-200503211130]# gdb sapi/cli/php
This GDB was configured as "alphaev68-dec-osf5.1"...
(gdb) run ext/standard/tests/math/bug21523.phpt
Starting program: /Admin/SRC/Apache/php4-STABLE-200503211130/sapi/cli/php ext/standard/tests/math/bug21523.phpt
--TEST--
Bug #21523 number_format tries to allocate negative amount of memory
--FILE--
warning: (Internal error: pc 0x1200a72b8 in read in psymtab, but not in symtab.)


Program received signal SIGFPE, Arithmetic exception.
0x00000001200a72b8 in _php_math_number_format (d=2000, dec=2768, dec_point=46 '.', thousand_sep=44 ',')
    at /Admin/SRC/Apache/php4-STABLE-200503211130/ext/standard/math.c:1025
1025            PHP_ROUND_WITH_FUZZ(d, dec);
(gdb)
 [2005-03-22 18:36 UTC] sniper@php.net
Ilia, wasn't it you who added that PHP_ROUND_WITH_FUZZ() ? :)
 [2005-04-06 23:49 UTC] tbp at poly dot polytechnique dot fr
No coredump anymore, but  hangup again.

[root@poly:/Admin/SRC/Apache/php4-STABLE-200504061830]# gdb sapi/cli/php    
GNU gdb 6.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "alphaev68-dec-osf5.1"...
(gdb) run ext/standard/tests/math/bug21523.phpt
Starting program: /Admin/SRC/Apache/php4-STABLE-200504061830/sapi/cli/php ext/standard/tests/math/bug21523.phpt
--TEST--
Bug #21523 number_format tries to allocate negative amount of memory
--FILE--
warning: (Internal error: pc 0x12010e444 in read in psymtab, but not in symtab.)


Program received signal SIGINT, Interrupt.
0x000000012010e444 in ap_php_cvt (arg=0, ndigits=78, decpt=0x11fff9ac8, sign=0x0, eflag=0, buf=0x11fff9ad0 '0' <repeats 80 times>)
    at /Admin/SRC/Apache/php4-STABLE-200504061830/main/snprintf.c:317
317                             fj = modf(fi / 10, &fi);
(gdb) bt
#0  0x000000012010e444 in ap_php_cvt (arg=0, ndigits=78, decpt=0x11fff9ac8, sign=0x0, eflag=0, buf=0x11fff9ad0 '0' <repeats 80 times>)
    at /Admin/SRC/Apache/php4-STABLE-200504061830/main/snprintf.c:317
warning: (Internal error: pc 0x12010e2e8 in read in psymtab, but not in symtab.)

#1  0x000000012010e2e8 in ap_php_conv_fp (format=102 'f', num=0, add_dp=NO, precision=2768, is_negative=0x11fff9dc0, buf=0x11fff9bb1 "", len=0x11fff9ba8)
    at /Admin/SRC/Apache/php4-STABLE-200504061830/main/snprintf.c:176
warning: (Internal error: pc 0x1201101bc in read in psymtab, but not in symtab.)

#2  0x00000001201101bc in xbuf_format_converter (xbuf=0x11fff9e38, fmt=0x14002f3c9 "f", ap={__base = 0x11fff9eb8, __offset = 40})
    at /Admin/SRC/Apache/php4-STABLE-200504061830/main/spprintf.c:461
warning: (Internal error: pc 0x120110978 in read in psymtab, but not in symtab.)

#3  0x0000000120110978 in vspprintf (pbuf=0x11fff9f48, max_len=4831812308, format=0x14002f3c6 "%.*f", ap={__base = 0x11fff9eb8, __offset = 24})
    at /Admin/SRC/Apache/php4-STABLE-200504061830/main/spprintf.c:638
warning: (Internal error: pc 0x120110a40 in read in psymtab, but not in symtab.)

#4  0x0000000120110a40 in spprintf (pbuf=0x11fff9b1f, max_len=4831812308, format=0x11fff9ad6 '0' <repeats 74 times>)
    at /Admin/SRC/Apache/php4-STABLE-200504061830/main/spprintf.c:658
warning: (Internal error: pc 0x1200afea8 in read in psymtab, but not in symtab.)

#5  0x00000001200afea8 in _php_math_number_format (d=0, dec=536845880, dec_point=46 '.', thousand_sep=44 ',')
    at /Admin/SRC/Apache/php4-STABLE-200504061830/ext/standard/math.c:1027
warning: (Internal error: pc 0x1200b02d8 in read in psymtab, but not in symtab.)

#6  0x00000001200b02d8 in zif_number_format (ht=1074697624, return_value=0x1400e9458, this_ptr=0x11fff9ad6, return_value_used=0)
    at /Admin/SRC/Apache/php4-STABLE-200504061830/ext/standard/math.c:1123
warning: (Internal error: pc 0x12015aaa8 in read in psymtab, but not in symtab.)

#7  0x000000012015aaa8 in execute (op_array=0x2c) at /Admin/SRC/Apache/php4-STABLE-200504061830/Zend/zend_execute.c:1654
Previous frame inner to this frame (corrupt stack?)
(gdb)
 [2005-04-17 19:34 UTC] iliaa@php.net
ap_*printf() functions acting up?
 [2005-04-18 12:12 UTC] magnus@php.net
Compiling with -mieee (GCC) or -ieee (Compaq C compiler) will fix the test and another one on Tru64 for me.


 [2005-04-18 13:14 UTC] tbp at poly dot polytechnique dot fr
You are right "-mieee" gcc option, fix this test problem:

[root@poly:/Admin/SRC/Apache/php4-STABLE-200504061830]# sapi/cli/php ext/standard/tests/math/bug21523.phpt
--TEST--
Bug #21523 number_format tries to allocate negative amount of memory
--FILE--
string(2775) "-2,000.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
OK--EXPECT--
string(2775) "-2,000.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
OK

Thank you, TBP
 [2005-06-02 23:32 UTC] sniper@php.net
This bug has been fixed in CVS.

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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC