Edit report at https://bugs.php.net/bug.php?id=27759&edit=1

 ID:                 27759
 Comment by:         good821 at 126 dot com
 Reported by:        patrick at rap-x dot com
 Summary:            bcadd() causes crash if first parameter is empty
                     string
 Status:             Closed
 Type:               Bug
 Package:            BC math related
 Operating System:   win32 only
 PHP Version:        5.0.0RC1
 Block user comment: N
 Private report:     N

 New Comment:

http://www.officialoaklandraiders.com/howie-long-jersey-c-11_18.html    Howie 
Long Throwback Jersey
http://www.officialoaklandraiders.com/jack-tatum-jersey-c-11_37.html    Jack 
Tatum Throwback Jersey
http://www.officialoaklandraiders.com/jacoby-ford-jersey-c-11_38.html   Jacoby 
Ford Jersey


Previous Comments:
------------------------------------------------------------------------
[2004-07-26 19:58:57] [email protected]

The fix was located just *after* the release of 5.0.0 (literally, like, the 
next day), look for it in 5.0.1.

------------------------------------------------------------------------
[2004-07-25 00:22:19] davesk78 at yahoo dot com

This bug still exists in the final release (5.0.0).  I'm running Apache 2, PHP 
5.0.0, and Windows XP Pro.  Same test case:

$total = "0";
$diff = "";
$result = bcadd($total, $diff, 6);
echo $result;
exit;

The following also causes Apache to crash:

$total = "0";
$diff = "";
$result = bcpow($total, $diff, 6);
echo $result;
exit;

------------------------------------------------------------------------
[2004-07-07 15:48:45] pk at onpk dot net

The reproduce code still crashes on my box Windows 2000 pro, Apache 1.3.27, 
PHP5 build 2195. And not only with "bcadd" but also with :
$total = "0";
$diff = "";
bcpow($total, $diff, 6);

And :
$total = "0";
$diff = "";
bcsub($total, $diff, 6);

However I've to admit that ttt_cao at hotmail dot com's remedy does work. By 
the way, I'm not using PEAR`s
Benchmark_Timer.

Hope someone will look at this. Thanks in advance.

Perrick :: http://www.onpk.net/

------------------------------------------------------------------------
[2004-06-29 18:51:18] ttt_cao at hotmail dot com

update the function getProfiling() in timer.php as the follows, maybe you can 
fix the bug. 

    function getProfiling() {
        $i = 0;
        $total = $temp = '0.0';
        $result = array();

        foreach ($this->markers as $marker => $time) {

            if (extension_loaded('bcmath')) {
                $diff  = bcsub($time, $temp, 6);

                if ($i > 0)
                        $total = bcadd($total, $diff, 6);
            } else {
                $diff  = $time - $temp;
                $total = $total + $diff;
            }
            
            echo "$time   $diff $total <br>";

            $result[$i]['name']  = $marker;
            $result[$i]['time']  = $time;
            $result[$i]['diff']  = $diff;
            $result[$i]['total'] = $total;

            $this->strlen_max = (strlen($marker) > $this->strlen_max ? 
strlen($marker) + 1 : $this->strlen_max);

            $temp = $time;
            $i++;

        }


        $result[0]['diff'] = '-';
        $this->strlen_max = (strlen('total') > $this->strlen_max ? 
strlen('total') : $this->strlen_max);
        $this->strlen_max += 4;

        return $result;
    }

------------------------------------------------------------------------
[2004-06-18 01:21:42] rashid at ds dot pg dot gda dot pl

bug is closed so i dare to add 'me too' so maybe someone will reopen it :]
php5 rc2: problem exists in both bc_sub and bc_add (PEAR`s Benchmark_Timer 
works great as perfect example of this bug)

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


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

    https://bugs.php.net/bug.php?id=27759


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

Reply via email to