Invalid argument supplied for foreach()


  • /var/www/vhosts/mcf.rs/httpdocs/VectorCMS/Config/functions.conf.php : 143
    136  
    137  * @return array The sorted array. Any keys not found in the $sort array will be appended to the 
    138  *               endin the original order
    139  */ 
    140 function manualSort($array$sort) { 
    141     $result = []; 
    142  
    143     foreach ($sort as $key) { 
    144         if (key_exists($key$array)) { 
    145             $result[$key] = $array[$key]; 
    146             unset($array[$key]); 
    147         
    148     
    149  
    150     return $result $array
    151 
  • AppErrorHandler :: handleError ( integer: 2 , Invalid argument supplied for foreach() , /var/www/vhosts/mcf.rs/httpdocs/VectorCMS/Config/functions.conf.… , integer: 143 , Array ( [array] => Array ( [1505] => Arr… )
    /var/www/vhosts/mcf.rs/httpdocs/VectorCMS/Config/functions.conf.php : 143
    136  
    137  * @return array The sorted array. Any keys not found in the $sort array will be appended to the 
    138  *               endin the original order
    139  */ 
    140 function manualSort($array$sort) { 
    141     $result = []; 
    142  
    143     foreach ($sort as $key) { 
    144         if (key_exists($key$array)) { 
    145             $result[$key] = $array[$key]; 
    146             unset($array[$key]); 
    147         
    148     
    149  
    150     return $result $array
    151 
  • manualSort ( Array ( [1505] => Array ( [News] => Arra… , News.published )
    /var/www/vhosts/mcf.rs/httpdocs/VectorCMS/Model/Behavior/DefaultBehavior.php : 205
    198                         
    199                     
    200                 
    201             
    202  
    203             // Manual sort 
    204             if (property_exists($Model'sort')) { 
    205                 $results manualSort($results$Model->sort); 
    206                 unset($Model->sort); 
    207             
    208         
    209         Timer::endLoop('DefaultBehavior::afterFind()'); 
    210  
    211         return $results
    212     
    213  
  • DefaultBehavior afterFind ( News Object ( [isModule] => 1 [moduleId] => 5 [modul… , Array ( [1505] => Array ( [News] => Arra… , boolean: true )
    /var/www/vhosts/mcf.rs/httpdocs/lib/Cake/Utility/ObjectCollection.php : 128
    121         $collected = array(); 
    122         $list array_keys($this->_enabled); 
    123         if ($options['modParams'] !== false && !isset($params[$options['modParams']])) { 
    124             throw new CakeException(__d('cake_dev''Cannot use modParams with indexes that do not exist.')); 
    125         
    126         $result null
    127         foreach ($list as $name) { 
    128             $result call_user_func_array(array($this->_loaded[$name], $callback), compact('subject') + $params); 
    129             if ($options['collectReturn'] === true) { 
    130                 $collected[] = $result
    131             
    132             if ($options['break'] && ($result === $options['breakOn'] || 
    133                 (is_array($options['breakOn']) && in_array($result$options['breakOn'], true))) 
    134             ) { 
    135                 return $result
    136             } elseif ($options['modParams'] !== false && !in_array($result, array(truefalsenull), true)) { 
  • ObjectCollection trigger ( afterFind )
    /var/www/vhosts/mcf.rs/httpdocs/lib/Cake/Event/CakeEventManager.php : 243
    236         foreach ($listeners as $listener) { 
    237             if ($event->isStopped()) { 
    238                 break; 
    239             
    240             if ($listener['passParams'] === true) { 
    241                 $result call_user_func_array($listener['callable'], $event->data); 
    242             } else { 
    243                 $result call_user_func($listener['callable'], $event); 
    244             
    245             if ($result === false) { 
    246                 $event->stopPropagation(); 
    247             
    248             if ($result !== null) { 
    249                 $event->result $result
    250             
    251         
  • CakeEventManager dispatch ( HUGE CakeEvent )
    /var/www/vhosts/mcf.rs/httpdocs/lib/Cake/Model/Model.php : 3352
    3345  * @param bool $primary If this is the primary model results (results from model where the find operation was performed
    3346  * @return array Set of filtered results 
    3347  * @triggers Model.afterFind $this, array($results$primary
    3348  */ 
    3349     protected function _filterResults($results$primary true) { 
    3350         $event = new CakeEvent('Model.afterFind'$this, array($results$primary)); 
    3351         $event->modParams 0
    3352         $this->getEventManager()->dispatch($event); 
    3353         return $event->result
    3354     
    3355  
    3356 /** 
    3357  This resets the association arrays for the model back 
    3358  to those originally defined in the modelNormally called at the end 
    3359  of each call to Model::find() 
    3360  
  • Model _filterResults ( Array ( [0] => Array ( [News] => Array … )
    /var/www/vhosts/mcf.rs/httpdocs/lib/Cake/Model/Model.php : 3042
    3035  * @return array 
    3036  */ 
    3037     protected function _readDataSource($type, $query) { 
    3038         $results = $this->getDataSource()->read($this, $query); 
    3039         $this->resetAssociations(); 
    3040  
    3041         if ($query['callbacks'] === true || $query['callbacks'] === 'after') { 
    3042             $results = $this->_filterResults($results); 
    3043         } 
    3044  
    3045         $this->findQueryType = null; 
    3046  
    3047         if ($this->findMethods[$type] === true) { 
    3048             return $this->{'_find' . ucfirst($type)}('after', $query, $results); 
    3049         } 
    3050     } 
  • Model _readDataSource ( all , Array ( [conditions] => Array ( [News.is… )
    /var/www/vhosts/mcf.rs/httpdocs/VectorCMS/Model/AppModel.php : 1626
    1619  
    1620         # Read from database 
    1621         if (empty($data)) { 
    1622             Timer::startLoop('Model::find()'); 
    1623             
    1624  
    1625                 $this->getDatasource()->fullDebug false
    1626                 $data $this->_readDataSource($type$params); 
    1627  
    1628                 if ($enabled) { 
    1629  
    1630                     # Save the cache 
    1631                     $lastQuery $this->getLastQuery(true"\n"); 
    1632                     if ($lastQuery) { 
    1633                         if ($useStandardCache) { 
    1634                             Cache::write($file$lastQuery $separator serialize($data)); 
  • AppModel find ( all , Array ( [conditions] => Array ( [News.is… )
    /var/www/vhosts/mcf.rs/httpdocs/lib/Cake/Controller/Component/PaginatorComponent.php : 196
    189                 $conditions$fields$order$limit$page$recursive$extra 
    190             ); 
    191         } else { 
    192             $parameters compact('conditions''fields''order''limit''page'); 
    193             if ($recursive != $object->recursive) { 
    194                 $parameters['recursive'] = $recursive
    195             
    196             $results $object->find($typearray_merge($parameters$extra)); 
    197         
    198         $defaults $this->getDefaults($object->alias); 
    199         unset($defaults[0]); 
    200  
    201         if (!$results) { 
    202             $count 0
    203         } elseif ($object->hasMethod('paginateCount')) { 
    204             $count $object->paginateCount($conditions$recursive$extra); 
  • PaginatorComponent paginate ( News Object ( [isModule] => 1 [moduleId] => 5 [modul… , Array ( ) , Array ( ) )
    /var/www/vhosts/mcf.rs/httpdocs/lib/Cake/Controller/Controller.php : 1087
    1080  * @param Model|string $object Model to paginate (e.g: model instance, or 'Model', or 'Model.InnerModel') 
    1081  * @param string|array $scope Conditions to use while paginating 
    1082  * @param array $whitelist List of allowed options for paging 
    1083  * @return array Model query results 
    1084  * @link http://book.cakephp.org/2.0/en/controllers.html#Controller::paginate 
    1085  */ 
    1086     public function paginate($object = null, $scope = array(), $whitelist = array()) { 
    1087         return $this->Components->load('Paginator', $this->paginate)->paginate($object, $scope, $whitelist); 
    1088     } 
    1089  
    1090 /** 
    1091  * Called before the controller action. You can use this method to configure and customize components 
    1092  * or perform logic that needs to happen before each controller action. 
    1093  * 
    1094  * @return void 
    1095  * @link http://book.cakephp.org/2.0/en/controllers.html#request-life-cycle-callbacks 
  • Controller paginate ( News )
    /var/www/vhosts/mcf.rs/httpdocs/VectorCMS/Controller/FrontController.php : 171
    164                     $query $order $limit $offset $conditions
    165  
    166                     # Pagination parameters 
    167                     $query $this->Module->alterPaginationParams($query$this->request); 
    168                     if (!empty($params['paginate'])) { 
    169                         $query['limit'] = (int) $params['paginate']; 
    170                         $this->paginate[$params['module']] = [ 'recursive' => ] + $query
    171                         $this->set($plural$this->paginate($params['module'])); 
    172                     } else { 
    173                         $this->set($plural$this->Module->find('all'$query)); 
    174                     
    175                 
    176             
    177             $this->request->pageLinks $this->pageLinks
    178  
    179             $this->set('page'$this->page); 
  • FrontController beforeFilter ( HUGE CakeEvent )
    /var/www/vhosts/mcf.rs/httpdocs/lib/Cake/Event/CakeEventManager.php : 243
    236         foreach ($listeners as $listener) { 
    237             if ($event->isStopped()) { 
    238                 break; 
    239             
    240             if ($listener['passParams'] === true) { 
    241                 $result call_user_func_array($listener['callable'], $event->data); 
    242             } else { 
    243                 $result call_user_func($listener['callable'], $event); 
    244             
    245             if ($result === false) { 
    246                 $event->stopPropagation(); 
    247             
    248             if ($result !== null) { 
    249                 $event->result $result
    250             
    251         
  • CakeEventManager dispatch ( HUGE CakeEvent )
    /var/www/vhosts/mcf.rs/httpdocs/lib/Cake/Controller/Controller.php : 677
    670  * - triggers Component `startupmethods
    671  
    672  * @return void 
    673  * @triggers Controller.initialize $this 
    674  * @triggers Controller.startup $this 
    675  */ 
    676     public function startupProcess() { 
    677         $this->getEventManager()->dispatch(new CakeEvent('Controller.initialize'$this)); 
    678         $this->getEventManager()->dispatch(new CakeEvent('Controller.startup'$this)); 
    679     
    680  
    681 /** 
    682  Perform the various shutdown processes for this controller
    683  Fire the Components and Controller callbacks in the correct order
    684  
    685  * - triggers the component `shutdowncallback
  • Controller startupProcess ( )
    /var/www/vhosts/mcf.rs/httpdocs/lib/Cake/Routing/Dispatcher.php : 189
    182  
    183  * @param Controller $controller Controller to invoke 
    184  * @param CakeRequest $request The request object to invoke the controller for. 
    185  * @return CakeResponse the resulting response object 
    186  */ 
    187     protected function _invoke(Controller $controllerCakeRequest $request) { 
    188         $controller->constructClasses(); 
    189         $controller->startupProcess(); 
    190  
    191         $response $controller->response
    192         $render true
    193         $result $controller->invokeAction($request); 
    194         if ($result instanceof CakeResponse) { 
    195             $render false
    196             $response $result
    197         
  • Dispatcher _invoke ( HUGE FrontController , CakeRequest Object ( [params] => Array ( … )
    /var/www/vhosts/mcf.rs/httpdocs/lib/Cake/Routing/Dispatcher.php : 167
    160         if (!($controller instanceof Controller)) { 
    161             throw new MissingControllerException(array( 
    162                 'class' => Inflector::camelize($request->params['controller']) . 'Controller', 
    163                 'plugin' => empty($request->params['plugin']) ? null : Inflector::camelize($request->params['plugin']) 
    164             )); 
    165         } 
    166  
    167         $response = $this->_invoke($controller, $request); 
    168         if (isset($request->params['return'])) { 
    169             return $response->body(); 
    170         } 
    171  
    172         $afterEvent = new CakeEvent('Dispatcher.afterDispatch', $this, compact('request', 'response')); 
    173         $this->getEventManager()->dispatch($afterEvent); 
    174         $afterEvent->data['response']->send(); 
    175     } 
  • Dispatcher dispatch ( CakeRequest Object ( [params] => Array ( … , CakeResponse Object ( [_statusCodes:protected] => Array … )
    /var/www/vhosts/mcf.rs/httpdocs/VectorCMS/webroot/index.php : 156
    149 # Cronjob handler 
    150 if (isset($argc) && $argc == 2 && isCLI()) { 
    151     define('CRONJOB', $argv[1]); 
    152     $Dispatcher->dispatch(new CakeRequest($argv[1]), new CakeResponse()); 
    153     exit; 
    154 } 
    155  
    156 $Dispatcher->dispatch(new CakeRequest(), new CakeResponse([ 'charset' => Configure::read('App.encoding') ])); 
    157