ID: 27759 Comment by: ttt_cao at hotmail dot com 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:
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; } Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2004-04-04 23:54:50] patrick at rap-x dot com The same code causes the same problem with PHP5 RC2. Output from the first section of phpinfo() below. ----------------------------- PHP Version 5.0.0RC2-dev System Windows NT ME 5.1 build 2600 Build Date Apr 3 2004 04:32:40 Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" Server API Apache 2.0 Handler Virtual Directory Support enabled Configuration File (php.ini) Path C:\WINDOWS\php.ini PHP API 20031224 PHP Extension 20040316 Zend Extension 90021012 Debug Build no Thread Safety enabled IPv6 Support enabled Registered PHP Streams php, file, http, ftp, compress.zlib Registered Stream Socket Transports tcp, udp ............. BCMath support enabled ------------------------------------------------------------------------ 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