I'm running Ubuntu 16.04
, PHP 7.2.29
, and Composer 1.10.5
. I'm trying to update a composer update
but when it starts to update the packages listed eventually gets to packages that have trailing commas in arrays and this starts throwing off syntax errors.
PHP Parse error: syntax error, unexpected '' => ' (T_ENCAPSED_AND_WHITESPACE) in /var/www/vendor/yiisoft/extensions.php on line 52
I've attempted to correct these errors directly in the packages (vendors directory) and this does allow me to move forward... except that the errors never stop! (Update: I know this isn't recommended, it was only done for testing purposes)
Samples (Update):
These are samples of the vendor files that are throwing off that syntax error. In all of these (and more) the last lines of the array files are pointed out as the cause. If I remove the trailing commas, the error goes on to find the next vendor file that contains trailing commas.
Sample from /vendors/yiisoft/extensions.php
'creocoder/yii2-nested-sets' =>
array (
'name' => 'creocoder/yii2-nested-sets',
'version' => '0.9.0.0',
'alias' =>
array (
'@creocoder/nestedsets' => $vendorDir . '/creocoder/yii2-nested-sets/src',
),
),
);
Sample from /vendors/composer/autoload_classmap.php
'yii\\widgets\\Pjax' => $vendorDir . '/yiisoft/yii2/widgets/Pjax.php',
'yii\\widgets\\PjaxAsset' => $vendorDir . '/yiisoft/yii2/widgets/PjaxAsset.php',
'yii\\widgets\\Spaceless' => $vendorDir . '/yiisoft/yii2/widgets/Spaceless.php',
);
Sample from /vendors/composer/autoload_namespaces.php
'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'),
'DaveChild\\TextStatistics' => array($vendorDir . '/davechild/textstatistics/src'),
'' => array($vendorDir . '/mofodojodino/profanity-filter/src'),
);
As I understand it, trailing commas are a fairly common practice that shouldn't cause any issues in PHP.
Can anybody tell me what's going on or where I could look into next?
Additional Details
I'm thinking the packages being installed shouldn't matter since this seems to be a PHP-wide error but just in case this IS for an older version of Craft CMS 3.0.34
, running on Yii 2.0.15.1
. I'm working to update out of this version but I can't because of these issues. However, the packages throwing off the errors vary... I mean... I edited files of ~6 different vendors before giving up on that silly battle.
Update
After receiving some feedback I found that running the same setup on a cloud server did not have the issue described. Indicating that somehow running this on VirtualBox/Vagrant setup was triggering it.