ADAPTABLE THEME SECURE LAYOUT PROBLEM - versions 3.5.3 quiz error Exception - syntax error

ADAPTABLE THEME SECURE LAYOUT PROBLEM - versions 3.5.3 quiz error Exception - syntax error

by Tim Hillier -
Number of replies: 21

Hello there.

We have been running Moodle 3.5.3 since August with no issues.  Just before Christmas I set up a quiz and got the error Exception - syntax error, unexpected end of file, expecting ',' or ';' when I tried to test the quiz after changing one option but I dont remember which one.  I set it back to default and the error went away.  Those quizzes have been done now by 250 people with no problems.

Today I went to add another simple 10 question quiz and when I attempt to test the quiz I get the error Exception - syntax error, unexpected end of file, expecting ',' or ';'.   This happens in any course I try to add a quiz to.

I have a test site running 3.5.3 that was set up the same day on the same server.  There are no issues adding a quiz to that site.  Nothing has been touched on either site since before Christmas.

Any advice is appreciated.

Tim

(Edited by Mary Evans - Made changes to Subject title of original submission Friday, 11 January 2019, 2:40 AM)

Average of ratings: -
In reply to Tim Hillier

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Do you have anything that is 'non core' e.g. 3rd party question types or a custom theme?

In reply to Marcus Green

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Tim Hillier -

Thank you for the response Marcus.

No there is nothing added.  We have been using adaptable theme for a few years.

Tim

In reply to Tim Hillier

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Tim Hillier -

Things are getting much worse.

I turned on debugging and it killed the site entirely.  This is all I can get when going to the site now.

Notice: date_default_timezone_set(): Timezone ID '-06:00' is invalid in /home/training/public_html/moodle2/lib/classes/date.php on line 211

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/training/public_html/moodle2/lib/classes/session/file.php on line 74

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/training/public_html/moodle2/lib/classes/session/file.php on line 75

Warning: session_name(): Cannot change session name when headers already sent in /home/training/public_html/moodle2/lib/classes/session/manager.php on line 262

Warning: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent in /home/training/public_html/moodle2/lib/classes/session/manager.php on line 263

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/training/public_html/moodle2/lib/classes/session/manager.php on line 264

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/training/public_html/moodle2/lib/classes/session/manager.php on line 265

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/training/public_html/moodle2/lib/classes/session/manager.php on line 267

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/training/public_html/moodle2/lib/classes/session/manager.php on line 268

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/training/public_html/moodle2/lib/classes/session/manager.php on line 271

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/training/public_html/moodle2/lib/classes/session/manager.php on line 272

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/training/public_html/moodle2/lib/classes/session/manager.php on line 273

Warning: session_start(): Cannot start session when headers already sent in /home/training/public_html/moodle2/lib/classes/session/handler.php on line 42

error/An error occurred whilst communicating with the server

In reply to Tim Hillier

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

The adaptable Theme is well established and reliable and is very unlikely to be the cause of this issue. However just test with a core theme to eliminate that. If you have easy access to the config.php you can do this by adding something very much like.

$CFG->theme='clean';

Also do you have control over your hosting, e.g. can you restart your apache server. Are you able to confirm that you have not run out of disk space e.g. if it is U/Linux

run the df -h commant and post the result here.


In reply to Marcus Green

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Tim Hillier -

Marcus;

My IT person was able to get us back to where I was earlier today so at least the site is functioning for anything previous to today.  Still unable to add a quiz or the same error comes up.

When he had it back, I took the opportunity to set up a staging site and upgrade to 3.6.1.  He had to upgrade the php I think for that to happen.  Anyway that is a lot of change and weirdly the same thing was still going on after the upgrade.

I took your advice and changed out Adaptable for Clean and tested and was able to get a quiz to work.  Very strange as we have been using Adaptable for at least 3 years I believe and it was always solid.

Not out of space from what I can see.

Sorry I dont know how to run a df -h command but I will ask our it guy to do it monday.

thank you again for taking the time to help.

Tim

In reply to Tim Hillier

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Does anyone think this thread should be moved to general help?... Tim, have you read this

https://moodle.org/mod/forum/discuss.php?d=356184

So... keep asking questions and posting information, other people will be reading this thread and they may spot something in your information. Go to /admin/plugins.php, click on additional plugins and post that list of plugins here (or perhaps a a screen shot), so we can see the version number. The version is a long date, i.e. today would be 2018011200

Some things that might be involved fairly much at random

If things got better when you switched theme have you got the latest version of the adaptable theme. Some code being copied to the wrong folder

A rogue plugin, unlikely as it would probably have shown up when you turned debugging to developer (you did set it to developer?). 

A change in the version of PHP (unlikely)

A change in file permissions

Intergalactic bit rot (OK I ran out of inspiration as it is 7.21 on Saturday morning). But as I say, keep posting information and we may be able to get to the cause, (or at least make the problem go away)

In reply to Marcus Green

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Tim Hillier -

Here is the additional plugins page.

Not sure about developer debugging.  I searched for debugging and turned it on and then everything quit and I could not get back until my IT person did some kind of magic.

thanks again.

In reply to Tim Hillier

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Tim Hillier -

Image did not attach.  Trying again.

plugins list

In reply to Tim Hillier

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Those all look quite standard plugins with recent version numbers so It looks like it is not plugin code.

In reply to Marcus Green

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by aymn mhiri -

thank you very much for thats tutorial

In reply to Tim Hillier

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Thanh Vu Van -

I had exactly the same problem as you described above. Please inform if you find any solution. Thanks!

In reply to Thanh Vu Van

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Thanh Vu Van -

I decided to debug for this error for an hour. I open debug mod (Site Administration -> Development -> Debugging).

In Debug Message choice DEVELOPER: extra Moodle debug message for developers. Also checked on Display Debug Message. Save then Purge all caches.

Try to attempt the quiz question, the browser output as the picture below.syntax error in quiz plugin from adaptable theme, Moodle 3.5.3

I try to open secure.php in layout folder, scroll to the end of this file at line 63 you will discover the reason why!

<?php echo $OUTPUT->standard_end_of_body_html()

Just add a semicolon at the end of this function and a closing php tag. Save and enjoy the result!

In reply to Thanh Vu Van

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I am going to move this over the theme forum - it would be more beneficial there!

In reply to Thanh Vu Van

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Tim Hillier -

That worked for us as well.

Thank you so much for your help.

I would like to know what I did to cause this but happy it is back anyway.

Tim

In reply to Tim Hillier

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Terry Julien -

Hi Tim,

I have just had your experience. A new quiz that I added this morning gives an error when students try to access. 

'Exception - syntax error, unexpected end of file, expecting '.' or ';'. 

The setting I changed to get the quiz working was. 'use a secure popup window for attempts' change to none.

Cheers

Terry



In reply to Terry Julien

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Terry,

Have you looked at the other theme files to see if they need the same fix?

G

In reply to Gareth J Barnard

Re: Moodle in English: Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Terry Julien -
Hi Gareth,



No, I Think it's only an issue with the adaptable theam.



Regards

Terry





On Fri, 8 Mar. 2019, 4:46 am Gareth J Barnard (via Moodle.org), <
In reply to Gareth J Barnard

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Gareth, there is a BIG problem with Adaptable if you compare https://github.com/moodle/moodle/blob/MOODLE_35_STABLE/theme/clean/layout/secure.php with

https://bitbucket.org/covuni/moodle-theme_adaptable/src/06072d90bf2401b45a629b54472c2dba1b27fa3c/layout/secure.php?at=master&fileviewer=file-view-default.

Having been involved at the start when the 'secure.php' file was first added into Moodle Themes such as Bootstrapbase some time ago, the need for a defined SECURE page was mainly for those who used a specific option within QUIZ.

The fact that Adaptable has left off some CODE in the secure.php layout could be, in effect, a SECURITY issue and should be reported.

Just my take on things here.

Mary

In reply to Terry Julien

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Fernando Acedo -
Picture of Plugin developers Picture of Testers

This is an old issue that was fixed several months ago.

Just upgrade Adaptable to latest version available.

And no, this is not a serious issue with secure.php just a bug. In fact Adaptable, due its complexity, improved the Quiz page not only secure.php also when using a normal Quiz. Now is totally secure even if you don't use SEB.

In reply to Fernando Acedo

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Which version is that please Fernando?  So that when users say they have the latest version it is actually your latest version and not the latest version they think they have but don't.  That's the problem with the word 'latest' it is up to interpretation and can have different values at the same time depending on your information.  Better to state version x.y.z and above and save a whole lot of time and effort! smile

In reply to Gareth J Barnard

Re: versions 3.5.3 quiz error Exception - syntax error, unexpected end of file, expecting ',' or ';'

by Fernando Acedo -
Picture of Plugin developers Picture of Testers

You are right Gareth. I have done the same mistake that we ask others not to do.

This bug was fixed in Version 1.8.0 (2019011700) as can be seen in https://moodle.org/plugins/pluginversion.php?id=18756

But latest available for moodle 3.5 and 3.6 is 1.8.0.1, available also in the MPD