Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 5 tasks
speller opened this issue Aug 31, 2022 · 17 comments
Closed
1 of 5 tasks
Labels
Area: Framework Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.5 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround.

Comments

@speller
Copy link

speller commented Aug 31, 2022

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”.
@m2-assistant
Copy link

m2-assistant bot commented Aug 31, 2022

Hi @speller. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@maddumarala
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @maddumarala. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@hostep
Copy link
Contributor

hostep commented Aug 31, 2022

@navarr
Copy link
Member

navarr commented Aug 31, 2022

I would recommend this be increased to S1 as the ability to run composer commands is likely "critical functionality"

@ihor-sviziev ihor-sviziev added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Aug 31, 2022
@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog Aug 31, 2022
@m2-community-project m2-community-project bot removed this from Ready for Confirmation in Issue Confirmation and Triage Board Aug 31, 2022
@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Aug 31, 2022

@xmav @sidolov @sdzhepa @andrewbess I think it should have p1 priority since that’s the only issue on alpine Linux, and the fix is pretty simple. We even have a pull request with needed changes
magento/magento-composer-installer#35 magento/magento-composer-installer#37 (the same changes for different branches)

At the same time, Magento Framework already using Laminas\Stdlib\Glob in all places, so it's not even adding a new dependency

use Laminas\Stdlib\Glob as LaminasGlob;
use Laminas\Stdlib\Exception\RuntimeException as LaminasRuntimeException;
/**
* Wrapper for Laminas\Stdlib\Glob
*/
class Glob extends LaminasGlob

https://github.com/magento/magento2/search?q=GLOB_BRACE

@m2-assistant
Copy link

m2-assistant bot commented Sep 2, 2022

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Sep 2, 2022
@engcom-November
Copy link
Contributor

engcom-November commented Sep 2, 2022

Verified the issue by upgrading from 2.4.4 to 2.4.5 Project-community-edition as per the upgrade guide and the issue is not reproducible on Mac OS. We are verifying the issue on the mentioned environment: Alpine Linux. WIP.
Thank you.

@engcom-November engcom-November removed their assignment Sep 5, 2022
@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in High Priority Backlog Sep 5, 2022
@ihor-sviziev ihor-sviziev added the Severity: S1 Affects critical data or functionality and forces users to employ a workaround. label Sep 9, 2022
@ihor-sviziev
Copy link
Contributor

@engcom-November any updates?

@sdzhepa
Copy link
Contributor

sdzhepa commented Sep 12, 2022

@engcom-November and @engcom-Hotel

Could you please process this issue?

@engcom-Hotel engcom-Hotel self-assigned this Sep 13, 2022
@m2-assistant
Copy link

m2-assistant bot commented Sep 13, 2022

Hi @engcom-Hotel. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Sep 13, 2022
@engcom-Hotel
Copy link
Contributor

Hello @speller,

Thanks for the report and collaboration!

We have tried to reproduce the issue with the docker image of Alpine Linux. We have pulled the image from its official link as below:

https://hub.docker.com/_/alpine

We have tried to reproduce the issue with a simple PHP script with the use of the GLOB_BRACE constant use and we are able to get the actual result as you mentioned in the main description. Please refer to the below screenshot for reference:

image

As in the Magento, we are using this constant in file DeploystrategyAbstract.php line number 345 without any checks, we are confirming the issue.

Thanks

@engcom-Hotel engcom-Hotel added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Framework Reported on 2.4.5 Indicates original Magento version for the Issue report. labels Sep 13, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-6671 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Sep 13, 2022

✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@BernardRobbins-BMediaLLC

I had a dev run into this too. They ran bin/magento sampledata:remove.

Undefined constant "MagentoHackathon\Composer\Magento\Deploystrategy\GLOB_BRACE"

They're on Den which is using
Alpine 3.16.2
PHP 8.1.11
M2.4.5-p1

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Nov 4, 2022
@github-jira-sync-bot github-jira-sync-bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: dev in progress labels Nov 14, 2022
@m2-community-project m2-community-project bot moved this from Dev In Progress to Done in High Priority Backlog Dec 1, 2022
@m2-community-project m2-community-project bot removed the Progress: PR Created Indicates that Pull Request has been created to fix issue label Dec 1, 2022
@engcom-Hotel
Copy link
Contributor

Hello,

As I can see this issue got fixed in the scope of the internal Jira ticket AC-6671 by the internal team
Related commits: magento/magento-composer-installer@255b3f6

Based on the Jira ticket, the target version is 2.4.6.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.5 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
Development

No branches or pull requests

10 participants