]> 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 d82669f231a9fb12608d3855ea50ea78e7bb6ee2..fdf0fa3aa733428504d265abf41be9c49ef79017 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -465,11 +465,12 @@ class App {
        public  $plugins;
        public  $apps = array();
        public  $identities;
-       public  $is_mobile;
-       public  $is_tablet;
+       public  $is_mobile = false;
+       public  $is_tablet = false;
        public  $is_friendica_app;
        public  $performance = array();
        public  $callstack = array();
+       public  $theme_info = array();
 
        public $nav_sel;
 
@@ -1046,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;
 
        }
@@ -1838,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;
@@ -2138,3 +2150,7 @@ function argv($x) {
 
        return '';
 }
+
+function is_filled_array ($array) {
+       return (is_array($array) && count($array) > 0);
+}