MyBB Community Forums

Full Version: [PostUpgrade] Error after upgrading 1.8.5: Uncaught SyntaxError: Unexpected token
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi MyBB Community,

I have created for my forum my own template (I have this template since longer than 3 months). Well, re-created and fixed a lot and everything was working. Since I have updated the forum-system to 1.8.5 today, we get a Javascript error when my users are trying to post a quick-reply.

The post has been sent and handled by the system, but after it you have to refresh the page to see your comment. When we watch our javascript console we see this error after posting a message:

Quote:Uncaught SyntaxError: Unexpected token

I had the error before, but that was because the id="post_{id}" was missing in the postbit. That error was way before the upgrading fixed (3 months ago), so that should not be it (I've checked it).

Now it is something else, and I cannot figger it out what is wrong... Maybe anyone knows how to fix this? Google has only answers for the jquery affected problems... But nothing has changed into the javascript files?

Screen of the error:
[Image: dkQpEKU.png]
(or http://prntscr.com/7py8xp )

I hope anyone of you has the same problem and know how to fix it Smile

Greets,
Jasper

P.S. I tought this was the right sub-category to post this in - If I am wrong, please correct me
Moved to 1.8 General Support and tagged with JS prefix and PostUpgrade label in title for clarity
At the browser console you can click on the source file (right part of the line) to look at it. Then you are able to see the code which triggered the error. Can you do that?
(07-08-2015, 10:53 AM)Ad Bakker Wrote: [ -> ]At the browser console you can click on the source file (right part of the line) to look at it. Then you are able to see the code which triggered the error. Can you do that?

Yup, I did that allready, unfortunately I see the sourcecode of the webpage itself.

[Image: TqUIqgV.png]
http://prntscr.com/7q8wlh
Can you post your headerinclude template (in ungrouped templates)?
(07-08-2015, 08:38 PM)Ad Bakker Wrote: [ -> ]Can you post your headerinclude template (in ungrouped templates)?

Okey, here you go:

Quote:<link rel="alternate" type="application/rss+xml" title="{$lang->latest_threads} (RSS 2.0)" href="{$mybb->settings['bburl']}/syndication.php" />
<link rel="alternate" type="application/atom+xml" title="{$lang->latest_threads} (Atom 1.0)" href="{$mybb->settings['bburl']}/syndication.php?type=atom1.0" />
<link href='//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css' rel='stylesheet' type='text/css'>
<link href='{$mybb->asset_url}/cache/themes/devnl/icons.css?v=0.6' rel='stylesheet' type='text/css'>
<link type="text/css" rel="stylesheet" href="{$mybb->asset_url}/cache/themes/theme13/global.css?v=0.6.8.6.1" />
<link type="text/css" rel="stylesheet" href="{$mybb->asset_url}/cache/themes/theme13/tipTip.css" />
<link type="text/css" rel="stylesheet" href="{$mybb->asset_url}/cache/themes/theme13/css3.css" />
<link type="text/css" rel="stylesheet" href="{$mybb->asset_url}/cache/themes/theme13/Extras.css" />
<link type="text/css" rel="stylesheet" href="{$mybb->asset_url}/cache/themes/theme13/profilep.css?v=0.1" />
<link type="text/css" rel="stylesheet" href="{$mybb->asset_url}/cache/themes/theme13/contactdropdown.css" />
<link type="text/css" rel="stylesheet" href="{$mybb->asset_url}/cache/themes/theme13/mypress.css" />
<link type="text/css" rel="stylesheet" href="{$mybb->asset_url}/cache/themes/theme13/tabs.css" />
<link type="text/css" rel="stylesheet" href="{$mybb->asset_url}/images/devnl/v2/slicknav.css" />
<link type="text/css" rel="stylesheet" href="{$mybb->asset_url}/cache/themes/theme13/font-awesome-animation.min.css" />
<link rel="stylesheet" href="{$mybb->asset_url}/cache/themes/devnl/font-mfizz.css" />
<!--[if lte IE 7]><link rel="stylesheet" href="{$mybb->asset_url}/cache/themes/devnl/fontcustom-ie7.css" /><![endif]-->
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,200italic,400italic,600italic' rel='stylesheet' type='text/css'>
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.js?ver=1800"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.plugins.min.js?ver=1800"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/general.js?ver=1805.1"></script>
<script type="text/javascript" src="{$mybb->asset_url}/images/devnl/jquery.tipsy.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/images/devnl/jquery.cookie.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/iframeheight.min.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/images/devnl/v2/jqueryslidemenu.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/images/devnl/v2/jquery.slicknav.js"></script>

<script type="text/javascript" src="//www.skypeassets.com/i/scom/js/skype-uri.js"></script>
<link rel="shortcut icon" type="image/x-icon" href="{$mybb->asset_url}/favicon.ico">
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport' />
<meta property="og:image" content="http://devnl.nl/images/devnl/v2/banner_1.png" />

    <meta property="og:title" content="DevNL">
    <meta property="og:type" content="website">
    <meta property="og:url" content="{$mybb->asset_url}">
    <meta property="og:image" content="{$mybb->asset_url}/images/devnl/v2/banner_1.png">
    <meta property="og:image:type" content="image/png">
    <meta property="og:image:width" content="620">
    <meta property="og:image:height" content="382">

<meta name="description" content="DevNL is een Nederlands Development forum. Gemaakt voor developers door developers! Probleem? Vraag het hier! Software, games, web en veel meer!" />

<meta name="keywords" content="development, community, webdevelopment, webdeveloper, gamedevelopment, gamedeveloper, dev.nl, devnl, devnl.nl, forum, websupport, software, games, php, html, css, javascript, mysql, webdesigner, hulp, help, game maker, unity, 3D Max, tutorials, visual studio, apps, linux, windows, apple, besturingsystemen, programmas, programma's, developers forum nederlands, nederlands developers forum, forum nederlands, nederlands forum" />

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-59422211-2', 'auto');
  ga('send', 'pageview');

</script>

<script type='text/javascript'> 
jQuery(function() {
jQuery("a").tipsy({gravity: jQuery.fn.tipsy.autoNS});
jQuery("title").tipsy({gravity: jQuery.fn.tipsy.autoNS});
jQuery("img").tipsy({gravity: jQuery.fn.tipsy.autoNS});
jQuery("i").tipsy({gravity: jQuery.fn.tipsy.autoNS});
jQuery("span").tipsy({gravity: jQuery.fn.tipsy.autoNS});
jQuery("div").tipsy({gravity: jQuery.fn.tipsy.autoNS});
  });
</script>

{$stylesheets}{$myprofile_headerinclude}


<script type="text/javascript">
<!--
lang.unknown_error = "{$lang->unknown_error}";

lang.select2_match = "{$lang->select2_match}";
lang.select2_matches = "{$lang->select2_matches}";
lang.select2_nomatches = "{$lang->select2_nomatches}";
lang.select2_inputtooshort_single = "{$lang->select2_inputtooshort_single}";
lang.select2_inputtooshort_plural = "{$lang->select2_inputtooshort_plural}";
lang.select2_inputtoolong_single = "{$lang->select2_inputtoolong_single}";
lang.select2_inputtoolong_plural = "{$lang->select2_inputtoolong_plural}";
lang.select2_selectiontoobig_single = "{$lang->select2_selectiontoobig_single}";
lang.select2_selectiontoobig_plural = "{$lang->select2_selectiontoobig_plural}";
lang.select2_loadmore = "{$lang->select2_loadmore}";
lang.select2_searching = "{$lang->select2_searching}";

var cookieDomain = "{$mybb->settings['cookiedomain']}";
var cookiePath = "{$mybb->settings['cookiepath']}";
var cookiePrefix = "{$mybb->settings['cookieprefix']}";
var deleteevent_confirm = "{$lang->deleteevent_confirm}";
var removeattach_confirm = "{$lang->removeattach_confirm}";
var loading_text = '{$lang->ajax_loading}';
var saving_changes = '{$lang->saving_changes}';
var use_xmlhttprequest = "{$mybb->settings['use_xmlhttprequest']}";
var my_post_key = "{$mybb->post_code}";
var rootpath = "{$mybb->settings['bburl']}";
var imagepath = "{$theme['imgdir']}";
  var yes_confirm = "{$lang->yes}";
var no_confirm = "{$lang->no}";
var MyBBEditor = null;
var spinner_image = "{$theme['imgdir']}/spinner.gif";
var spinner = "<img src='" + spinner_image +"' alt='' />";
// -->
</script>

<script language="JavaScript">
<!--
function iframeResize(iframeobject){
iframeobject.style.height = "500px";
}
//-->
</script>

<?php 
if($mybb->user['uid'] == 0) {
   // No guest
}else {
echo'<script type="text/javascript">
var $_Tawk_API={},$_Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src=\'https://embed.tawk.to/559040ab50028e854ddf4de0/default\';
s1.charset=\'UTF-8\';
s1.setAttribute(\'crossorigin\',\'*\');
s0.parentNode.insertBefore(s1,s0);
})();
</script>'; 
}


?>
Don't see anything there, unfortunately. Still some additional questions:

With Firefox I have two types of consoles, web console and browser console. Yours looks like the webconsole, do you also have a browser console? Because that brings you to the source of the file with the error. And since it is a syntax error it must become clear what the cause is.

Do you have many active plugins? If so, deactivate them all and after that activate them one by one and do a check every time. So you can find out whether it is caused by a plugin.

When I look at my original 1.8.5 files I see the following for general.js:

<script type="text/javascript" src="{$mybb->asset_url}/jscripts/general.js?ver=1804"></script>

But in your headerinclude I see "ver=1805.1". Is there an explanation?

You have so many additional javascript, so that I hope that via the browser console it will become clear which script gives the problems.
Fixed:
I fixed the error! It came to the plugin 'Reply Ban'. After I disabled it it worked directly. So if you get a error like this: Disable some plugins, maybe it is because of that...

That plugin has a weird space at the top of the page, so I disabled it, and directly the post error has gone away... So that was it :|

(07-09-2015, 12:07 PM)Ad Bakker Wrote: [ -> ]Don't see anything there, unfortunately. Still some additional questions:

With Firefox I have two types of consoles, web console and browser console. Yours looks like the webconsole, do you also have a browser console? Because that brings you to the source of the file with the error. And since it is a syntax error it must become clear what the cause is.

Do you have many active plugins? If so, deactivate them all and after that activate them one by one and do a check every time. So you can find out whether it is caused by a plugin.

When I look at my original 1.8.5 files I see the following for general.js:

<script type="text/javascript" src="{$mybb->asset_url}/jscripts/general.js?ver=1804"></script>

But in your headerinclude I see "ver=1805.1". Is there an explanation?

You have so many additional javascript, so that I hope that via the browser console it will become clear which script gives the problems.

This has nothing to do with the error, so skip this if you are looking to fix the error, the fix is at the top of this message.
Yeah, I have a explenation for that general.js?ver=1805.1 Toungue 

I added this to it:
[Image: q4P2Xxb.png]
http://prntscr.com/7qo58y

You can understand it, because you are Dutch, but for the others, it says: "This is the console of DevNL/BE... If you get told enter special codes, this this can lead to infringement in your account by that person".

So because the cache I am allways using the '?v=VERSION_ID', this time I used '?ver=1805.1', the .1 is because I made a mistake and fixed it XD

By the way, thank you for replying to my topic, but it is solved now Smile