See this error on dev version released June 5, 2011.
This happens when smart paging is enabled and Manual page breaks are inserted with default configuration.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

michele1375’s picture

I'm getting the same error with version released June 5, 2011:

Notice: Undefined index: smart_paging_title_display_suffix in smart_paging_field_attach_view_alter() (line 598 of /var/www/modules/smart_paging/smart_paging.module).

Ravi.J’s picture

michele1375’s picture

Perfect, now it's working well! Thanks.

michele1375’s picture

Status: Active » Fixed
rickvug’s picture

Status: Fixed » Reviewed & tested by the community

@michele1375 Only mark as fixed when the patch has been committed. Based on your positive test and the trivial nature of the patch I'm going to mark this one RTBC.

arpeggio’s picture

Status: Reviewed & tested by the community » Fixed

Thank you Ravi.J for the patch. The fix is already committed/pushed. Please use the dev version.

felixSchl’s picture

Problem still persists with latest dev release. With latest dev release, pages also take so long to load that php complains it took to long. Plus suddenly my computer went slow and all resources are eaten up by something. Looks like an infinite loop or something :)

arpeggio’s picture

@felixSchl I recommend to create a new issue for the infinite loop problem and please provide more details how to replicate that issue. With my sites I didn't encounter any infinite loop problem using the dev version of Smart Paging.

felixSchl’s picture

Thanks arpeggio, I think the loop problem had to do with the order in which my filters processed the content, so this can be forgotten about again. I hope.

However, I still get an undefined index error when I try to configure the smart filter on a per view mode basis. The problem is in lines 597 to 602 in smart_paging.module when it tries to get the $display_settings['settings']['smart_paging_...'] entries. Again, it only shows up when you set the view mode of your content type to have custom settings for smart paging.

arpeggio’s picture

@felixSchl try to Home » Administration » Structure and click the Manage display of your content type and click the "Save" button.

felixSchl’s picture

Nope, no luck. Been trying that over and over and flushing the cache and all.
Am I the only one with this issue? Maybe some other modules are interfering?

arpeggio’s picture

@felixSchl try to go to admin/config/content/smart_paging and click "Save Configuration" button.

felixSchl’s picture

That doesn't help either. Funny enough the endless page loading times creep back up too now when I set it to "Use the settings below for every content of this content type" mode. The httpd.exe then eats up 95% of my CPU and I have no choice but to kill it and restart the Apache server. I guess I will just stick to "Show Smart Paging settings during content editing of this content type" for now which works fine...
Shall I open a separate bug report / help request?

arpeggio’s picture

@felixSchl first try to install fresh Drupal and enable Smart Paging module only. If the issue does not occurred then try to enable the other modules one by one until the you find the module that causes the infinite loop problem and might conflict with Smart Paging. Please open new issue for infinite loop problem. Thanks.

felixSchl’s picture

I now setup a complete fresh install and added back all modules one by one and it is still working. This is really frustrating. Now I gotta take everything over I guess.. It seems that for some reasons my content type just won't set the display settings (in the non-fresh install) that Smart Paging is looking for, even if I do it explicitly in the display options.

felixSchl’s picture

Ok, I solved it. I placed a few dsm() in your code to understand what was going on and I think there might be a bug with setting defaults.

The $bundle_settings array, retrieved in line 1015 of smart_paging.module, shows me that defaults are not being set for view modes that that have "custom_settings = FALSE" as I would expect. Not sure if it is supposed to, but as you can see it took me ages to figure that out and maybe could be prevented for others to happen.

In my case I had to literally walk through every display mode and make sure it is set correctly which sounds trivial, but contradicts the whole idea of using defaults.

Long story short: The "Full content"-smart paging options should adapt the "defaults" view mode if it has "custom_settings = FALSE" set, just like all other field display settings. Correct me if I am wrong. Edit: The "date" module shows the same behavior, so this might technically be by design and no bug, however confusing.

Another thing about undefined indices:
I recommend some validating on the submission of the "smart paging settings" form that appears in the "content type display settings" table. It let's you just leave everything blank and then gives you undefined indices errors on page loads.

arpeggio’s picture

FileSize
26.33 KB

@felixSchl "custom_settings = FALSE" does not apply to Smart Paging, it is a pseudo-field hence it has only two properties basically (visibility and weight). However, I force to add more properties that we need. Pseudo fields can be found under "extra_fields" if you use dsm(), check the image attachment. Notice that "settings" item have our Smart Paging properties we need that I forced to include. Its weird that I did not encounter any undefined index (I have a fresh installed Drupal, Smart Paging and created new content type).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Routh’s picture

Notice: Undefined index: smart_paging_title_display_suffix in smart_paging_field_attach_view_alter() (line 599 of /sites/all/modules/smart_paging/smart_paging.module).

I'm still having this error occur in the lastest dev version of the module. I've manually set properties for every content type to try and work around it, however nothing I do (running cron, setting all settings, clearing cache multiple times) this error will not go away.

On some content, which seem to be only one page in length, the problem becomes worse:

Notice: Undefined index: smart_paging_method in smart_paging_field_attach_view_alter() (line 597 of /sites/all/modules/smart_paging/smart_paging.module).
Notice: Undefined index: smart_paging_pagebreak in smart_paging_field_attach_view_alter() (line 598 of /sites/all/modules/smart_paging/smart_paging.module).
Notice: Undefined index: smart_paging_title_display_suffix in smart_paging_field_attach_view_alter() (line 599 of /sites/all/modules/smart_paging/smart_paging.module).
Notice: Undefined index: smart_paging_title_suffix in smart_paging_field_attach_view_alter() (line 600 of /sites/all/modules/smart_paging/smart_paging.module).
Notice: Undefined index: smart_paging_character_count in smart_paging_field_attach_view_alter() (line 601 of /sites/all/modules/smart_paging/smart_paging.module).
Notice: Undefined index: smart_paging_word_count in smart_paging_field_attach_view_alter() (line 602 of /sites/all/modules/smart_paging/smart_paging.module).
Warning: explode(): Empty delimiter in smart_paging_field_attach_view_alter() (line 740 of /sites/all/modules/smart_paging/smart_paging.module).
Warning: array_filter() expects parameter 1 to be array, boolean given in smart_paging_field_attach_view_alter() (line 740 of /sites/all/modules/smart_paging/smart_paging.module).

Routh’s picture

As an additional note, in the case of the myriad of errors that come out when the content has only one page, the errors also seem to prevent ANY of the body from being displayed in these cases.

Here is an example of the single page issue:

http://amateurwriting.net/node/159

Routh’s picture

Status: Closed (fixed) » Active
butler’s picture

Category: bug » support

I tried using 7.x-1.x-dev and continued to have the problems described above. This issue keeps getting closed and reopened, last time closed with no explanation - can anyone shed some light? Should I be using one of the patches above on the dev version, is supposed the dev version is working, or... ?

arpeggio’s picture

The patch above @comment #2 is already applied to dev version but the comment #19 needs to attend and find solution.

butler’s picture

Or maybe someone would be so kind as to explain to me where in the .module file the variable for sticking page numbers in titles is so I can just set it NULL or to " " or something?

Thanks...

butler’s picture

Around line 584 just aced this if statement and aside from the worst-practices approach, think I'm good:

			//edit to remove page number in page titles
/*
            if ($current_page > 0) {
              $title_suffix  = drupal_get_title() . t('@page', array('@page' => $suffix . ($current_page + 1)));
              drupal_set_title($title_suffix);
            }
*/
Dean Clayton’s picture

Getting the same issue with smart paging :
Notice: Undefined index: smart_paging_title_display_suffix in smart_paging_field_attach_view_alter() (line 599 of /var/www/vhosts/ux.newthing.co.uk/httpdocs/sites/all/modules/smart_paging/smart_paging.module).

I was running the latest release 7.x-1.2 and didnt have the issue.

I installed the dev release ( jun 25th 2011) to solve the issue with Smart paging hiding labels and I am now having the issue ( even with flushing cache).

felixSchl’s picture

Answering my own post #16.

I added a form validation function to fill in form elements that are empty with the default values.

I also added a one-off solution to get rid of the annoying "undefined index" errors. They occur because the $display_stored is used instead of $display_default - The condition to use $display_stored is met because it checks only if the settings array has been set for that view mode, but not if the settings array is complete. Upon enabling Custom Display Settings for other view modes, the settings array (strangely) only gets the "content_type" set (the fist key in the array). I could find no indication of it being explicitly set anywhere in smart_paging.module. So there seems to be some black magic going on or I am missing something. Maybe there is a missing hook to update the rest of the field settings when Custom Display Settings get enabled for a view mode?

Anyway, just checking for the size of the settings array to be greater than one works until the mystery is uncovered :)

Cheers,
Felix

austin_drupal’s picture

Hi felixSchl - the attachment in #27 above is a broken link. Can you repost? Thanks.

felixSchl’s picture

Sure. No idea how that happened.

Edit: It just doesn't want to work. Uploaded it to PasteAll for now...

Dean Clayton’s picture

@FelixSchl I'm assuming your patch doesn't resolve the issue detected at comment 19?

felixSchl’s picture

@Dean Clayton
The added if logic in the elseif statement near the bottom of the patch should take care of that. But then it probably won't fix it for content that has already been created with missing elements, no. That should not happen in the first place imo. At least it makes it easier to fix them up afterwards because it pre-populates the formatter edit form with the default values.

offerman’s picture

Patch works for me (on version 7.x-1.3). -- edit: NOT

Or that's what I thought: it worked for a short while (a few reloads, since this site is not yet in production), and then the same message was back again.
Flushing the cache doesn't make a difference.

I installed the current dev version (2011-Nov-01), patched it, and it is still there:

Notice: Undefined index: smart_paging_title_display_suffix in smart_paging_field_attach_view_alter() (line 613 of .../drupal-7.9/sites/all/modules/smart_paging/smart_paging.module).

Applying the patch on a reverted version 7.x-1.3 does not repair it for a second time: after clearing the caches, still the same message...

  • arpeggio committed 21f97bf on 7.x-2.x
    Issue #1179858 by Ravi.J: Fixed Notice: Undefined index:...
  • arpeggio committed 6a4c399 on 7.x-2.x
    Issue #1179858 by arpeggio: Corrected the wrong index assignment of...