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

Theme issue on setup:upgrade #35843

Closed
1 of 5 tasks
Nuranto opened this issue Jul 29, 2022 · 15 comments
Closed
1 of 5 tasks

Theme issue on setup:upgrade #35843

Nuranto opened this issue Jul 29, 2022 · 15 comments
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@Nuranto
Copy link
Contributor

Nuranto commented Jul 29, 2022

Summary (*)

When performing a setup:upgrade, we get :

The following themes will be registered: adminhtml/Magento/blank, adminhtml/Hyva/reset, adminhtml/Magento/luma, adminhtml/Hyva/default
The following themes will be removed: frontend/Magento/blank, frontend/Magento/luma, frontend/Hyva/reset, frontend/Hyva/default

The issue is here :
app/code/Magento/Theme/Model/Theme.php

public function getArea()
    {
        // In order to support environment emulation of area, if area is set, return it
        if ($this->getData('area') && !$this->_appState->isAreaCodeEmulated()) {
            return $this->getData('area');
        }
        return $this->_appState->getAreaCode();
    }

The emulation of adminhtml is triggered in setup:upgrade by /var/www/html/vendor/magento/module-deploy/Console/Command/App/ConfigImportCommand.php(106)

Proposed solution

I can't see any usecase where a theme should return the current state area, so the better solution seems to be :

public function getArea()
    {
            return $this->getData('area');
    }

(or simply remove the whole function, and let the magic functions deal with it.)
Also, the appState should be removed from constructor.

Or if some reason I can't see, sometimes the area is not defined (imho this should not be permitted), we could keep the fallback like this :

public function getArea()
    {
          return $this->getData('area') ?: $this->_appState->getAreaCode();
    }

But it seems to me that this is a bad solution.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users with no 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”.
@Nuranto Nuranto added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Jul 29, 2022
@m2-assistant
Copy link

m2-assistant bot commented Jul 29, 2022

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

@Nuranto
Copy link
Contributor Author

Nuranto commented Jul 29, 2022

Here's a temporary patch, if it can helps someone :

--- a/Model/Theme.php
+++ b/Model/Theme.php
@@ -265,11 +265,7 @@
      */
     public function getArea()
     {
-        // In order to support environment emulation of area, if area is set, return it
-        if ($this->getData('area') && !$this->_appState->isAreaCodeEmulated()) {
-            return $this->getData('area');
-        }
-        return $this->_appState->getAreaCode();
+        return $this->getData('area');
     }
 
     /**

@mrtuvn
Copy link
Contributor

mrtuvn commented Jul 30, 2022

https://github.com/magento/magento2/pull/32142/files#diff-208947a432c650d2473cbf3fddba5e294553440d52c2c7e87f67f35085909ff7
Added some works quite long ago here but i will consider cover your case too

@Nuranto
Copy link
Contributor Author

Nuranto commented Jul 30, 2022

Thanks @mrtuvn !

@engcom-Delta engcom-Delta self-assigned this Aug 1, 2022
@m2-assistant
Copy link

m2-assistant bot commented Aug 1, 2022

Hi @engcom-Delta. 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.

@engcom-Delta
Copy link
Contributor

Hi @Nuranto ,
Is this issue resolved ?

Thanks

@engcom-Delta engcom-Delta added Issue: needs update Additional information is require, waiting for response and removed Issue: ready for confirmation labels Aug 1, 2022
@Nuranto
Copy link
Contributor Author

Nuranto commented Aug 1, 2022

Hi @engcom-Delta,

If you mean "Is the issue still present on latest 2.4", then yes, the issue is still there.

But @mrtuvn added a fix in his existing PR : #32142 cf423f3
and I confirm this solve the issue.

@m2-assistant
Copy link

m2-assistant bot commented Aug 25, 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.

@engcom-Hotel
Copy link
Contributor

Hello @Nuranto,

Thanks for the report and collaboration!

We have looked into this issue and we are unclear about the reproduction steps. We request you to please provide us with the same. It will help us in moving forward with this issue.

Thanks

@engcom-Hotel
Copy link
Contributor

Dear @Nuranto,

We have noticed that this issue has not been updated for a period of 14 Days. Hence we assume that this issue is fixed now, so we are closing it. Please raise a fresh ticket or reopen this ticket if you need more assistance on this.

Regards

@artttj
Copy link

artttj commented Mar 10, 2023

We just faced the same issue in 2.4.5-p1 when we added a new theme in config.php.

@mfickers
Copy link
Contributor

mfickers commented May 7, 2024

We're also facing this issue on 2.4.6-p5 after adding the theme configuration to app/etc/config.php.

@yutv
Copy link

yutv commented Feb 5, 2025

The same issue is in Magento 2.4.7-p3.

Steps to reproduce:

  1. change themes section in the app/etc/config.php
  2. execute php bin/magento setup:upgrade

Result:

Processing configurations data from configuration file...
Import failed: Item (Magento\Theme\Model\Theme) with the same ID "" already exists.
app:config:import failed. See previous output.

@engcom-Hotel
Copy link
Contributor

Hello @yutv,

Please help us by providing detailed steps to reproduce the issue. We are reopening the issue for further processing.

Thanks

@engcom-Hotel
Copy link
Contributor

Dear @yutv,

This issue is being closed since it has not been updated in a long time. Please feel free to reopen or raise a new ticket if the issue still exists.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: needs update Additional information is require, waiting for response Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
None yet
Development

No branches or pull requests

7 participants