ID: 27759 Comment by: pk at onpk dot net Reported By: patrick at rap-x dot com Status: Closed Bug Type: BC math related Operating System: win32 only PHP Version: 5.0.0RC1 New Comment:
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/ Previous Comments: ------------------------------------------------------------------------ [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) ------------------------------------------------------------------------ [2004-04-26 13:26:06] marv at cyberia dot net dot lb This bug still exists in PHP5RC2. There isn't a problem with bcmath itself, but something is corrupting heap memory that bcmath uses. bcmath allocates three numbers (zero, one, and two) when it first starts up. If any of these numbers is then used (such as when adding zero to a number in bcadd) Apache crashes. ------------------------------------------------------------------------ [2004-04-11 23:03:46] hagen at xiag dot ch Latest snapshot crashes on both Apaches 2.0.48 and 1.3.29 on WinXP. ------------------------------------------------------------------------ [2004-04-07 05:56:45] [EMAIL PROTECTED] works fine for me using latest CVS snapshot. ------------------------------------------------------------------------ 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/27759 -- Edit this bug report at http://bugs.php.net/?id=27759&edit=1