How to reproduce the warning

1) Enable error backtrace in the devel module.
2) Create a view and set the pager offset to a value larger than 0

Save and you will see a bunch of warnings.

Reason for the warning

In case that $_GET['page'] is empty only one $pager_page_array element is created:

$pager_page_array = isset($_GET['page']) ? explode(',', $_GET['page']) : array(0);
Solution

Fix the set_current_page function in views_plugin_pager_full.inc:

if(empty($pager_page_array))
  $pager_page_array = isset($_GET['page']) ? explode(',', $_GET['page']) : array();

if(!isset($pager_page_array[$this->options['id']]))
    $pager_page_array[$this->options['id']] = 0;

Comments

dawehner’s picture

Status: Active » Needs work
+++ b//plugins/views_plugin_pager_full.incundefined
@@ -217,7 +217,11 @@ class views_plugin_pager_full extends views_plugin_pager {
-    $pager_page_array = isset($_GET['page']) ? explode(',', $_GET['page']) : array(0);
+    if(empty($pager_page_array))
+      $pager_page_array = isset($_GET['page']) ? explode(',', $_GET['page']) : array();
+
+    if(!isset($pager_page_array[$this->options['id']]))
+        $pager_page_array[$this->options['id']] = 0;

Drupal code style set's an { for one-line patches as well

Powered by Dreditor.

jantimon’s picture

StatusFileSize
new1.06 KB

After further testing I recognized that the global array is changed somewhere else and somehow one element might be set to -1.
So I changed my patch to reset the $pager_page_array similar to the current implementation.

jantimon’s picture

Version: 7.x-3.0-beta3 » 7.x-3.0-rc1
Status: Needs work » Needs review
StatusFileSize
new1.53 KB

The same bug occurs in the current rc1 version.

\!/ Attached wrong file.

jantimon’s picture

StatusFileSize
new1.42 KB

Patch for RC1

smk-ka’s picture

Version: 7.x-3.0-rc1 » 7.x-3.x-dev
StatusFileSize
new1.44 KB

Same patch with more comments added.

marcusx’s picture

#5 works fine for me, thanks +1

dawehner’s picture

Status: Needs review » Postponed (maintainer needs more info)

Thanks, commited for 7.x-3.x

Does it make sense to try to backport this patch to 6.x-3.x?

drupalexio’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev

This issue is not any longer about 7.x-3.x, but about 6.x-3.x.

esmerel’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Postponed (maintainer needs more info) » Closed (fixed)

Please don't change issue components. I'm going to assume nobody cares about 6.x since there's no takers on a backport.