Fixing some warnings that I discovered through unit testing under E_ALL
authorRobert Sesek <rsesek@bluestatic.org>
Fri, 30 Nov 2007 18:47:12 +0000 (13:47 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Fri, 30 Nov 2007 18:47:12 +0000 (13:47 -0500)
* Functions.php:
(BSFunctions::FetchMicrotimeDiff): Refactored the local vars
* Template.php:
(BSTemplate::fetch): Fixed a warning generated by the uncached template counter
(BSTemplate::flush): Fixed a warning about the microtime diff because we weren't passing a microtime, just the seconds

Functions.php
Template.php

index 97ff605c77ef43bb2a96078d408b7d76f623a8e9..8914ead2d8af253ffb89c9282916ecdf7d07dfe6 100644 (file)
@@ -469,9 +469,9 @@ class BSFunctions
        public static function FetchMicrotimeDiff($mtstart)
        {
                $mtend = microtime();
-               list ($starttime['micro'], $starttime['sec']) = explode(' ', $mtstart);
-               list ($endtime['micro'], $endtime['sec']) = explode(' ', $mtend);
-               return ($endtime['micro'] + $endtime['sec']) - ($starttime['micro'] + $starttime['sec']);
+               list($startMicro, $startSec) = explode(' ', $mtstart);
+               list($endMicro, $endSec) = explode(' ', $mtend);
+               return ($endMicro + $endSec) - ($startMicro + $startSec);
        }
        
        // ###################################################################
index 880e97c3552d29050f4ffd33fbc20b9683f5d7da..552df5c787ef08df48199d7447835e36fc58c6ab 100644 (file)
@@ -218,7 +218,7 @@ class BSTemplate
                }
                else
                {
-                       $this->uncached[$name]++;
+                       $this->uncached[$name] = (isset($this->uncached[$name]) ? $this->uncached[$name] + 1 : 0);
                        BSApp::Debug("Manually loading template '$name'");
                        $template = $this->_loadTemplate($name);
                        $template = $this->_parseTemplate($template);
@@ -250,7 +250,7 @@ class BSTemplate
                $debugBlock = '';
                if (BSApp::GetDebug())
                {                       
-                       $debugBlock .= "\n<div align=\"center\">Executed in " . round(BSFunctions::FetchMicrotimeDiff($_SERVER['REQUEST_TIME']), 10) . ' seconds</div>';                        
+                       $debugBlock .= "\n<div align=\"center\">Executed in " . round(BSFunctions::FetchMicrotimeDiff('0 ' . $_SERVER['REQUEST_TIME']), 10) . ' seconds</div>';
                        $debugBlock .= "\n<br /><div align=\"center\">" . BSApp::GetDebugList() . "</div>";
                        
                        if (sizeof($this->uncached) > 0)