Problem/Motivation
JS Cookie is added as a dependency, but for existing installs it is not enabled during the update process.
Also, somehow the code seems to think it is a theme.
Steps to reproduce
- Install a version before JS Cookie was introduced as a dependency
- Update to the latest version
- Try to open any page on the site
- See these warnings:
User warning: The following theme is missing from the file system: js_cookie in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).User warning: The following theme is missing from the file system: js_cookie in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
Proposed resolution
Add an update hook that enables the module when it isn't.
Remaining tasks
Code changesCreate merge requestCode review- Functional review
- Merge
User interface changes
None.
API changes
None.
Data model changes
None.
Original report
After upgrading, with php 8.2 I get the following warnings:
User warning: The following theme is missing from the file system: js_cookie in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
User warning: The following theme is missing from the file system: js_cookie in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | multiple_warnings_after_upgrading-3449275-5.patch | 1.14 KB | ahmetburkan |
Issue fork autologout-3449275
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
ahmetburkanThere is a workaround at the moment. Manually enabling the "js_cookie" contrib module.
Comment #3
doxigo commentedYup that works as a workaround, thanks
Comment #5
ahmetburkanCreated merge request and patch. This is ready to be reviewed.
Comment #6
eelkeblokUpdated title and issue summary
Comment #7
eelkeblokCode looks good. I also upgraded this to major. I haven't functionally tested the changes yet.
Comment #8
eelkeblokI've just deployed the changes with the module enabled, but I still see these errors. One part I did not give much notice, but is really kind of weird, is that the error says that the theme js_cookie is not enabled...
Comment #9
eelkeblokSorry for the confusion. Something went wrong, errors are resolved after enabling the module. What remains is a functional test of the update hook.
Comment #10
mglamanCame here to mention this. It was added in #3388601: Use GitLab CI for testing without its own specific issue to explain why.
Comment #11
mglamanLeft a comment on the MR.
Comment #14
the_g_bomb commentedCreate a new PR as the other one looks to be open against the 8.x-1.x branch.
Made the alteration suggested by @ericgsmith
Comment #15
herved commentedHi, would it be possible to remove the js-cookie dependency entirely?
I only realized now but the lib uses a CDN (both core/js-cookie and the contrib) and goes against our current CORS policy on several projects.
Looking at the autologout JS it looks rather easy/feasible but I wanted to ask here before creating a new issue.
Thanks
Correction:
core/js-cookie doesn't use a CDN but the contrib does by default. However we can make it local as per #3390616: Document using local library file, with CDN as fallback (Module violates GDPR compliance)
Still, I wonder if it would be worth removing the dependency?
Comment #16
ahmetburkanI tested the functionality, and it works as expected! Updating the status.
As for the comment above, I think we should consider a new ticket. Because currently we have a bug, and the suggestion sounds more like a feature.
If we want to fix the way the dependency is loaded in this ticket, feel free to set the status back to "Needs work".
Comment #17
ericgsmith commentedI think your suggestion to create a new ticket is correct - this is a bug fix for something that is already released and the MR fixes this - IMO lets not delay fixing this based on another option at this point. Sounds like a good discussion to move to a new issue
+1 for RTBC
Comment #18
the_g_bomb commented+1 to remove the dependency, but I agree it should be a new ticket. Would be good to get this merged.
Comment #19
ahmetburkanIs it possible to get this merged?
Comment #22
japerryI'll merge this in to fix the immediate problem. the Contrib JS cookie was added because of its removal from core... however I'd need to look back and figure out where that code is being derived from in this module. Agree that its a separate ticket.
https://www.drupal.org/project/js_cookie/
Comment #25
ressa@herved: +1 to investigate if removing the JS Cookie dependency is possible, and I created #3557620: Remove JS Cookie dependency.