Code affected:

function _subscriptions_get_setting($name, $account) {
...
  $uid = -DRUPAL_AUTHENTICATED_RID;
...
    foreach ($defaults[$uid] as $key => $value) {
      if ($value < 0) {  // not set, use site dft
        $defaults[$uid][$key] = $defaults[-DRUPAL_AUTHENTICATED_RID][$key]; // line 872

It happens on every node page.

Backtrace:
node_view/node_build_content/module_invoke_all/subscriptions_ui_node_view/drupal_get_form/drupal_build_form/drupal_retrieve_form/subscriptions_ui_node_form/_subscriptions_get_setting

_subscriptions_get_setting( $name = 'send_interval', $account = class stdClass { public $uid = '1'; public $name = 'admin'; ... } )	

$defaults:

&
array (size=1)
  1 => 
    array (size=13)
      'uid' => string '1' (length=1)
      'digest' => string '-1' (length=2)
      'send_interval' => string '-1' (length=2)
      'send_updates' => string '-1' (length=2)
      'send_comments' => string '-1' (length=2)
      'send_interval_visible' => string '-1' (length=2)
      'send_updates_visible' => string '-1' (length=2)
      'send_comments_visible' => string '-1' (length=2)
      'autosub_on_post' => string '-1' (length=2)
      'autosub_on_update' => string '-1' (length=2)
      'autosub_on_comment' => string '-1' (length=2)
      'send_self' => string '-1' (length=2)
      'uses_defaults' => boolean false

Comments

kenorb’s picture

Status: Active » Needs review

Proposed patch:

--- a/subscriptions.module
+++ b/subscriptions.module
@@ -868,14 +868,14 @@ function _subscriptions_get_setting($name, $account) {
     }
     $defaults[$uid]['uses_defaults'] = FALSE;
     foreach ($defaults[$uid] as $key => $value) {
-      if ($value < 0) {  // not set, use site dft
+      if ($value < 0 && isset($defaults[-DRUPAL_AUTHENTICATED_RID])) {  // not set, use site dft
         $defaults[$uid][$key] = $defaults[-DRUPAL_AUTHENTICATED_RID][$key];
         $defaults[$uid]['uses_defaults'] = TRUE;
       }
     }
     foreach (array('interval', 'updates', 'comments') as $parm ) {
       // Site overrides user values.
-      if ($defaults[-DRUPAL_AUTHENTICATED_RID]['send_' . $parm . '_visible'] == -2) {
+      if (isset($defaults[-DRUPAL_AUTHENTICATED_RID]) && $defaults[-DRUPAL_AUTHENTICATED_RID]['send_' . $parm . '_visible'] == -2) {
         $defaults[$uid]['send_' . $parm] = $defaults[-DRUPAL_AUTHENTICATED_RID]['send_' . $parm];
       }
     }
salvis’s picture

Status: Needs review » Needs work

Thank you for your report. I'm not sure how to reproduce this just yet, but let's get the following out of the way first:

Have you tried the -dev version?

Patches should go against the -dev version and be attached as files. Even though Subscriptions has no tests, automatic testing is enabled and is very helpful as a first gate to check whether the patch applies (to the right branch).

DamienMcKenna’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Needs work » Postponed (maintainer needs more info)

The same code is in the -dev version. The question is - why does $defaults[-DRUPAL_AUTHENTICATED_RID][$key] not exist? Did the defaults not load correctly?