[3.3.0.10] All ajax calls are broken

Hi PKP community! I have a strange problem that I’m trying to figure out the source of. I have a bunch of 3.3.0.10 instances running on the same server and they all work great except for one. None of the ajax calls on the admin / backend side work. Everything is just stuck in “loading”.

The browser console log shows errors like this:

Uncaught SyntaxError: ‘’ string literal contains unescaped line break

And in the generate template code there are message like this where the js template data should be:

Notice: escape: unsupported type: js - returning unmodified string in /lib/pkp/lib/vendor/smarty/smarty/libs/plugins/modifier.escape.php on line 258

I managed to fix the problem by adding a case for “js” in /lib/pkp/classes/template/PKPTemplateManager.inc.php at line 1783 in the smartyEscape function like so:

case 'js':
$result = smarty_modifier_escape($string, 'javascript', $char_set);
$result = preg_replace($pattern, $replacement, $result);
return $result;

This forces any instances of esc_type = ‘js’ to be treated as ‘javascript’ by the smarty modifier.escape.php file, but I still have no idea why this is happening with just the one instance. I do see the “unsupported type: js - returning unmodified string” notice show up in my error log for other instances that are working.

Okay I figured it out. Make sure display_errors in the config is set to ‘off’, otherwise it returns the notice message instead of the data. Either way, maybe it’s a good idea to include the extra ‘js’ case in PKPTemplateManager.inc.php.

Displaying errors shouldn’t break ajax calls.

1 Like

Hi @bart,

This is actually a typo in a template; you can fix it with:

But yes, it’s a good idea to direct errors/warnings to the log rather than the browser.

Regards,
Alec Smecher
Public Knowledge Project Team

Ah perfect! Thanks @asmecher !

1 Like