diff --git a/lib/Drupal/views/View.php b/lib/Drupal/views/View.php index 715d730c6aa3aeb83970fa7d5eb5e3671b4cbad5..6a00fe99aae339791cb8fb342c49280addf4809e 100644 --- a/lib/Drupal/views/View.php +++ b/lib/Drupal/views/View.php @@ -96,7 +96,13 @@ class View extends ViewsDbObject { 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. @@ -1140,6 +1146,9 @@ function execute($display_id = NULL) { } 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 59982cdcfd08511643f81e31f86acf280b3d2b51..d39ed989866c7603d2e6dfd9e19dfaffdbb60c18 100644 --- a/plugins/views_plugin_query.inc +++ b/plugins/views_plugin_query.inc @@ -65,7 +65,8 @@ function build(&$view) { } * 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.