diff --git a/includes/view.inc b/includes/view.inc index 4848879..c708d9d 100644 --- a/includes/view.inc +++ b/includes/view.inc @@ -91,7 +91,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. @@ -1096,6 +1102,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 55c0b2a..edfdb68 100644 --- a/plugins/views_plugin_query.inc +++ b/plugins/views_plugin_query.inc @@ -54,7 +54,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. * * @param view $view * The view which is executed.