PHP warning

count(): Parameter must be an array or an object that implements Countable

G:\Apache24\htdocs\limesurvey\application\controllers\admin\useraction.php(726)

714             return false;
715         }
716     }
717 
718     private function _refreshtemplates()
719     {
720         $template_a = getTemplateList();
721         foreach ($template_a as $tp => $fullpath) {
722             // check for each folder if there is already an entry in the database
723             // if not create it with current user as creator (user with rights "create user" can assign template rights)
724             $result = Template::model()->findByPk($tp);
725 
726             if (count($result) == 0) {
727                 $post = new Template;
728                 $post->folder = $tp;
729                 $post->owner_id = Yii::app()->session['loginID'];
730 
731                 try {
732                     $post->save();
733                 } catch (Exception $ex) {
734                     Yii::app()->setFlashMessage(
735                         sprintf(
736                             gT('Could not save theme %s: %s'),
737                             $tp,
738                             $ex->getMessage()

Stack Trace

#0
+
 G:\Apache24\htdocs\limesurvey\application\controllers\admin\useraction.php(536): UserAction->_refreshtemplates()
531         if (!$oUser) {
532             // @todo : review to send a 403
533             $this->getController()->redirect(array("admin/user/sa/index"));
534         }
535         $aData['oUser'] = $oUser;
536         $this->_refreshtemplates();
537         $templaterights = array();
538 
539         $trights = Permission::model()->findAllByAttributes(array('uid' => $oUser->uid, 'entity'=>'template'));
540         foreach ($trights as $srow) {
541             $templaterights[$srow["permission"]] = array("use"=>$srow["read_p"]);
#3
+
 G:\Apache24\htdocs\limesurvey\application\core\Survey_Common_Action.php(83): CAction->runWithParamsInternal(UserAction, ReflectionMethod, array("sa" => "setusertemplates"))
78             $oMethod = new ReflectionMethod($this, $sDefault);
79         }
80 
81         // We're all good to go, let's execute it
82         // runWithParamsInternal would automatically get the parameters of the method and populate them as required with the params
83         return parent::runWithParamsInternal($this, $oMethod, $params);
84     }
85 
86     /**
87      * Some functions have different parameters, which are just an alias of the
88      * usual parameters we're getting in the url. This function just populates
#7
+
 G:\Apache24\htdocs\limesurvey\application\controllers\AdminController.php(158): CController->run("user")
153                     $this->redirect(array('/admin/authentication/sa/login'));
154                 }
155             }
156         }
157 
158         return parent::run($action);
159     }
160 
161     /**
162      * Routes all the actions to their respective places
163      *
2018-06-07 22:52:55 Apache/2.4.33 (Win64) OpenSSL/1.1.0h PHP/7.2.5 Yii Framework/1.1.19