]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Fixes E_WARNING from foreach() because count() seem to return TRUE even when $r is...
[friendica.git] / boot.php
index 4b2e83f18a5eff74d1913b3186c43e26976fb820..fdf0fa3aa733428504d265abf41be9c49ef79017 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1047,11 +1047,21 @@ class App {
        function save_timestamp($stamp, $value) {
                $duration = (float)(microtime(true)-$stamp);
 
+               if (!isset($this->performance[$value])) {
+                       // Prevent ugly E_NOTICE
+                       $this->performance[$value] = 0;
+               }
+
                $this->performance[$value] += (float)$duration;
                $this->performance["marktime"] += (float)$duration;
 
                $callstack = $this->callstack();
 
+               if (!isset($this->callstack[$value][$callstack])) {
+                       // Prevent ugly E_NOTICE
+                       $this->callstack[$value][$callstack] = 0;
+               }
+
                $this->callstack[$value][$callstack] += (float)$duration;
 
        }
@@ -1839,7 +1849,8 @@ function load_contact_links($uid) {
        $r = q("SELECT `id`,`network`,`url`,`thumb`, `rel` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `thumb` != ''",
                        intval($uid)
        );
-       if(count($r)) {
+
+       if(is_filled_array($r)) {
                foreach($r as $rr){
                        $url = normalise_link($rr['url']);
                        $ret[$url] = $rr;
@@ -2139,3 +2150,7 @@ function argv($x) {
 
        return '';
 }
+
+function is_filled_array ($array) {
+       return (is_array($array) && count($array) > 0);
+}