Unexpected 'public' on saving a score (post Joomla 3.8)

More
6 years 6 months ago #39871 by Hayward
As of Joomla 3.8, when I click save a score via Memorizr after completing a game, it gives this error:

syntax error, unexpected 'public' (T_PUBLIC)

Please Log in or Create an account to join the conversation.

More
6 years 6 months ago #39872 by nordmograph
hello Hayward,

I cannot reproduce this issue on my demo setup with Joomla 3.8. Can you please enable error reporting so we can have more details about the error. Let me know your findings.

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.

Please Log in or Create an account to join the conversation.

More
6 years 6 months ago - 6 years 6 months ago #39877 by Hayward
There's nothing in the nginx error log, but if I open controllers/game.php in VS Code, the linter is saying there is a syntax error on lines 352 and 360,
Code:
public function edit()

which is giving the unexpected 'public' (T_PUBLIC) error

EDIT: Adding an extra closing } after line 352 fixed the error. Not sure if I somehow borked that or if the stock game.php had the error too.

EDIT EDIT: Don't do what I did, instead redownload or see below post
Last edit: 6 years 6 months ago by Hayward.
The following user(s) said Thank You: nordmograph

Please Log in or Create an account to join the conversation.

More
6 years 6 months ago #39878 by nordmograph
There was indeed a missing } before the Edit function in latest build but the extra closing }shouldn't be added right after line 352 or the component won't redirect after a score submission.
Redownload the fixed component or make sure the end of the answer() function
goes like
Code:
else { if(!$user->id){ $msg = sprintf(JText::_('COM_MEMORIZR_AGUESTALLREADYGOTABETTERSCORE'), $mybest->totalscore); } else{ $msg = sprintf(JText::_('COM_MEMORIZR_YOUALLREADYGOTABETTERSCORE') , $mybest->totalscore); } $app->enqueueMessage( $msg ,'message'); } } $this->setRedirect( JRoute::_('index.php?option=com_memorizr&view=leaderboard&id='.$game_id , false ) ); }

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.
The following user(s) said Thank You: Hayward

Please Log in or Create an account to join the conversation.

Time to create page: 0.328 seconds
Powered by Kunena Forum
Disclaimer: Nordmograph is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.