Cron job Php error in EventManager.php

Actual behaviour

Cron job error (every 10 minutes):
PHP Parse error: syntax error, unexpected ‘?’, expecting variable (T_VARIABLE) in /var/www/owncloud/lib/composer/doctrine/event-manager/lib/Doctrine/Common/EventManager.php on line 32

The line 32 is:
public function dispatchEvent($eventName, ?EventArgs $eventArgs = null)

I’m not sure what is wrong with the line, since nullable types are supported from php 7.1 and I’m using php ver 7.3

Server configuration

Operating system: Debian GNU/Linux 9 (stretch)

Web server: Apache/2.4.25

Database: 10.1.45-MariaDB-0+deb9u1

PHP version: PHP 7.3.20

ownCloud version: 10.4.1 (stable)

Updated from an older ownCloud or fresh install: updated

Where did you install ownCloud from: https://download.owncloud.org/download/repositories/stable/Debian_9.0

Signing status (ownCloud 9.0 and above): No errors have been found.

The content of config/config.php: https://gist.github.com/InanZen/ab60446b17446a84df79875f18fd8e04

List of activated apps:

  • comments: 0.3.0
  • configreport: 0.2.0
  • dav: 0.5.0
  • federatedfilesharing: 0.5.0
  • federation: 0.1.0
  • files: 1.5.2
  • files_external: 0.7.1
  • files_mediaviewer: 1.0.2
  • files_sharing: 0.12.0
  • files_trashbin: 0.9.1
  • files_versions: 1.3.0
  • firstrunwizard: 1.2.0
  • gallery: 16.1.1
  • market: 0.5.0
  • notifications: 0.5.0
  • provisioning_api: 0.5.0
  • systemtags: 0.3.0
  • updatenotification: 0.2.

Hey,

i think if this is happening then the cron job is using a different and older version of PHP.

You are absolutely correct, thank you!

I’ve edited the cron job (crontab -u www-data -e) and changed the php path to /usr/bin/php (it was still using /usr/bin/php7.0).

1 Like