Minifer issue when upgraded to 8.5.2

Permalink
I have the plugin Event Calendar PRO. This was working fine until I updated to 8.5.2. When I updated I received the following error.

RuntimeException
Unclosed string at position: 101462
case "\n":
if ($stringType === '`') {
echo $this->a;
} else {
throw new \RuntimeException('Unclosed string at position: ' . $startpos);
}
break;

(full details in screen shot).

I found that that if I turned off CSS and JavaScript Cache that this fixed the problem.

Obviously this isn't the preferred solution. Any suggestions on resolving this problem more permanently?

p.s. (I did contact the developer for this plugin and he is no longer supporting it - but did help me uncover the temporary solution)

1 Attachment

plschneide
View Replies:
mnakalay replied on at Permalink Reply
mnakalay
Hello,
What you would have to do is modify the plugin so it loads the scripts differently and specifically make it NOT minify these scripts (which are already minified anyway)

Do you know how or would you like help with that?
plschneide replied on at Permalink Reply
plschneide
Thanks for the feedback. I do not know how to do that. I would appreciate some tips/info on what to look for/adjust.
mnakalay replied on at Permalink Reply
mnakalay
No problem. Follow these steps. And I apologize if I'm explaining every little detail. I don't know if you can code or not and I figured it was faster this way than doing some back and forth to figure it out :)

First, go to your package files and inside the "blocks" directory. You will see you have 4 blocks there, each in a directory. Go into the first one and you will see a "js" directory. Copy the file that's inside it (dsEventCalendarBlock.js) then go back to the root of the package directory itself. There is already a "js" directory there with multiple files in it. Put the file you just copied inside that "js" dir alongside the other files.

Now back to the root of the package, open the file controller.php to edit it.

Ad the top, where you see 4 lines starting with "use" add these 2 lines
use Concrete\Core\Asset\Asset;
use Concrete\Core\Asset\AssetList;


Then lower down, right after the function getPackageName() add this code.
Don't add the addPackageName() function as it's already there, I just added it to show you where to put the new on_start() function.

public function getPackageName()
{
    return t('Event Calendar PRO');
}
public function on_start()
{
    $al = AssetList::getInstance();
    $al->register(
        'javascript',
        'eventCalendarPro/calendarScript',
        'js/dsEventCalendarBlock.js',
        [
            'version' => $this->pkgVersion,
            'position' => Asset::ASSET_POSITION_FOOTER,
            'minify' => false,


Now save, close that file and go back to your "blocks" folder.

This is very important: for each of the 4 blocks delete the "js" dir it includes.

Your last step is to modify the file controller.php for each of the 4 blocks.

In each of the 4 controller.php files add this function right after the getBlockTypeName() function for instance.

public function registerViewAssets($outputContent = '')
{
    $this->requireAsset('javascript', 'eventCalendarPro/calendarScript');
}


And that's it. You may want to empty your Concrete cache from the dashboard and then try it.

Let me know if something is not clear.