Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Got this message while upgrading v2.0 to v2.1 via drush.
Comment | File | Size | Author |
---|---|---|---|
#49 | libraries-undefined-index-foo.patch | 678 bytes | tstoeckler |
#12 | 0001-Fix-1938638-by-coredumperror-Fix-typo.patch | 834 bytes | Pol |
Comments
Comment #1
Carlos Miranda Levy CreditAttribution: Carlos Miranda Levy commentedGetting the same error on all my sites.
Log says:
Warning: Invalid argument supplied for foreach() in libraries_invoke() (line 161 of /home/webappz/drupal7/sites/all/modules/libraries/libraries.module).
Also getting:
Notice: Undefined index: pre-dependencies-load in libraries_invoke() (line 161 of /home/webappz/drupal7/sites/all/modules/libraries/libraries.module).
Have the following modules enabled that require libraries:
Colorbox
Nivo Slider
Both errors are generated for content pages ( node/xxx ), content type (blog, user/blog) and even for instances of image captcha (/image_captcha/xxx/xxxxxxx)
Other than the error message when upgrading and 2 errors for each content access (quickly filling the dblog -- some 60 errors a minute) the site appears to work fine.
Comment #2
PolI'll look into this ASAP.
Comment #3
PolThis is weird because the
function libraries_info_defaults()
adds this'pre-dependencies-load' => array()
, applied here.I'll keep digging...
Comment #4
Carlos Miranda Levy CreditAttribution: Carlos Miranda Levy commentedDon't sweat too much over this.
Apparently flushing the caches took care of it.
Not getting the error anymore since flushing all caches.
Comment #5
PolOk, closing the issue, reopen if there are still problem.
Comment #6
hass CreditAttribution: hass commentedThe bug is not fixed without a patch.
Comment #7
PolI don't think there is a bug here.
I think this is a problem caused by a wrong cache, that's why flushing it solve the problem.
Beside that, I'm unable to reproduce it at home. Of course, that doesn't mean there is no bug...
Did you succeeded to reproduce it on your side?
Comment #8
philsward CreditAttribution: philsward commentedClearing the cache using the "admin_menu" module seemed to fix the problem for me as well.
Comment #9
ferrangil CreditAttribution: ferrangil commentedYes, clear the cache and the error is gone.
Comment #10
coredumperror CreditAttribution: coredumperror commentedI think I might know the underlying cause of this. It's on line 302 in libraries.api.php:
Notice that the array index has a typo, "dependencie" rather than "dependencies". The code that references this array key, on line 426 and 617 in libraries.module, does not share this typo.
Comment #11
tstoecklerWe should simply clear the caches in the upgrade path. I didn't think of that.
Comment #12
PolAFAIK, I don't think that the .api.php file has anything to do with the error, but anyway, good catch, here is the patch for #10.
Comment #13
PolComment #14
boazr CreditAttribution: boazr commentedclearing cache did not solve anything here, for me.
Comment #15
boazr CreditAttribution: boazr commentedApplying the patch. Did not help as well:
Comment #16
boazr CreditAttribution: boazr commentedmy mistake.
after applying the patch and clearing cache, not getting the warning.
Comment #17
coredumperror CreditAttribution: coredumperror commentedI knew I should have just made that patch file myself. I was lazy, so I want to thank Pol for doing the work for me. :)
Also, it looks like the patch is working for a few people, so I set this issue to RTBC.
Comment #18
katannshaw CreditAttribution: katannshaw commentedPatch on #12 and clearing cache worked for me as well. Thanks Pol and everyone.
Comment #19
hass CreditAttribution: hass commentedThis patch does not fix the notices bug.
Comment #20
Pol@Hass: Can you explain how to reproduce the bug please ?
Thanks
Comment #21
tstoecklerI don't see how the api.php is related to this either, although the fix does look correct. Haven't debugged this in detail, though, TBH. I hope to get to it soon.
Comment #22
coredumperror CreditAttribution: coredumperror commentedI think the reason that the patch I suggested fixes this problem is because the patched function is
hook_libraries_info()
. It was incorrectly defining thepre-dependencies-load
key, and thus everything that tried to use that key caused an "undefined index error".Comment #23
hass CreditAttribution: hass commentedThe patch only fix API documentation, nothing else.
Comment #24
tstoeckler#23 is correct. Under no circumstances should the api.php file be loaded on a regular request and hook_libraries_info() should never ever be invoked as an actual hook.
Comment #25
coredumperror CreditAttribution: coredumperror commentedHuh, I was not aware of that.
Then why the heck did my patch fix the problem? Maybe it kicked the caches around a bit, which cleaned something up?
Comment #26
anavarreJust want to report that clearing Drupal caches fixes
Notice: Undefined index: pre-dependencies-load in libraries_invoke()
here.Comment #27
bendev CreditAttribution: bendev commentedsame issue fixed by clearing cache; thx
Comment #28
revagomes CreditAttribution: revagomes commentedClearing cache worked well to me.
No Warnings nor Notices since flushing all caches.
Comment #29
tstoecklerI just tried this out myself and I can reproduce the error when updating the code from 7.x-2.0 to 7.x-2.1. When running update.php, however, those notices disappear. As I had suspected, update.php correctly clears the caches, which is the cause for the notices.
That means that anyone who reported this error did not run update.php, which should be part of the normal procedure when updating modules. :-/
I added a note to the 7.x-2.1 release notes about running update.php
Marking this fixed. If anyone can reproduce this error *after* running update.php please re-open.
I also committed the patch in #12: http://drupalcode.org/project/libraries.git/commit/b7247ea00b94b515cdea5...
Thanks for that, Pol and coredumperror!
Comment #30
Polhass ?
Comment #31
hass CreditAttribution: hass commentedThat is completely incorrect as noted in past. I ran an "drush up" and this clears the caches AFTER the module has been updated. But the warnings are BEFORE the cache clear. You need to make sure that this error does not occur while running "drush up". I have no clue about the root cause.
Comment #32
tstoecklerAhh, that was not clear to me. That makes sense. Don't know where that was noted in the past, but hey... Anyway, sorry for the false accusations.
In theory update.php shouldn't be calling any hooks or anything exactly for this reason so I will have do dig at which point you are able to (try to) load a library in update.php. Can you list the libraries you used or the specific set-up? That would be very helpful, thanks.
Comment #33
tstoecklerAlso changing title to reflect the actual bug.
Comment #34
hass CreditAttribution: hass commentedJust from memory, but this is what I have installed, nothing else.
Comment #35
dianacastillo CreditAttribution: dianacastillo commentedI just got these errors when I tried to delete a piece of content : (I have run update.php several times )
Notice: Undefined index: pre-dependencies-load in libraries_invoke() (line 161 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\libraries\libraries.module).
Warning: Invalid argument supplied for foreach() in libraries_invoke() (line 161 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\libraries\libraries.module).
Notice: Undefined index: pre-dependencies-load in libraries_invoke() (line 161 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\libraries\libraries.module).
Warning: Invalid argument supplied for foreach() in libraries_invoke() (line 161 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\libraries\libraries.module).
Warning: require_once(C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn/sites/all/modules/ais/ctools/page_manager/plugins/tasks/page.inc): failed to open stream: No such file or directory in menu_execute_active_handler() (line 515 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\includes\menu.inc).
Notice: Undefined index: pre-dependencies-load in libraries_invoke() (line 161 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\libraries\libraries.module).
Warning: Invalid argument supplied for foreach() in libraries_invoke() (line 161 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\libraries\libraries.module).
Warning: require_once(C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn/sites/all/modules/ais/ctools/page_manager/plugins/tasks/page.inc): failed to open stream: No such file or directory in menu_execute_active_handler() (line 515 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\includes\menu.inc).
Notice: Undefined index: pre-dependencies-load in libraries_invoke() (line 161 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\libraries\libraries.module).
Warning: Invalid argument supplied for foreach() in libraries_invoke() (line 161 of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\pn\sites\all\modules\libraries\libraries.module).
Comment #36
katannshaw CreditAttribution: katannshaw commented@dianacastillo: I don't know if these steps will work for you, but they worked for me:
For me, these steps made the notices go away. Hope it helps.
Comment #37
PolOr even easier, use the dev version of Libraries API.
Comment #38
defconjuan CreditAttribution: defconjuan commentedIf the links and patches above don't help you, read on:
Short version: You may also need the patch by barraponto in comment 7 or 12 on http://drupal.org/node/1908042.
Long version: If you've come across this page when Googling "Notice: Undefined index: pre-dependencies-load in libraries_invoke() (line 161..." error like I have, most people reference (1) fixing a typo contained on line 302 of the libraries.api.php; (2) running Drupal update; and (3) clearing all caches. This fixes it for many people, but not for Panopoly or Kala Theme users. For those users, you need to apply the patch by barraponto in comment 7 or 12 on http://drupal.org/node/1908042, then clear your cache and you'll be good to go.
Comment #39
tstoecklerRe #38: Thanks for sharing that! I was not aware of that other issue. That is in fact incorrect usage that should be fixed independently.
For this issue, I still have no concrete steps to reproduce this, which is why this is seemingly going nowhere.
Comment #40
hass CreditAttribution: hass commentedBeget: running update.php cleares all caches. What i said is still correct and does not go away from itself. I'm not running the theme you linked to.
Comment #41
defconjuan CreditAttribution: defconjuan commentedYou're right hass. Running
drush cc all
after runing update is not necessary -- you're clearing the cache twice. I do it anyway as I'm pretty sure it doesn't hurt.The purpose of my post is that if doing the fix and clearing your cache does not fix the issue -- you COULD have a theme-linked issue that's fixed in the thread I linked.
Comment #42
tstoecklerRe #40: hass, could you please clarify: From the comments above, I thought the problem was that the cached libraries were being accessed on update.php before the caches were being cleared. If that were the case, the notices would appear until the caches are cleared. Are you saying that the notices stick even after running update.php and clearing the caches? Again, I'm not implying this is not an actual bug, it's just that I cannot in any way reproduce this, so more information would be great.
Comment #43
hass CreditAttribution: hass commentedFirst of all - I have no idea what this hook does and when it runs.
I just upgraded the module via drush and got these errors. As I have no idea about the internals of the module I cannot help more than telling how to reproduce this bug. This is 100% reproducible as a lot of others have seen it, too.
Comment #44
tstoecklerPlease don't make such biased assumptions they're not getting us any further. I said repeatedly that I was not able to reproduce the issue.
What were the exact steps you took? Just saying "I upgraded with Drush" aren't real steps to reproduce. If you could provide those I might be able to help.
Comment #45
hass CreditAttribution: hass commentedComment #46
richardj CreditAttribution: richardj commentedGot the same error while updating the module through Drush, i used: drush pm-update libraries to get from version 2.0 to 2.1,
The error happens indeed before the cache is flushed (which does the drush pm-update function by default). This is the output the terminal gives (path changed for obvious reasons).
disclaimer: this project was taken over by us from another dev, so i can't say which ones are actually in use right now.
edit: edited the code to be better readable.
edit2: updated with list of libraries installed
Comment #47
tstoecklerFor anyone posting here. It would be super helpful to list the exact libraries you are using on the site. Ideally the versions, etc. as well and the modules that are using it.
Comment #48
0mni CreditAttribution: 0mni commented//Rage On
I am very annoyed at the fact that because I can't package the library I need I have to use the Libraries module, but it is causing problems with my module installation, as I predicted but was shot down when I was asking about what I can do to get exempt. Utterly ridiculous especially when I library I want to include is under the same GNU GPL license ....
//Rage Off
I have this problem when I enable my module Omni EVE API every time. https://drupal.org/sandbox/0mni/2043647
It is a brand new standard Drupal install, v7.23
Modules I have installed:
Elysia Cron - 7.x-2.1
Email Confirm - 7.x-1.1
Libraries - 7.x-2.1 (I have applied the patch above before enableing for the first time.)
Devel - 7.x-1.3 (Redirect page enabled so I can see the noticies)
Chaos tools - 7.x-1.3
Omni EVE API - My Module I created.
This is in my omni_eve_api.install
This is where I load the teamspeak framework, as well where the get_version function exists.
This file is included in omni_eve_api.module
omni_eve_api.ts3.inc
This is located in omni_eve_api.module
Comment #49
tstoecklerInstead of carefully trying to reproduce this I decided to roll the following patch.
It would be great if someone could test this.
We can still decide to rip this code back out in 2.4 or whatever, but at this point I'm pretty tired of this issue and could live with this patch.
Comment #50
TravisCarden CreditAttribution: TravisCarden commentedI was consistently getting this error after running updb, but after applying the patch in #49 I no longer get it. The change looks like a no-brainer from the diff.
Comment #51
tstoecklerComitted this to 7.x-2.x
http://drupalcode.org/project/libraries.git/commit/037017e04a208afde0cba...<?php
Comment #53
tstoecklerThe typo fix was never committed to 7.x-3.x so did so now: http://drupalcode.org/project/libraries.git/commit/ec9ddc9e26725550187fc...