grav-plugin-shortcode-core
grav-plugin-shortcode-core copied to clipboard
Update 4.1.6 to 4.2.3 breaks site
Hi there,
We're seeing an issue with shortcode core that breaks the live site - and I'm not sure how to begin diagnosing!
We're running Grav 1.6.25 - and this morning updated all plugins to the latest version. That update migrated shortcode code from 4.1.6 to 4.2.3 - but after the update we see this message on the live site:
With this message in the logs:
[2020-05-27 09:52:41] grav.CRITICAL: Class 'Thunder\Shortcode\EventContainer\EventContainer' not found - Trace: #0 D:\home\site\wwwroot\user\plugins\shortcode-core\shortcode-core.php(64): Grav\Plugin\ShortcodeCore\ShortcodeManager->__construct() #1 D:\home\site\wwwroot\vendor\symfony\event-dispatcher\EventDispatcher.php(212): Grav\Plugin\ShortcodeCorePlugin->onPluginsInitialized(Object(RocketTheme\Toolbox\Event\Event), 'onPluginsInitia...', Object(RocketTheme\Toolbox\Event\EventDispatcher)) #2 D:\home\site\wwwroot\vendor\symfony\event-dispatcher\EventDispatcher.php(44): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'onPluginsInitia...', Object(RocketTheme\Toolbox\Event\Event)) #3 D:\home\site\wwwroot\vendor\rockettheme\toolbox\Event\src\EventDispatcher.php(23): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('onPluginsInitia...', Object(RocketTheme\Toolbox\Event\Event)) #4 D:\home\site\wwwroot\system\src\Grav\Common\Grav.php(403): RocketTheme\Toolbox\Event\EventDispatcher->dispatch('onPluginsInitia...', Object(RocketTheme\Toolbox\Event\Event)) #5 D:\home\site\wwwroot\system\src\Grav\Common\Processors\PluginsProcessor.php(27): Grav\Common\Grav->fireEvent('onPluginsInitia...') #6 D:\home\site\wwwroot\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(45): Grav\Common\Processors\PluginsProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler))
For those people seeing the error if they clear their local cookies the issue goes away! I've able to repeat that with several people - each time clearing different degrees of local storage.
For now I've had to revert the site back to the older version - but I'm puzzled why this issue happens. Any idea?
Thanks!
Do you have a custom shortcode?
Hey Andy - thanks for getting back to me. Yes - I have a few custom shortcodes written as a companion plugin. Is that a likely cause? I couldn't see anything in the example code that's changed immediately - but might have missed something :-)
First try disabling the plugin that adds those if possible. See if the error stops. Then it’s definitely related to them. Also if you can post the entire short code class I can see if anything jumps out at me.
We have a number of shortcode custom plugins that now dont work either: sqllite, an admin tool and a couple of others. I looked at the code, and the diffs are quite substantial (in shortcode). Can you give any general advice on how we could move to the new version - is there any harm using the old one?
do you get an error at all? what parser in short code core are you using?
No error. Even breaks grav debugger (so cant track it very easily). I think I have found something that might be related - is the use of quotes different in generation of strings in twig? To explain its use: One is an extension of the sqlite plugin. So the short code looks like:
{% set query = ("[sql-table json]select * from scenes where projectid = '" ~ pp.uid ) ~ "' [/sql-table]" %}
The return data has quotes in it as well. Then it gets converted to json using json_decode.
I have been putting in logging to catch the line, and its on the shortcode execution line (I split up my twig commands to find this).
Is it possible that its quotes related? if so, I might see if I can change my DB data to see if that fixes it.
Oh. Parser. Erm. Whatever is installed? I'll try out the other ones. Thanks, thats probably it! -- edit -- I should note, I also installed minify (the plugin) as well as upgrading other plugins. Do you know if there might be issues with minify? As far as I can tell, the parser didnt fix it, and nor has changing quote methods. i think it is now more likely minify has broken it. I tried some simpler pages, and they work fine.
We can't recreate the error at all strangely - our local build uses the latest versions of the plugin and continues to work whether or not our own extensions are enabled. I'm slightly cautious about breaking live to diagnose further at the moment :)
My guess is that in our case it's something to do with using the Web Admin interface to update the plugins (our local and CI builds all do fresh installs), or that our live environment is using a Windows Web App on Azure.
Thanks for looking at it. Im really not certain where this issue is coming from. Im starting to delve into the DB side of things, its possible that something there (the data coming from DB) is not formatted or correctly structured for minify and shortcode use. Will let you know if I find anything specific.
Update: I didnt really resolve this. I changed architecture to get around using the db data. Which was a little time-consuming. I think it is much more likely this is a sqlite extension issue. Again, thanks for the assistance.