Page MenuHomePhabricator

Can't sync vendor
Open, Needs TriagePublic

Description

reedy@deploy1002:/srv/mediawiki-staging$ scap sync-dir php-1.38.0-wmf.21/vendor Downgrading symfony/console \(v5.4.3 => v5.4.2\) T301320
13:17:59 Checking for new runtime errors locally
php lint failed:
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting variable (T_VARIABLE) in /srv/mediawiki-staging/php-1.38.0-wmf.21/vendor/symfony/console/Attribute/AsCommand.php on line 21
Errors parsing /srv/mediawiki-staging/php-1.38.0-wmf.21/vendor/symfony/console/Attribute/AsCommand.php

Due to the ways various vendor libraries do stuff, symfony/console has code that isn't valid on PHP 7.2 (but isn't executed and not valid until PHP 8.0), so we can't scap sync-dir it..

$ php -v
PHP 7.4.27 (cli) (built: Dec 20 2021 21:28:51) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.27, Copyright (c), by Zend Technologies
$ php -l symfony/console/Attribute/AsCommand.php
PHP Parse error:  syntax error, unexpected 'public' (T_PUBLIC), expecting variable (T_VARIABLE) in symfony/console/Attribute/AsCommand.php on line 21
Errors parsing symfony/console/Attribute/AsCommand.php
$ php8.0 -l symfony/console/Attribute/AsCommand.php
No syntax errors detected in symfony/console/Attribute/AsCommand.php

Obviously Scap has synced this out many many times (as part of bigger deploys), but it makes it harder to do smaller ones such as what is required to fix T301320: shell.php commands broken.

We can get around this using scap sync-world, but should we need to do that?

Related Objects

Event Timeline

symfony has a tendency of doing this, they're not a fan of our "lint everything" strategy despite it stopping potential production issues. In the past we just deleted the offending file from vendor/ and added it to .gitignore until we got to a high enough PHP version that it wasn't an issue.