Problem

When executing Cronjobs, the following error occurs:


Can't use method return value in write context in [...]


Cause

This message occurs if the Cronjob uses PHP 5.4 or older.


Most likely, the executed PHP code uses the function "empty", and this is given a function call as parameter (instead of a simple variable). However, this does not work in PHP 5.4 or older, see: http://php.net/manual/en/function.empty.php


Solution

The Cronjob must use at least PHP 5.5 for the execution.


Please note

It is possible that Cronjobs are executed with a different PHP version than the Magento shop. This cannot be checked using "phpInfo", because that only shows the version which is used by the webserver (Apache, nginx).


Check the Cronjob configuration (e.g. with the command "crontab -e" or through the Admin Panel of your hosting provider) to see which PHP Executable version is used. It is necessary to use a PHP Executable with version 5.5 or higher.


It is also possible that a fixed PHP version was set in the scripts "cron.php" or "cron.sh". This can also cause the problem. By default, no PHP version is set in those scripts.