Just copied some code from a PHP 7.3+ development environment to the server running PHP 7.2

On the server I am getting this

On PHP 7.3 it runs fine

Because the line number is not listed this is how I find the problem

  1. Find which controller is being called when you see the error
  2. Run php -l on the PHP 7.2 against the app/Controller/PalletController.php file
  3. Systematically go through the files. From Controller to Model to View
php -l CartonsController.php
No syntax errors detected in CartonsController.php
php -l edit_pallet_cartons.ctp
No syntax errors detected in edit_pallet_cartons.ctp
php -l ../../Model/Carton.php
PHP Parse error:  syntax error, unexpected ')' in ../../Model/Carton.php on line 85
Errors parsing ../../Model/Carton.php

Once you see the error open the file and find the line. Here the error is a trailing comma in the function call which is supported by 7.3 but not 7.2

ref: https://laravel-news.com/php-trailing-commas-functions

# speed up the checking in a directory
cd app/Controller
for i in `ls *.php` ; do php -l $i ; done

No syntax errors detected in AppController.php
No syntax errors detected in CartonsController.php
No syntax errors detected in HelpController.php
No syntax errors detected in InventoryStatusesController.php
No syntax errors detected in ItemsController.php
No syntax errors detected in LocationsController.php
No syntax errors detected in MenusController.php
No syntax errors detected in PackSizesController.php
No syntax errors detected in PagesController.php
No syntax errors detected in PalletsController.php
No syntax errors detected in PrintersController.php
No syntax errors detected in PrintLabelsController.php
PHP Parse error:  syntax error, unexpected ')' in PrintTemplatesController.php on line 197
Errors parsing PrintTemplatesController.php
No syntax errors detected in ProductionLinesController.php
No syntax errors detected in ProductTypesController.php
No syntax errors detected in SettingsController.php
No syntax errors detected in ShiftsController.php
No syntax errors detected in ShipmentsController.php
No syntax errors detected in TestsController.php
No syntax errors detected in UsersController.php