Upgrade to latest 3.4.2+ from 3.4.1

Upgrade to latest 3.4.2+ from 3.4.1

by Jan Combrink -
Number of replies: 7

I am trying to upgrade from a 3.4.1 to 3.4.2+ moodle version.  It is a working installation.  I have now tried twice to do the upgrade, with a roll-back to the older version in-between.  The older version works, but when I try to run the new instance, it gives the following message:

This page isn’t working

eptdev.eptglobal.co.za is currently unable to handle this request.

HTTP ERROR 500

I have asked the hosting company to check the log files (Ido not have root access) and they reported as follows:


Hi,

Upon checking I could see the following error message in the logs:

====
[28-Apr-2018 11:08:59 UTC] PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/eptgldwj/public_html/eptdev/lib/classes/component.php on line 1266
[28-Apr-2018 11:09:00 UTC] PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/eptgldwj/public_html/eptdev/lib/classes/component.php on line 1266
[28-Apr-2018 11:10:18 UTC] PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/eptgldwj/public_html/eptdev/lib/classes/component.php on line 1266
[28-Apr-2018 11:13:13 UTC] PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/eptgldwj/public_html/eptdev/lib/classes/component.php on line 1266
====

Please consult you developer and check for the issue. In case of any further requirements do let me know.

Also, I could see some cgi errors. Hence I have tweaked the values to prevent the same.

Warm Regards,
Ashmita G

Afrihost.com

The line 1264 - 74 :  

* @return array an associative array of components and their corresponding paths.

     */

    public static function get_component_list() : array {

        $components = [];

        // Get all plugins.

        foreach (self::get_plugin_types() as $plugintype => $typedir) {

            $components[$plugintype] = [];

            foreach (self::get_plugin_list($plugintype) as $pluginname => $plugindir) {

                $components[$plugintype][$plugintype . '_' . $pluginname] = $plugindir;

            }

        }

It seems to be a mod issue,  I have checked that the mods are all the same, old and new.


Would anyone be able to assist, please.  

Jan







Average of ratings: Useful (2)
In reply to Jan Combrink

Re: Upgrade to latest 3.4.2+ from 3.4.1

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It's the colon before the 'array' in the function declaration. Almost certainly, you don't have PHP 7.x. Which begs the question, how did you run 3.4.1?


The colon syntax in functions was new in PHP 7. Earlier versions will flag it as an error.

Average of ratings: Useful (2)
In reply to Howard Miller

Re: Upgrade to latest 3.4.2+ from 3.4.1

by Jan Combrink -

Thank you, Howard.  You were spot-on.


The reason why the "old version" ran was because of inherited and variable PHP settings, and the way we do moodle upgrades,  ie that we rename the old version, create a new url with the old name and install.  Will definitely remember next time!


Maybe a warning, in the beginning, might save some time - if that is possible.


Thanks again, took all of 5 minutes to solve a 12 hour problem.


Jan

Average of ratings: Useful (1)
In reply to Jan Combrink

Re: Upgrade to latest 3.4.2+ from 3.4.1

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I'm a bit sceptical. Moodle should refuse to upgrade if the version of PHP (or any other dependency) is not suitable.

However, yes, always check the release notes wink

Average of ratings: Useful (1)
In reply to Jan Combrink

Re: Upgrade to latest 3.4.2+ from 3.4.1

by Dan Salahi -

Hi Jan. I have got the same issue on my project. How shall I solve it? Would you please explain that? 

In reply to Dan Salahi

Re: Upgrade to latest 3.4.2+ from 3.4.1

by Nicholas Fahey -

Found this error on my shared hosted server as well while trying to run cron. The site works fine otherwise. Running 3.5. Cron won't work because of it.

In reply to Howard Miller

Re: Upgrade to latest 3.4.2+ from 3.4.1

by Andy Hoang -

Thanks Howard - I also had the same issue and an upgrade to PHP 7 solved this instantly. 

In reply to Jan Combrink

Re: Upgrade to latest 3.4.2+ from 3.4.1

by Zakir Hossain -

i have same problem on xamp 5.6

Parse error: syntax error, unexpected ':', expecting ';' or '{' in /opt/lampp/htdocs/moodle/lib/classes/component.php on line 1266


I just download xamp 7.0. It working fine.