#23967 [Com]: number_format() returns 0 all the time

2003-07-11 Thread youmeit at yahoo dot com
 ID:   23967
 Comment by:   youmeit at yahoo dot com
 Reported By:  russ at zerotech dot net
 Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: Gentoo Linux
 PHP Version:  4.3.2
 New Comment:

This is Max. The format_number is working after all.

It was something I missed in the code. Was passing the parameter w/o
($)

My bad!


Previous Comments:


[2003-07-12 00:40:29] youmeit at yahoo dot com

I have downloaded the latest stable version 4.3.2 and the issue with 0
being returned has not been fixed!

Is it possible someone could recompile the code for Windows
distribution?

Thank you very much...

Max



[2003-06-04 16:00:05] russ at zerotech dot net

I recompiled my glibc, I was unaware it was compiled at -O3, I was
pretty certain I had specified it myself to -O2 and pentium3 only,
maybe I hit it up accidentally during an emerge  -u world.  

Once I compiled it with -O2, number_format() began working again.



[2003-06-03 10:28:06] russ at zerotech dot net

I compiled the snapshot, no compiler optimizations, and I enabled
debugging.  My GCC version is:

gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice). 
Perhaps it's propolice causing it? As of PHP 4.3.1 though, compiled
with propolice, everything worked fine. I still get the same problem
with number_format() with the snapshow from today.

[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ ./php -r 'echo
number_format(4000,2); echo "\n";'
0.00
[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ ./php -r 'echo
number_format(0,2); echo "\n";'
0.00
[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ ./php -r 'echo
number_format(230,2); echo "\n";'
0.00
[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ ./php -r 'echo
number_format(234440,2); echo "\n";'
0.00
[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ ./php -r 'echo
number_format("234440",2); echo "\n";'
0.00
[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ gdb --args ./php -r
'echo number_format("234440",2); echo "\n";'

To make absolutely sure I'm not doing something different, I compiled
PHP 4.3.1 again, the same way I compiled 4.3.2 and the daily SNAPSHOT,
these are the results I get:
[EMAIL PROTECTED]:~/php-4.3.1/sapi/cli$ ./php -r 'echo number_format(500);
echo "\n";'
500
[EMAIL PROTECTED]:~/php-4.3.1/sapi/cli$ ./php -r 'echo number_format(500);
echo "\n";'
500
[EMAIL PROTECTED]:~/php-4.3.1/sapi/cli$ ./php -r 'echo number_format(7500);
echo "\n";'
7,500
[EMAIL PROTECTED]:~/php-4.3.1/sapi/cli$ ./php -r 'echo number_format(7500,2);
echo "\n";'
7,500.00

Obviously since it doesn't crash I can't bt on the core, but I set a
breakpoint at the first call to spprintf which appears to be the major
difference in _php_math_number_function() in math.c between 4.3.1 and
4.3.2.  It breaks at the first call which is made from
_php_math_number_function().

[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ gdb --args ./php -r
'echo number_format("234440",2); echo "\n";'
GNU gdb 5.3
Copyright 2002 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 "i686-pc-linux-gnu"...
(gdb) break spprintf
Breakpoint 1 at 0x8128f55: file
/home/russ/php4-STABLE-200306031330/main/spprintf.c, line 641.
(gdb) run
Starting program: /home/russ/php4-STABLE-200306031330/sapi/cli/php -r
echo\ number_format\(\"234440\",2\)\;\ echo\ \"\\n\"\;

Breakpoint 1, spprintf (pbuf=0xb3a8, max_len=0, format=0x8183b58
"%.*f") at /home/russ/php4-STABLE-200306031330/main/spprintf.c:641
641 va_start(ap, format);
(gdb) bt
#0  spprintf (pbuf=0xb3a8, max_len=0, format=0x8183b58 "%.*f") at
/home/russ/php4-STABLE-200306031330/main/spprintf.c:641
#1  0x080cb73a in _php_math_number_format (d=234440, dec=2,
dec_point=46 '.', thousand_sep=44 ',')
at /home/russ/php4-STABLE-200306031330/ext/standard/math.c:997
#2  0x080cbd1c in zif_number_format (ht=2, return_value=0x81ee2fc,
this_ptr=0x0, return_value_used=1)
at /home/russ/php4-STABLE-200306031330/ext/standard/math.c:1101
#3  0x0816d0a8 in execute (op_array=0x81edf5c) at
/home/russ/php4-STABLE-200306031330/Zend/zend_execute.c:1606

#23967 [Com]: number_format() returns 0 all the time

2003-07-11 Thread youmeit at yahoo dot com
 ID:   23967
 Comment by:   youmeit at yahoo dot com
 Reported By:  russ at zerotech dot net
 Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: Gentoo Linux
 PHP Version:  4.3.2
 New Comment:

I have downloaded the latest stable version 4.3.2 and the issue with 0
being returned has not been fixed!

Is it possible someone could recompile the code for Windows
distribution?

Thank you very much...

Max


Previous Comments:


[2003-06-04 16:00:05] russ at zerotech dot net

I recompiled my glibc, I was unaware it was compiled at -O3, I was
pretty certain I had specified it myself to -O2 and pentium3 only,
maybe I hit it up accidentally during an emerge  -u world.  

Once I compiled it with -O2, number_format() began working again.



[2003-06-03 10:28:06] russ at zerotech dot net

I compiled the snapshot, no compiler optimizations, and I enabled
debugging.  My GCC version is:

gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice). 
Perhaps it's propolice causing it? As of PHP 4.3.1 though, compiled
with propolice, everything worked fine. I still get the same problem
with number_format() with the snapshow from today.

[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ ./php -r 'echo
number_format(4000,2); echo "\n";'
0.00
[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ ./php -r 'echo
number_format(0,2); echo "\n";'
0.00
[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ ./php -r 'echo
number_format(230,2); echo "\n";'
0.00
[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ ./php -r 'echo
number_format(234440,2); echo "\n";'
0.00
[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ ./php -r 'echo
number_format("234440",2); echo "\n";'
0.00
[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ gdb --args ./php -r
'echo number_format("234440",2); echo "\n";'

To make absolutely sure I'm not doing something different, I compiled
PHP 4.3.1 again, the same way I compiled 4.3.2 and the daily SNAPSHOT,
these are the results I get:
[EMAIL PROTECTED]:~/php-4.3.1/sapi/cli$ ./php -r 'echo number_format(500);
echo "\n";'
500
[EMAIL PROTECTED]:~/php-4.3.1/sapi/cli$ ./php -r 'echo number_format(500);
echo "\n";'
500
[EMAIL PROTECTED]:~/php-4.3.1/sapi/cli$ ./php -r 'echo number_format(7500);
echo "\n";'
7,500
[EMAIL PROTECTED]:~/php-4.3.1/sapi/cli$ ./php -r 'echo number_format(7500,2);
echo "\n";'
7,500.00

Obviously since it doesn't crash I can't bt on the core, but I set a
breakpoint at the first call to spprintf which appears to be the major
difference in _php_math_number_function() in math.c between 4.3.1 and
4.3.2.  It breaks at the first call which is made from
_php_math_number_function().

[EMAIL PROTECTED]:~/php4-STABLE-200306031330/sapi/cli$ gdb --args ./php -r
'echo number_format("234440",2); echo "\n";'
GNU gdb 5.3
Copyright 2002 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 "i686-pc-linux-gnu"...
(gdb) break spprintf
Breakpoint 1 at 0x8128f55: file
/home/russ/php4-STABLE-200306031330/main/spprintf.c, line 641.
(gdb) run
Starting program: /home/russ/php4-STABLE-200306031330/sapi/cli/php -r
echo\ number_format\(\"234440\",2\)\;\ echo\ \"\\n\"\;

Breakpoint 1, spprintf (pbuf=0xb3a8, max_len=0, format=0x8183b58
"%.*f") at /home/russ/php4-STABLE-200306031330/main/spprintf.c:641
641 va_start(ap, format);
(gdb) bt
#0  spprintf (pbuf=0xb3a8, max_len=0, format=0x8183b58 "%.*f") at
/home/russ/php4-STABLE-200306031330/main/spprintf.c:641
#1  0x080cb73a in _php_math_number_format (d=234440, dec=2,
dec_point=46 '.', thousand_sep=44 ',')
at /home/russ/php4-STABLE-200306031330/ext/standard/math.c:997
#2  0x080cbd1c in zif_number_format (ht=2, return_value=0x81ee2fc,
this_ptr=0x0, return_value_used=1)
at /home/russ/php4-STABLE-200306031330/ext/standard/math.c:1101
#3  0x0816d0a8 in execute (op_array=0x81edf5c) at
/home/russ/php4-STABLE-200306031330/Zend/zend_execute.c:1606
#4  0x08151f13 in zend_eval_string (str=0xb97d "echo
number_format(\"234440\",2); echo \"\\n\";", retval_ptr=0x0,
string_name=0x81a88b4 "Command line code") at
/home/russ/php4-STABLE-200306031330/Zend/zend_execute_AP