diff --git a/includes/view.inc b/includes/view.inc index bca0e48..18e7dae 100644 --- a/includes/view.inc +++ b/includes/view.inc @@ -30,7 +30,13 @@ class view extends views_db_object { var $use_ajax = FALSE; - // Where the results of a query will go. + /** + * Where the results of a query will go. + * + * The array must use a numeric index starting at 0. + * + * @var array + */ var $result = array(); // May be used to override the current pager info. @@ -956,6 +962,9 @@ class view extends views_db_object { } else { $this->query->execute($this); + // Enforce the array key rule as documented in + // views_plugin_query::execute() + $this->result = array_values($this->result); $this->_post_execute(); if ($cache) { $cache->cache_set('results'); diff --git a/plugins/views_plugin_query.inc b/plugins/views_plugin_query.inc index f200384..6a5d4a8 100644 --- a/plugins/views_plugin_query.inc +++ b/plugins/views_plugin_query.inc @@ -48,7 +48,8 @@ class views_plugin_query extends views_plugin { * Values to set: $view->result, $view->total_rows, $view->execute_time, * $view->pager['current_page']. * - * $view->result should contain an array of objects. + * $view->result should contain an array of objects. The array must use a + * numeric index starting at 0. */ function execute(&$view) { }