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

Unsupported PHP 8 command in Magento #33680

Closed
michalrostek opened this issue Aug 4, 2021 · 42 comments · Fixed by #33886
Closed

Unsupported PHP 8 command in Magento #33680

michalrostek opened this issue Aug 4, 2021 · 42 comments · Fixed by #33886
Assignees
Labels
Area: Framework Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P0 This generally occurs in cases when the entire functionality is blocked. Progress: done Reported on 2.4.3 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

@michalrostek
Copy link

michalrostek commented Aug 4, 2021

Preconditions (*)

 

  1. Magento 2.4.3 EE
  2. PHP 7.4

Steps to reproduce (*)

  1. There is a PHP 8 (str_contains) command in \Magento\Framework\Filesystem\Directory\DenyListPathValidator:74 which is not officially supported yet ... so we have such errors during installation:

{{PHP Fatal error: Uncaught Error: Call to undefined function Magento\Framework\Filesystem\Directory\str_contains() in <...>/magento/vendor/magento/framework/Filesystem/Directory/DenyListPathValidator.php:74

This file (DenyListPathValidator) is initialized in \Magento\Framework\Filesystem\Directory\WriteFactory.php which may affect not only the above case

Expected result (*)

PHP 7 command, instead of PHP 8

Actual result (*)

PHP 8 command

@m2-assistant
Copy link

m2-assistant bot commented Aug 4, 2021

Hi @michalrostek. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

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

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

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

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ 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, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

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

@m2-community-project m2-community-project bot added this to Ready for Confirmation in Issue Confirmation and Triage Board Aug 4, 2021
@ihor-sviziev ihor-sviziev added the Severity: S1 Affects critical data or functionality and forces users to employ a workaround. label Aug 4, 2021
@sivaschenko
Copy link
Member

@michalrostek thanks for reporting this issue! While we are addressing the issue, there is a possible workaround: require symfony/polyfill-php80 package via composer to the project

@sivaschenko
Copy link
Member

The internal team is working on a fix for this, I have linked the internal Jira ticket to the GitHub issue, so the status will be updated accordingly.

@sivaschenko sivaschenko added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P0 This generally occurs in cases when the entire functionality is blocked. labels Aug 4, 2021
@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog Aug 4, 2021
@m2-community-project m2-community-project bot removed this from Ready for Confirmation in Issue Confirmation and Triage Board Aug 4, 2021
@magento-engcom-team
Copy link
Contributor

@sivaschenko Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

  • Add "Reproduced on " label(s) to this ticket based on verification result

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

@magento-engcom-team magento-engcom-team removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Aug 4, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Aug 4, 2021
@ihor-sviziev ihor-sviziev added the Reported on 2.4.3 Indicates original Magento version for the Issue report. label Aug 4, 2021
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Ready for Development in High Priority Backlog Aug 4, 2021
@leonhelmus
Copy link

leonhelmus commented Aug 4, 2021

I had the same issue and because of the error i could not update my composer.lock with a composer update. Even after requiring symfony/polyfill-php80 i still get the error. After these steps:

composer require magento/product-enterprise-edition:2.4.3 --base-magento-edition 'Commerce' --base-magento-version 2.4.2-p1 --no-update

remove vendor folder

and this one:

composer update magento/product-enterprise-edition magento/composer-dependency-version-audit-plugin sebastian/phpcpd phpstan/phpstan symfony/finder friendsofphp/php-cs-fixer allure-framework/allure-phpunit allure-framework/allure-codeception magento/magento2-functional-testing-framework --with-all-dependencies

This prevents us from updating the composer.lock file, because composer update rollsback after a incomplete composer update.

i get the following error:

Installing magento/module-inventory-catalog-search-configurable-product (1.0.0): Loading from cache
    ...Module Magento_InventoryCatalogSearchConfigurableProduct recognized as part of Magento Multi Source Inventory implementation
    ...Disabling Magento_InventoryCatalogSearchConfigurableProduct module for backward compatibility
PHP Fatal error:  Uncaught Error: Call to undefined function Magento\Framework\Filesystem\Directory\str_contains() in ~/vendor/magento/framework/Filesystem/Directory/DenyListPathValidator.php:74

System specifics:
M 2.4.2-p1 -> 2.4.3
php 7.4
mysql 8.0

@leonhelmus
Copy link

leonhelmus commented Aug 4, 2021

I took a better look and for this client we have multi source inventory disabled.

When checking the composer plugin magento/inventory-composer-installer it tries to disable all modules that have magento/module-inventory disabled, because of this it needs functionality of the magento framework which doesn't work, because str_contains does not exist for php 7.4 and this is the reason why composer.lock cannot be updated.

This is really blocking our magento upgrades.

@mrtuvn
Copy link
Contributor

mrtuvn commented Aug 4, 2021

~/vendor/magento/framework/Filesystem/Directory/DenyListPathValidator.php:74
I can't find this one in code base open source
Is this exclusive in enterprise version

@hostep
Copy link
Contributor

hostep commented Aug 4, 2021

@mrtuvn: the problematic code definitely exists in Magento OS 2.4.3, 2.4.2-p2 and 2.3.7-p1, I can see it in the pre-releases.
Since the latter two are security releases and the change discussed here is most likely fixing some security issue, those changes won't be visible here on github yet until the official release next week.

@leonhelmus
Copy link

leonhelmus commented Aug 5, 2021

@sivaschenko Do you already have a ETA? We would like to get started on M2.4.3 on monday if possible.

@mrtuvn
Copy link
Contributor

mrtuvn commented Aug 6, 2021

nice to know that you have name "adobe"

@leonhelmus
Copy link

leonhelmus commented Aug 7, 2021

It seems we now found a workaround we replaced the magento msi composer plugin and after we could update our composer.lock. So for now we can work around it 😁. So its not a huge blocker anymore! We also require polyfill80 and that also helped out! Thanks for the tip @sivaschenko !

This is the module that we replaced in our composer.json:
"magento/inventory-composer-installer"

@nathanjosiah
Copy link
Contributor

The fuck? 🤦

Apparently people inside Adobe/Magento aren't familiar with cherry-picking in git?

@hostep Just plain rude.

The code that needed this fix was security-related and therefore not public until 2.4.3 was released. There is a several month gap between when 2.4.3 private security/release branches are frozen and when the 2.4.3 security code is synced back into 2.4-develop because of how our lifecycle works.

At the time the 2.4.4 fix was delivered, the code was still private because 2.4.3 had not been delivered or synced back to 2.4-develop hence why we couldn't deliver a fix to 2.4-develop. We also couldn't deliver the fix to 2.4.3 branches because they were frozen due to our lifecycle.

Having said all that, it isn't impossible for us to port the change to 2.4-develop if we had to but it would be uncommon to go through the dev cycle twice for the same release line (2.4.4). Also, it would be much faster to process the existing PR that @ihor-sviziev mentioned, than it would be to go through the entire lifecycle internally.

@ihor-sviziev
Copy link
Contributor

Ok, since the issue still not fixed in 2.4-develop branch, I’m reopening the issue on the GitHub

@ihor-sviziev ihor-sviziev reopened this Sep 3, 2021
@m2-community-project m2-community-project bot removed 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 Progress: done labels Sep 3, 2021
@m2-community-project m2-community-project bot moved this from Done to Pull Request In Progress in High Priority Backlog Sep 3, 2021
@ihor-sviziev ihor-sviziev added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reported on 2.4.x Indicates original Magento version for the Issue report. and removed Progress: PR in progress labels Sep 3, 2021
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Ready for Development in High Priority Backlog Sep 3, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Sep 3, 2021
@ihor-sviziev ihor-sviziev added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch and removed Reported on 2.4.x Indicates original Magento version for the Issue report. labels Sep 3, 2021
@github-jira-sync-bot
Copy link

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

@github-jira-sync-bot github-jira-sync-bot removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Sep 3, 2021
@ihor-sviziev ihor-sviziev added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Sep 3, 2021
@github-jira-sync-bot
Copy link

❌ Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.magento.com/browse/AC-1098

@engcom-Alfa
Copy link
Contributor

AC-1098 has been cancelled since there was another Jira ticket had been used! So the Jira ticket is - https://jira.corp.magento.com/browse/AC-1172

@sidolov
Copy link
Contributor

sidolov commented Oct 28, 2021

Hi @michalrostek. Thank you for your report.
The issue has been fixed in #33886 by @reense in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming release.

@sidolov sidolov added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Oct 28, 2021
@sidolov sidolov closed this as completed Oct 28, 2021
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Oct 28, 2021
@m2-community-project m2-community-project bot moved this from Done to Pull Request In Progress in High Priority Backlog Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P0 This generally occurs in cases when the entire functionality is blocked. Progress: done Reported on 2.4.3 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
High Priority Backlog
  
Pull Request In Progress
Development

Successfully merging a pull request may close this issue.