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.
After a cache rebuild, the first time I'm on page with ckeditor I get and errors. My website is in French, it was installed in english and I switched to french after (but before installing ckeditor_media_embed).
I'm not sure it's linked to this module!
Warning: file_get_contents(/libraries/ckeditor/plugins/embedbase/plugin.js): failed to open stream: No such file or directory in _locale_parse_js_file() (line 1145 of core/modules/locale/locale.module).
_locale_parse_js_file('/libraries/ckeditor/plugins/embedbase/plugin.js') (Line: 543)
Comments
Comment #2
grndlvl CreditAttribution: grndlvl at GollyGood Software for Advomatic commentedgagarine,
Can you confirm the plugins are installed? https://www.drupal.org/project/ckeditor_media_embed#ckeditor-media-embed...
It should tell you on the status page
admin/reports/status
.Comment #3
flyke CreditAttribution: flyke commentedI myself use the CKEditor Media Embed plugin in my Drupal 8 site.
The plugin works, and the admin/reports/status shows that the plugin is installed correctly.
However, i do get similar errors in the backoffice when editing a page.
All the files in the error message failed to open stream are there and i can open them using the paths given in the error message inside file_get_contents.
The error messages:
Comment #4
grndlvl CreditAttribution: grndlvl at GollyGood Software for Advomatic commentedHrmm, OK I will try to look into this a little this weekend. It kind of seems that the wrong path is being used here with the _locale_parse_js_file() it's using "/libraries" instead of "DRUPAL_ROOT . '/libraries'".
Comment #5
flyke CreditAttribution: flyke commentedOk, hope this gets fixed.
For now I patched core\modules\locale\locale.module. Inside the function _locale_parse_js_file($filepath) (line 1133) I added a if(file_exists($filepath)) so I can work for now without those errors until it gets fixed.
Comment #6
flyke CreditAttribution: flyke commentedComment #7
gauladell CreditAttribution: gauladell commentedPatch needs reroll for core 8.2.x It would be nice if the patch could be generated with git diff.
Comment #8
flyke CreditAttribution: flyke commentedI normally always create patches via phpstom menu, but since I had this problem again I tried to create a patch using git diff this time.
Does exactly the same as I mentioned in #6.
Comment #9
flyke CreditAttribution: flyke commentedI seem to have did something wrong when adding the patch in the previous comment.
Comment #10
Andrew Gorokhovets CreditAttribution: Andrew Gorokhovets commentedHi everyone! I Think that we don't needed to patch the core in this issue.
As can be seen from the error message, the problem is generated in core/modules/locale/locale.module:1144
Also we can see what $filepath is generated. It is '/libraries/ckeditor/plugins/embedbase/plugin.js' for example.
If you try manually run
It will return FALSE. Because starting from Drupal 8.3 we don't need to use a first slash.
This will work fine.
Also take a look to the relevant issue and pathe: #2860254: Warning: file_get_contents(/libraries/ckeditor/plugins/filetools/plugin.js): failed to open stream: No such file or directory in _locale_parse_js_file() (/var/www/drupal/docroot/core/modules/locale/locale.module line 1134)
And I hope the notice will be fixed in core: #1803330: Add file_exists() to _locale_parse_js_file() to prevent PHP warning
Comment #11
Andrew Gorokhovets CreditAttribution: Andrew Gorokhovets commentedComment #16
Andrew Gorokhovets CreditAttribution: Andrew Gorokhovets commentedRetry to apply patch.
Comment #18
Andrew Gorokhovets CreditAttribution: Andrew Gorokhovets commentedAdded fix to unitest
Comment #19
jlamp CreditAttribution: jlamp at GollyGood Software commentedTested the patch on #18 with YouTube and Twitter embeds with translation turned on, the error messages are no longer generated with the change. Marked RTBTC.
Comment #21
grndlvl CreditAttribution: grndlvl at GollyGood Software for Advomatic commentedGreat job everyone! I finally got around to replicating and testing this thoroughly and it works great! Committed!