Skip to content

Undefined constant "MagentoHackathon\Composer\Magento\Deploystrategy\GLOB_BRACE" under Alpine linux #36062

Closed
@speller

Description

@speller

Preconditions and environment

  • Magento version 2.4.5

Steps to reproduce

Following official instructions to upgrade 2.4.4 to 2.4.5 https://experienceleague.adobe.com/docs/commerce-operations/upgrade-guide/implementation/perform-upgrade.html

Expected result

Upgraded successfully

Actual result

Composer fails on the composer update step:

In DeploystrategyAbstract.php line 345:

  [Error]
  Undefined constant "MagentoHackathon\Composer\Magento\Deploystrategy\GLOB_BRACE"


Exception trace:
  at /magento/vendor/magento/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:345
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->removeContentOfCategory() at /magento/vendor/magento/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:322
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->remove() at /magento/vendor/magento/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:92
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->clean() at /magento/vendor/magento/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Installer.php:611
 MagentoHackathon\Composer\Magento\Installer->update() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:552
 Composer\Installer\InstallationManager->update() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:452
 Composer\Installer\InstallationManager->Composer\Installer\{closure}() at phar:///usr/local/bin/composer/vendor/react/promise/src/FulfilledPromise.php:28
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:453
 Composer\Installer\InstallationManager->executeBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:390
 Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:282
 Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:763
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:590
 Composer\Installer->doUpdate() at phar:///usr/local/bin/composer/src/Composer/Installer.php:279
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:241
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1024
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:335
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:130
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:88
 require() at /usr/local/bin/composer:29

Additional information

The official PHP documentation https://www.php.net/manual/en/function.glob.php says:

Note: The GLOB_BRACE flag is not available on some non GNU systems, like Solaris or Alpine Linux.

Failing code: https://github.com/magento/magento-composer-installer/blame/master/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php#L345

    protected function removeContentOfCategory($sourcePath, $destPath)
    {
        $sourcePath = preg_replace('#/\*$#', '/{,.}*', $sourcePath);
        $matches = glob($sourcePath, GLOB_BRACE);
        if ($matches) {

Possible workaround is also discussed here: docker-library/php#719

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneReported on 2.4.5Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S1Affects critical data or functionality and forces users to employ a workaround.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions