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

Blank install of Magento 2.4.1 via composer breaks on setup:install command. #30575

Closed
msyhr opened this issue Oct 20, 2020 · 74 comments · Fixed by magento/devdocs#8185
Closed
Assignees
Labels
Component: Framework/Code Component: Framework/ObjectManager Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Progress: done Reported on 2.4.1 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

@msyhr
Copy link

msyhr commented Oct 20, 2020

Preconditions (*)

  1. PHP - 7.4.9
  2. Apache 2.4

Steps to reproduce (*)

  1. Run Composer Command
    composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento2
  2. Attempt to run command-line installation.
    php bin/magento setup:install --base-url=http://241.loc/ --db-host=mysql --db-name=241 --db-user=root --db-password= --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=elastic --elasticsearch-port=9200

Expected result (*)

  1. Magento Installs

Actual result (*)

  1. Fatal Error
    Fatal error: Declaration of Psr\Log\LoggerInterface\Proxy::emergency($message, array $context) must be compatible with Psr\Log\LoggerInterface::emergency($message, array $context = NULL) in /shared/httpd/24/htdocs/magento2/generated/code/Psr/Log/LoggerInterface/Proxy.php on line 93
    The proxy generated has functions like below:

public function alert($message, array $context)

However, if you change them directly to:

public function alert($message, array $context = array())


The command will then run successfully, however it will break all bin/magento setup:xxx commands the next time the code is regenerated.

@m2-assistant
Copy link

m2-assistant bot commented Oct 20, 2020

Hi @msyhr. 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

@ghost ghost added this to Ready for Confirmation in Issue Confirmation and Triage Board Oct 20, 2020
@msyhr
Copy link
Author

msyhr commented Oct 20, 2020

As a side note, repeating this above process in the identical environment, but specifying:

composer create-project --repository=https://repo.magento.com/ magento/project-community-edition=2.4.0 magento2
successfully install the software. Then updating the composer.json entry to

"magento/product-community-edition": "2.4.1"

will cause the same issue.

@qsolutions-pl
Copy link
Contributor

experiencing the same issue

@ihor-sviziev ihor-sviziev added the Severity: S1 Affects critical data or functionality and forces users to employ a workaround. label Oct 22, 2020
@sdzhepa sdzhepa self-assigned this Oct 22, 2020
@m2-assistant
Copy link

m2-assistant bot commented Oct 22, 2020

Hi @sdzhepa. 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.

@sdzhepa
Copy link
Contributor

sdzhepa commented Oct 22, 2020

Hello @msyhr qsolutions-pl
@ihor-sviziev @lbajsarowicz

Thank you for collaboration!

After multiple attempts on different envs and sked different people to check it on their envs

We are not able to reproduce this issue by the provided steps.

At this point, I suppose some important steps/configuration/etc. information is missed in the description.
As possible advice, I would propose to clean composer caches

composer clearcache

Tested on next envs configurations:

  • Apache(2.4.18) | Nginix(1.15.12) |Nginix(1.17.10)
  • PHP 7.4.7 | PHP 7.4.5
  • elastic: 7.7
  • SQL mariadb 10.4 | mariadb 10.3.14 | mysql 14.14(Distr 5.7.31)
  • composer 1.10.6 | 1.9.1
  • w/o | redis 5.0

Tested using the next steps

  1. Get Magento using composer
  • composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento2
  • composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.1 magento2_2
  1. Install magento using CLI script from the description
  • also checked with "--backend-frontname"(missed in description) and with several other additional parameters

Result: Magento sucessfuly installed. No Fatal errors. Sorefront is available

@sdzhepa sdzhepa added Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: needs update Additional information is require, waiting for response labels Oct 22, 2020
@sdzhepa sdzhepa removed their assignment Oct 22, 2020
@ghost ghost moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Oct 22, 2020
@ghost ghost removed Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: ready for confirmation labels Oct 22, 2020
@sdzhepa sdzhepa added the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Oct 22, 2020
@msyhr msyhr closed this as completed Oct 22, 2020
@ghost ghost removed Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: needs update Additional information is require, waiting for response labels Oct 22, 2020
@ghost ghost removed this from Needs Update in Issue Confirmation and Triage Board Oct 22, 2020
@Knase
Copy link
Contributor

Knase commented Oct 26, 2020

Hi @sdzhepa, I have the same bug with PHP 7.4.11. But if I use PHP 7.3 , The class Proxy created correctly.
bin/magento setup:di:compile
PHP Fatal error: Declaration of Psr\Log\LoggerInterface\Proxy::emergency($message, array $context) must be compatible with Psr\Log\LoggerInterface::emergency($message, array $context = NULL) in m2/generated/code/Psr/Log/LoggerInterface/Proxy.php on line 93
/usr/bin/php7.3 bin/magento setup:di:compile - This works without the bugs.

@ihor-sviziev
Copy link
Contributor

Hi @Knase,
Question 1: there might be incorrect php version used. what is php -v shows for you with php 7.4?
Question 2: are you using some extensions that adds plug-in to the logger? If so - could you provide some sample module in order to be able to reproduce the issue?

@Knase
Copy link
Contributor

Knase commented Oct 26, 2020

I am using php 7.4.11
php -v
PHP 7.4.11 (cli) (built: Oct 18 2020 19:39:42) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans
I installed magento 2.4.1
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.1 m2
bin/magento setup:install \ --base-url=http://magento.ll \ --backend-frontname=admin \ --db-host=localhost \ --db-name=magento \ --db-user=magento \ --db-password=magento \ --admin-firstname=admin \ --admin-lastname=admin \ --admin-email=admin@admin.com \ --admin-user=magento \ --admin-password=magento \ --language=en_US \ --currency=USD \ --timezone=America/Chicago \ --search-engine=elasticsearch7 \ --elasticsearch-host=localhost \ --elasticsearch-port=9200 \ --use-rewrites=1;
I got the fatal error during bin/magento setup:install. I fixed the file generated/code/Psr/Log/LoggerInterface/Proxy.php. But if I run the command bin/magento setup:di:compile or remove the file generated/code/Psr/Log/LoggerInterface/Proxy.php, Magento 2 will create this file with errors.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Oct 26, 2020

@Knase could you provide your composer.lock file?
Probably with exact the same package versions we'll be able to reproduce this issue

@Knase
Copy link
Contributor

Knase commented Oct 26, 2020

@ihor-sviziev
There is my the composer.lock file
composer.lock.txt

@zenfork
Copy link

zenfork commented Oct 28, 2020

I have same issue on after upgrading Magento Cloud 2.3.6 to 2.4.1 version with PHP 7.3.23.
This error happens on setup:upgrade and any other commands of bin/magento

$ php -v
PHP 7.3.23 (cli) (built: Oct 13 2020 10:38:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.23, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.23, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans
    with blackfire v1.42.0~linux-x64-non_zts73, https://blackfire.io, by Blackfire

UPD:
After downgrade Magento to 2.4.0 this error didn't show anymore.
I'm using Docker LAMP stack "Devilbox"

@msyhr msyhr reopened this Oct 28, 2020
@ghost ghost added this to Ready for Confirmation in Issue Confirmation and Triage Board Oct 28, 2020
@msyhr
Copy link
Author

msyhr commented Oct 28, 2020

Re-opening since other people seem to be running into this issue now.

Some Information from me about my setup:

I'm using https://github.com/cytopia/devilbox for local development

OS 20.04.1 LTS (Focal Fossa)
Docker version 19.03.13, build 4484c46d9d

PHP
APACHE
MYSQL

`devilbox@php-7.4.9 in /shared/httpd/magento2/htdocs $ php -v
PHP 7.4.9 (cli) (built: Aug 6 2020 19:20:05) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.9, Copyright (c), by Zend Technologies

Virtual Host Below:

magento2.txt
`
Composer Lock Below:
composer.lock.txt

Still fails every time for me. Using a version in the composer command (2.4.0) works flawlessly. Upgrade will create the issue, create-project with no version will create the issue.

@m2-community-project m2-community-project bot removed the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Nov 5, 2020
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @ihor-sviziev
Thank you for verifying the issue. Based on the provided information internal tickets MC-38918 were created

Issue Available: @ihor-sviziev, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@m2-community-project m2-community-project bot removed the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Nov 5, 2020
@ihor-sviziev
Copy link
Contributor

I created PR for updating docs in order to highlight that psr php extension might cause such issues.
magento/devdocs#8185

@ihor-sviziev ihor-sviziev self-assigned this Nov 5, 2020
@m2-assistant
Copy link

m2-assistant bot commented Nov 5, 2020

Hi @ihor-sviziev. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

    1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. 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!
    1. If the issue is not relevant or is not reproducible any more, feel free to close it.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Nov 5, 2020

Ok... we got responce from the author of psr extension, seems like PHP 7 API isn't supporting default values, so it can't be fixed for php 7.3 and php 7.4, but could be fixed for php 8.0, and it will be done in jbboehr/php-psr#79.

So currently we have three options:

  1. ✔ Add docs for not using psr php extension with Magento 2 to the docs - I already did in Add warning about using psr php extension devdocs#8185, hope someone will review it soon
  2. ❔ [not sure] Add conflict with ext-psr to the composer.json file, as suggested in Blank install of Magento 2.4.1 via composer breaks on setup:install command. #30575 (comment)
  3. ❔ [not sure] Add compatibility with psr extension in the magento2

For now I think adding just a warning to the docs should be enough, I still thinking about implementation of 2nd or maybe 3rd option.

@msyhr
Copy link
Author

msyhr commented Nov 5, 2020

@zenfork and any others using Devilbox running into this issue, I can confirm disabling the psr extension solves the issue.

You'll need to edit the entry to add "psr" in the .env of your devilbox root.

PHP_MODULES_DISABLE=oci8,PDO_OCI,pdo_sqlsrv,sqlsrv,rdkafka,swoole,psr,phalcon

@pusachev
Copy link
Contributor

pusachev commented Nov 6, 2020

Hey. I have a question. Why we need create proxy for LoggerInterface object? What this profit we have from this "optimization"?

Maybe make sense remove proxy from DI class and this is fix problem in install.

@ihor-sviziev
Copy link
Contributor

@pusachev TBH I don't really know. Feel free to investigate it 😃

@dobooth dobooth closed this as completed Nov 10, 2020
@m2-community-project m2-community-project bot removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Nov 10, 2020
@sdzhepa sdzhepa added the Reported on 2.4.1 Indicates original Magento version for the Issue report. label Nov 11, 2020
@qsolutions-pl
Copy link
Contributor

This issue is also related to an upgrade:
2.3.4 -> 2.4.0
2.3.5 -> 2.4.0
2.3.6 -> 2.4.0
and the same with upgrade to 2.4.1

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Nov 26, 2020

@qsolutions-pl FYI we added info that psr extension causing issue to the docs in magento/devdocs#8185:
https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html

@jissereitsma
Copy link
Contributor

jissereitsma commented Dec 5, 2020

@pusachev @ihor-sviziev I bumped into this same issue and was able to solve it by removing the PSR extension (Ubuntu with PHP 7.3: apt-get remove php7.3-psr).

However, the question of @pusachev intrigued me: Why is the proxy needed in the first place?

I tried it and this gave the error Circular dependency: Magento\Framework\Logger\Monolog depends on Magento\Framework\Interception\PluginListGenerator. In other words, the reason why a DI proxy is needed is to fix the circular dependency at constructor time, while at the moment a method of PluginListGenerator is called where logging is needed, this issue is fixed already. So, there is no (easy) way to remove the proxy itself.

@ihor-sviziev
Copy link
Contributor

@jissereitsma I believe the only one valid fix will be introducing some not dynamically created logger proxy with the same logic inside

@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Feb 15, 2021
@magento-engcom-team
Copy link
Contributor

Hi @msyhr, @ihor-sviziev, @engcom-Delta.

Thank you for your report and collaboration!

The related internal Jira ticket MC-38918 was closed as Complete.

The fix will be available with the upcoming 2.4.3 release.

@ihor-sviziev
Copy link
Contributor

@sidolov @sivaschenko @gabrieldagama i don’t see any commits related to internal ticket if using search https://github.com/magento/magento2/search?q=MC-38918&type=commits . Could you please provide us some info how we can find the fix ?

@gabrieldagama
Copy link
Contributor

Hi @ihor-sviziev, this issue was manually closed on our Jira Project because the GitHub one was already closed for some time. Apparently, our bot has added the message about the fix, but, there is no fix.

If this still an issue, please feel free to reopen it!

Thanks!

@hostep
Copy link
Contributor

hostep commented Feb 15, 2021

@gabrieldagama, @sdzhepa: this is really bad behavior of the bot, I've seen this happening a few times before in other tickets. Placing automated comments like these put people at ease, they believe that an issue will actually be fixed if a bot leaves this comment even if we can't find a reference to it in the commits (because we've grown accustomed by now that publishing code to github can sometimes take a few days or weeks even if a ticket is already closed before that happens).

Can you investigate this bot and fix it so it doesn't leave incorrect comments like these anymore in the future?

Thanks!

@saharin88
Copy link

There was nothing I could do (module:enable etc.) due to this error.
I add to \Magento\Framework\Code\Generator\EntityAbstract::extractParameterDefaultValue before return $value this code
if($this->getSourceClassName() === '\Psr\Log\LoggerInterface' && $parameter->name === 'context') {$value = new ValueGenerator(array(), ValueGenerator::TYPE_ARRAY);}

@ahmedch1
Copy link
Member

I got same error , anyone knows how to solve it?
Thanks in advance

@ihor-sviziev
Copy link
Contributor

@ahmedch1 make sure you don't have installed psr php extension. If you have such - please remove it

@murtuza1234
Copy link

@jissereitsma great mate your solution works like charm, a dozen thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Framework/Code Component: Framework/ObjectManager Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Progress: done Reported on 2.4.1 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
None yet
Development

Successfully merging a pull request may close this issue.