Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Using library_load, integration files are currently loaded before the library itself is loaded. In all cases (CSS, JS and certainly PHP), I think you'd want your integration files to come later, since they will patch, extend, or otherwise leverage the library files themselves. This patch moves the integration file loading to after loading the actual library files.
Comment | File | Size | Author |
---|---|---|---|
#14 | 1855918-14-integration-files-order.patch | 1.05 KB | amitgoyal |
#10 | 1855918-10-integration-files-order.patch | 1.08 KB | Elin Yordanov |
Comments
Comment #1
rbayliss CreditAttribution: rbayliss commentedComment #2
PolPatch working, thanks !
Comment #3
tstoecklerFor PHP files, this is a pretty big bug report actually, as you can't use PHP functions or classes from the library you depend on... #fail
Will commit this soon. This is technically a BC-break, but, again, I totally see this as a bug-fix.
Comment #4
tstoecklerSorry for letting this rot for so long!
Even though this is a change in behavior I could not think of any (realistic) way this would actually *break* stuff, so I committed this to all three current branches:
8.x-3.x: http://drupalcode.org/project/libraries.git/commit/570ce1284b3cc6a706db1...
7.x-3.x: http://drupalcode.org/project/libraries.git/commit/59ef3b21b615442827600...
7.x-2.x: http://drupalcode.org/project/libraries.git/commit/67a7bb3d74ea4c9650f68...
Comment #6
tstoecklerI in fact changed my mind on this. We shouldn't be doing any API changes in 7.x-2.x. Although loading integration files after the library files might still be the primary use-case, I can think of a couple use-cases for the opposite as well. So let's fix this properly in 3.x (i.e. allow both) and provide a backwards compatible way for this in 2.x. Patch coming up.
Comment #7
tstoecklerHere we go.
Comment #8
tstoecklerCommitted the attached patch to 7.x-2.x.
http://drupalcode.org/project/libraries.git/commit/8d57cc2eaca69f509f73d...
In the previous patch the test coverage was passing but not really valid. Because the parent tests get executed (potentially, depending on Batch API) in one request, the library file might already have been loaded, which makes the test pass even if the files are loaded incorrectly.
Moving to 7.x-3.x.
Comment #9
tstoecklerOops here's the actual patch.
Comment #10
Elin Yordanov CreditAttribution: Elin Yordanov commentedSince the latest update, because of the above patch, I am getting PHP notices like
Attached is the revisited patch, please review. (I wasn't sure if I should open a new issue for that, since the issue is related to this issue, actually is the consequence of the committed patch with the latest update.)
Comment #12
tstoecklerHm... thanks for the patch.
I don't see why those notices would appear, though. Have you tried a
drush cc all
? If that doesn't help could you help provide some debugging info, please, that would be awesome. It should be sufficient to just stick adebug(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS))
at the top of libraries_load_files(). Thanks!Comment #13
davidneedhamIt may be unrelated, but could you be using Colorbox, pc-wurm?
I was seeing the notices you're talking about and with some digging it eventually it led me here: https://drupal.org/node/2150665. In my case, updating Libraries to 7.x-2.2 and downgrading colorbox to 7.x-2.4 made all notices go away and restored all functionality.
Comment #14
amitgoyal CreditAttribution: amitgoyal commented@davidneedham - I am having Libraries 7.x-2.2 and Colorbox to 7.x-2.5 and there are no such notices. So these notices might be coming due to some other reason.
@tstoeckler - Although I couldn't reproduce the notices issue but as the notices are coming in libraries.module fie so it may make sense to add extra isset() check there. Attaching here the updated patch as the 1855918-10-integration-files-order.patch was not getting applied.
Comment #15
tstoecklerLet's handle that follow-up in #2193969: Undefined index: post-load integration files in libraries_load_files (solved: clear your cache).
Comment #16
tstoeckler7.x-3.x is very much outdated right now, so going back to fixed for now.