View Full Version : Strange parse error
gajinoz
11-02-2014, 05:46 AM
Does anyone have any idea what might be causing the following error?
Vers. 4.2.3
Parse error: syntax error, unexpected '<' in /home/xxxxxxxx/public_html/vb4/includes/class_core.php(4715) : eval()'d code on line 1
It happens every now and the. When doing something in the forum the whole page will suddenly go blank and be filled with many lines of the above.
It's caused by one of your templates which has an invalid expression or tag in it.
When it happens again, look at the template it uses and search in the template for any weird things related to "<".
gajinoz
11-04-2014, 04:29 AM
It's caused by one of your templates which has an invalid expression or tag in it.
When it happens again, look at the template it uses and search in the template for any weird things related to "<".
OK, but how do I know what template to look at?
ForceHSS
11-04-2014, 04:41 AM
What are you doing on your site when it happens? Also a link to your site so when we check we can tell you what template it is if an account is needed then please create a test account for us
gajinoz
11-04-2014, 04:53 AM
What are you doing on your site when it happens? Also a link to your site so when we check we can tell you what template it is if an account is needed then please create a test account for us
The problem I have is that it is VERY random and doesn't happen very often, in fact I have had only two people tell me that they are seeing it.
You could sit there on the site all day and chances are you'd never see it. Most of the times it's happened to me is when I'm viewing who's online then go back to the main forum. I'm not sure how you would determine the template because, when it happens the entire screen fills with line like the one I have in my first post. Nothing else at all. A simple refresh of the web page and it disappears.
I've been disabling plugins one by one trying to see which one could be the culprit but the problem happens so infrequently that you can never be sure if it's fixed or not so the process is a very long one.
Lynne
11-04-2014, 03:55 PM
As already pointed out, that part of the code in class_core.php is rendering a template. Have you tried using a totally default style on your site and seeing if you still get the same error?
gajinoz
11-04-2014, 07:21 PM
As already pointed out, that part of the code in class_core.php is rendering a template. Have you tried using a totally default style on your site and seeing if you still get the same error?
It is a totally default style, I have never used any other than the default. I am also turning off the plugins one by one to see if one of those is causing it.
I understand it could be a template I simply don't know how to determine what template.
I am also turning off the plugins one by one to see if one of those is causing it.
That's a good idea. It's pretty common for plugins to change the template cache, so it could be that all your templates are OK.
I haven't tried this at all myself, but you might try editing file includes/class_core.php and (temporarily) changing the lines around line 4715 like this (the red parts are added):
if (strpos($template_code, '$final_rendered') !== false)
{
ob_start();
eval($template_code);
if (($error = ob_get_clean()) !== '') {
echo $error;
echo "\nTemplate '{$this->template}'\n\n";
var_dump(debug_backtrace());
}
}
else
and maybe 'die' after the backtrace if you don't want a bunch of them. Again that would be temporary of course because you normally wouldn't want to be doing all that for every template.
If you want to try it and you aren't used to doing things like that, I'd suggest that you copy class_core.php to another name before changing it, that way if you run in to problems you can just copy it back.
HM666
11-04-2014, 08:35 PM
Login to your vB Admincp and click on "Settings>Options" on the side menu, then go to "General Settings" in the drop down and choose it. Now scroll down and find "Add Template Name in HTML Comments" tick "Yes" and then scroll down and save the settings. This will render the template name when you view the source of the site. Go to your site on the thread/page/posts/pm where ever this is happening and then right click anywhere in the browser screen on the page and choose "View Source". Now when you view the source you will see what templates are called in the code. The templates called are in green in the source view. This should help you narrow down the problem.
Also if you have a straggler "<" out there it will usually show all the time and be somewhere weird or look weird. But sometimes you do not always see it if you have a custom skin, it will disappear from time to time. This was a simple template coding error and can happen when a mod installs code into templates (if the developer does not check their code) or when you or someone else modifies the templates and makes a coding error. Basically you are looking for code that would look similar to this in the template. This is JUST an example NOT the code you need to search for:
<<a href="http://mysite.com">My Site.com</a>
Notice the double "<<" this is usually the cause of an error such as this. The correct way would be:
<a href="http://mysite.com">My Site.com</a>
See the difference? If you cannot place your URL here in this thread for help for whatever reason then you will have to actually search for this error, but as stated above if you turn on the template tags and then give us a link to your site one of us should be able to spot it and tell you where/what to edit. Otherwise its a bit hard to help with little info, kinda like trying to help in the dark when you need to see.
Login to your vB Admincp and click on "Settings>Options" on the side menu, then go to "General Settings" in the drop down and choose it. Now scroll down and find "Add Template Name in HTML Comments" tick "Yes"
Yeah, that's a good idea. I thought about that but since the OP said the page was blank, I was thinking that nothing was being output. But it could be that there's no html because of the error, but the comments are stll there. And it's easier to try that than to edit a file.
Also if you have a straggler "<" out there it will usually show all the time and be somewhere weird or look weird. ...
I don't think an html error like that would cause this error. It would have to be somethign that causes the compiled template to be invalid php code.
HM666
11-04-2014, 08:56 PM
I don't think an html error like that would cause this error. It would have to be somethign that causes the compiled template to be invalid php code.
Yeah that is true, but if he finds where that is he may find what portion or even what hack is causing his grief :)
gajinoz
11-04-2014, 09:22 PM
Thanks for the help guys, I'll play around with this and let you know what happens.
ForceHSS
11-04-2014, 11:41 PM
You need to post your site url and not pm it to me the more look at it the faster it will be fixed
gajinoz
11-04-2014, 11:53 PM
You need to post your site url and not pm it to me the more look at it the faster it will be fixed
I have sent you a PM with an update.
--------------- Added 1415166116 at 1415166116 ---------------
OK folks, finally worked it out, with some help from the guys at Dragonbyte.
I discovered that the problem went away after I disabled DBT Optimise. This is an otherwise excellent product but I had the cache templates to file system turned on. Apparently this causes problems under certain circumstances.
I turned Optimise back on and changed that setting to NO and everything seems to be working fine.
Learn something new every day!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.