Slim application error when exporting users from Statistics [OJS]

Working on OJS if we try to export users from Statistics → Users we get a Slim Application Error page with this corresponding error in the server logs:

[Tue May 11 10:50:10.132054 2021] [php7:notice] [pid 7023] [client] Slim Application Error:\nType: ParseError\nMessage: syntax error, unexpected '...' (T_ELLIPSIS), expecting ']'\nFile: /var/www/html/ojs3/lib/pkp/classes/user/\nLine: 67\nTrace: #0 /var/www/html/ojs3/lib/pkp/classes/core/

Hi @hilongo,

It seems this is related to the the ellipsis […] token not being properly parsed in before being sent along to the Slim application. This should be adding additional items to the array.

In order to try and pin down exactly what’s happening, could you provide some additional information about your installation?

  • What version of PHP are you currently using and have you changed it recently?
  • Could you provide the contents of lines 56-71 of /var/www/html/ojs3/lib/pkp/classes/user/
  • Are you trying to generate the reports from within OJS or by making an API call directly?


PKP Team

Hi @ewhanson !

Thanks for the reply. We’ve recently migrated our installation to a new server and upgraded it from version. So PHP went from 7.2.24 to 7.3.27 (the old server had an Ubuntu 18.04 and the new one has a Debian 10)

The report is being generated from within OJS

as for the lines from

* Retrieves the report headings
* @return string[]
private function _getHeadings() : array {
return [
…array_map(function($userGroup) {
return $userGroup->getLocalizedName();
}, $this->_getUserGroups())

Thanks in advance

Hi @hilongo,

Thanks for providing the additional information.

It looks like this is a PHP version issue. Using ... as the spread operator in arrays was only added in PHP 7.4 (see original RFC). Upgrading to PHP 7.4 would solve this issue. If this is an option for you, I would recommend upgrading PHP over editing the source code directly, as making changes to the source code will likely create problems upgrading in the future.

PKP Team

1 Like

Hi @ewhanson ,

Thanks for the info. I did a quick install of OJS on a test server with PHP 7.4 and the export seems to work there.

We will evaluate the possibility of upgrading the PHP version on our production server.

Best regards!