Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.5 available

The official documentation can be found on http://wiki.ocsinventory-ng.org. Read it before asking your question.

unexpected T_FUNCTION due to anonymous functions used in Server 2.3.1

Please be patient with me... I'm newbie in OCS and English is not my first language

I've just upgraded OCS Server from 2.0.1 to 2.3.1. All fine here!

I visit URL

Nothing is rendered

cat /etc/httpd/logs/error_log

[Mon Oct 16 19:18:00 2017] [error] [client 10.225.213.23] PHP Parse error:  syntax error, unexpected T_FUNCTION in /usr/share/ocsinventory-reports/ocsreports/require/menu/Menu.php on line 57

    /**
     * Sort the Menu
     *
     * @return number
     */
    public function sortMenu() {
        foreach ($this->getChildren() as $menu) {
            if ($menu->hasChildren()) {
                $menu->sortMenu();
            }
        }

        uasort($this->_children, function($a, $b) {            <----------   Line 57
            if ($a->getPriority() == $b->getPriority()) {
                return 0;
            }
            return ($a->getPriority() < $b->getPriority()) ? -1 : 1;
        });
    }

Well now:

Your requirements still says PHP 4.3.2 or higher but http://php.net/manual/en/functions.anonymous.php says anonymous functions become available since 5.3.0.

Obviously I MUST upgrade my PHP installation... or NOT... Am I missing something?

Thanks in advanced !!!!
asked in Administrative console by (180 points)

1 Answer

+1 vote
 
Best answer
Hi,

The way to 2.3.1 is 2.0.1 -> 2.1.x -> 2.2.x -> 2.3.1. Then you need to update php.

Regards

Frank
answered by (61.6k points)
selected by
 
Powered by Question2Answer
...