Symptoms/description

Upgraded to 7.x-2.2 as suggested by the system, now I get the following warnings with every page load:

Notice: Undefined index: post-load integration files in libraries_load_files() (line 697 of /home/mysite/public_html/sites/all/modules/libraries/libraries.module).
Notice: Undefined index: post-load integration files in libraries_load_files() (line 775 of /home/mysite/public_html/sites/all/modules/libraries/libraries.module).

Solution:

Clear your cache.

Go to admin/config/development/performance and click "Clear all caches"

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webpotato’s picture

Issue summary: View changes
jacobkdavis’s picture

I was having the same problem. I checked the module code and it looks like it's not checking to see if that index is set before checking if it's not true.

It could be fixed by adding an "isset" before the check. From:

if (!$library['post-load integration files'] && !empty($library['integration files'])) {

to something like:

if ((isset($library['post-load integration files']) && !$library['post-load integration files']) && !empty($library['integration files'])) {

cmejo’s picture

worked for me too, thanks!

deminy’s picture

#2 works for me as well. Thanks

timkang’s picture

The isset() call should not be necessary, as the value should be set by default in libraries_info_defaults():

function libraries_info_defaults(&$library, $name) {
  $library += array(
...
    // @todo Remove in 7.x-3.x
    'post-load integration files' => FALSE,
  );

In the few sites where I've encountered this error, clearing the cache was sufficient to resolve it.

parijke’s picture

#2 worked for me, but following for a supported solution / patch

yaelo25@gmail.com’s picture

I tried the isset thing and the line 697 was resolved but i now get a double:
notice: Undefined index: post-load integration files in libraries_load_files() (line 775 of.... message

any ideas? thanks!

scottzak’s picture

Took several cache clears, but that did eliminate the problem for me.

Cynthia Ewer’s picture

Subscribing; experiencing the same issue.

yaelo25@gmail.com’s picture

solution was to go to line 775 in module code and replace it with the same as mentioned in #2. it solved the problem.

luis_mejia’s picture

I just update now libraries and has two alerts, i change the line in the module file but i still have the second alert message:
Notice: Undefined index: post-load integration files in libraries_load_files() (line 774 of /var/www/html/msco/sites/all/modules/libraries/libraries.module).

tsssystems’s picture

Clearing all caches, hitting a page, clearing all caches again, hitting another page, and clearing the caches a third time did the trick for me. Both errors gone. Don't know why it took more than one cache clearing, but it did.

Yazzbe’s picture

#2 fixed it for me too in D7.26

adrianh2’s picture

Drupal v7.26:

Per #2, adding isset( ) in lines 697 and 775 solves it for me.

Clearing the cache does not.

John Franklin’s picture

Status: Active » Needs review
FileSize
907 bytes

Attached patch uses empty() to do the same thing.

_San_’s picture

Clearing the cache ~4 or 5 times fixed this for me as well.

david_garcia’s picture

Same here, completely clearing the cache by means of update.php did the trick.

VirtualMitra’s picture

I was working in Aegir and migrated a site with libraries to a new platform, when I got this same error. Using drush, I rebuilt the registry (drush rr) for the site, cleared the cache (drush cc all), and it went away.

labboy0276’s picture

I created this patch based on the convos above. It seemed to work on some of our sites.

Easier then people hacking the core code.

greggles’s picture

Title: Undefined index: post-load integration files in libraries_load_files » Undefined index: post-load integration files in libraries_load_files (solved: clear your cache)
Category: Bug report » Support request
Issue summary: View changes
Status: Needs review » Active

Comment #5 points out that the real solution here is just to clear the cache.

Updating the original post to make that more clear and changing this from a bug to a support request.

I see that the release node has a clear note on this topic. In the future if a release needs to have the cache cleared it should have a hook_update that clears the specific cache.

1. depending on how updates are executed they will clear the cache
2. it makes it so there's much less of a chance of people experiencing the problem

tstoeckler’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
589 bytes

Re @greggles: I was always under the impression that running update.php (which should always be done as part of the module upgrade) always clears the cache. I might be mistaken, though. In any case, an explicit upgrade function is a good idea and can't really hurt.

Here's a patch that avoids the problem by just adding the default to the library definition.

  • 000a5d3 committed on 7.x-2.x
    Issue #2193969 by tstoeckler: Avoid warnings for stale library caches
    
tstoeckler’s picture

Status: Needs review » Fixed

Marking fixed. Please re-open if you still encounter the problem with the latest development version.

greggles’s picture

I think update.php (and/or drush updb) only clears the cache if there is an update hook to be run. It also clears the cache in a rather aggressive way that will cause problems for continuous deployment on a site that runs near capacity. See this issue about skipping the cache clear in updb.

Beyond that, if there's no update hook then most novice users will not see the call-to-action advising them to run update.php and most advanced users will think that it's unnecessary.

Clearing the required caches is the wave of the future ;)

Status: Fixed » Closed (fixed)

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

S.Wan’s picture

#19 works for me well, he showed two places which needs to be fixed, line 695 and 775, both places have to be changed to the recommended code.

Many thanks.