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

Emptying a theme's welcome message throws an error. #37748

Closed
1 of 5 tasks
Hexmage opened this issue Jul 11, 2023 · 18 comments
Closed
1 of 5 tasks

Emptying a theme's welcome message throws an error. #37748

Hexmage opened this issue Jul 11, 2023 · 18 comments
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.6-p1 Indicates original Magento version for the Issue report.

Comments

@Hexmage
Copy link

Hexmage commented Jul 11, 2023

Preconditions and environment

  • Magento 2.4.6-p1
  • Any theme that shows the default welcome message. (luma or blank will do)

Steps to reproduce

  1. In the Adminpanel navigate to Content -> Design -> Configuration.
  2. Select your default storeview.
  3. Go to Other Settings -> Header -> Welcome text, and empty it.
  4. Flush cache.
  5. Open the frontend homepage.

Expected result

No Welcome message is shown when you visit the homepage.

Actual result

TypeError: addslashes(): Argument #1 ($string) must be of type string, null given in ../vendor/magento/framework/Escaper.php:440
Stack trace:
#0 ..vendor/magento/framework/Escaper.php(440): addslashes()
#1 ..vendor/magento/module-theme/Block/Html/Header.php(62): Magento\Framework\Escaper->escapeQuote()
#2 ..vendor/magento/module-theme/view/frontend/templates/html/header.phtml(11): Magento\Theme\Block\Html\Header->getWelcome()
#3 ..vendor/magento/framework/View/TemplateEngine/Php.php(71): include('...')
#4 ..vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render()
#5 ..vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent()
#6 ..vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}()
#7 ..generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(23): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callPlugins()
#8 ..vendor/magento/framework/View/Element/Template.php(263): Magento\Framework\View\TemplateEngine\Php\Interceptor->render()
#9 ..vendor/magento/framework/View/Element/Template.php(293): Magento\Framework\View\Element\Template->fetchView()
#10 ..vendor/magento/framework/View/Element/AbstractBlock.php(1117): Magento\Framework\View\Element\Template->_toHtml()
#11 ..vendor/magento/framework/View/Element/AbstractBlock.php(1121): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#12 ..vendor/magento/framework/View/Element/AbstractBlock.php(670): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#13 ..vendor/magento/framework/View/Layout.php(578): Magento\Framework\View\Element\AbstractBlock->toHtml()
#14 ..vendor/magento/framework/View/Layout.php(555): Magento\Framework\View\Layout->_renderBlock()
#15 ..vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#16 ..vendor/magento/framework/View/Element/Html/Links.php(63): Magento\Framework\View\Layout->renderElement()
#17 ..vendor/magento/framework/View/Element/Html/Links.php(83): Magento\Framework\View\Element\Html\Links->renderLink()
#18 ..vendor/magento/framework/View/Element/AbstractBlock.php(1117): Magento\Framework\View\Element\Html\Links->_toHtml()
#19 ..vendor/magento/framework/View/Element/AbstractBlock.php(1121): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#20 ..vendor/magento/framework/View/Element/AbstractBlock.php(670): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#21 ..vendor/magento/framework/View/Layout.php(578): Magento\Framework\View\Element\AbstractBlock->toHtml()
#22 ..vendor/magento/framework/View/Layout.php(555): Magento\Framework\View\Layout->_renderBlock()
#23 ..vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#24 ..vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#25 ..vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#26 ..vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#27 ..vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#28 ..vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#29 ..vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#30 ..vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#31 ..vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#32 ..vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#33 ..vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#34 ..vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#35 ..vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#36 ..vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#37 ..vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#38 ..vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#39 ..vendor/magento/framework/View/Layout.php(975): Magento\Framework\View\Layout->renderElement()
#40 ..vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->getOutput()
#41 ..vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent()
#42 ..vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}()
#43 ..generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout\Interceptor->___callPlugins()
#44 ..vendor/magento/framework/View/Result/Page.php(260): Magento\Framework\View\Layout\Interceptor->getOutput()
#45 ..vendor/magento/framework/View/Result/Layout.php(171): Magento\Framework\View\Result\Page->render()
#46 ..vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult()
#47 ..vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent()
#48 ..vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}()
#49 ..generated/code/Magento/Framework/View/Result/Page/Interceptor.php(32): Magento\Framework\View\Result\Page\Interceptor->___callPlugins()
#50 ..vendor/magento/framework/App/Http.php(120): Magento\Framework\View\Result\Page\Interceptor->renderResult()
#51 ..vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch()
#52 ..pub/index.php(50): Magento\Framework\App\Bootstrap->run()

Additional information

Looks like strict typing is throwing an error here.

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 Jul 11, 2023

Hi @Hexmage. Thank you for your report.
To speed up processing of this issue, 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:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ 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.

@m2-assistant
Copy link

m2-assistant bot commented Jul 11, 2023

Hi @engcom-Bravo. 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).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas 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-Bravo engcom-Bravo added the Reported on 2.4.6-p1 Indicates original Magento version for the Issue report. label Jul 11, 2023
@koushikch7
Copy link

@magento give me 2.4-6-p1 instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

Hi @koushikch7, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@koushikch7
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

@engcom-Bravo
Copy link
Contributor

Hi @Hexmage,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4-develop instance and the issue is not reproducible.Kindly refer the screenshots.

Steps to reproduce

  • In the Adminpanel navigate to Content -> Design -> Configuration.
  • Select your default storeview.
  • Go to Other Settings -> Header -> Welcome text, and empty it.
  • Flush cache.
  • Open the frontend homepage.
Screenshot 2023-07-12 at 10 37 59 AM Screenshot 2023-07-12 at 10 38 05 AM

There is no welcome message while visiting the frontend for the default store view.

Kindly recheck the behaviour on Magento 2.4-develop instance and elaborate steps to reproduce if the issue is still reproducible.

Thanks.

@engcom-Bravo engcom-Bravo added the Issue: needs update Additional information is require, waiting for response label Jul 12, 2023
@Hexmage
Copy link
Author

Hexmage commented Jul 12, 2023

@engcom-Bravo
What php version does the Magento instance get spinned up on? Because this should only be happening in php 8.2.

@devchris79
Copy link

Hi @Hexmage, I thinks the issue is probably related to this with PHP 8.2 depricating the null being changed to an empty string.

@dmanners
Copy link
Contributor

dmanners commented Jul 12, 2023

@Hexmage We are having the same issue today on a Magento cloud instance running php 8.1.x but with the following patch it seems to be fine.

diff --git a/vendor/magento/module-theme/Block/Html/Header.php b/vendor/magento/module-theme/Block/Html/Header.php
index 9f15526..f9b1102 100644
--- a/vendor/magento/module-theme/Block/Html/Header.php
+++ b/vendor/magento/module-theme/Block/Html/Header.php
@@ -58,6 +58,9 @@ class Header extends Template
                 'design/header/welcome',
                 ScopeInterface::SCOPE_STORE
             );
+	}
+	if ($this->_data['welcome'] === null) {
+            return '';
         }
         $this->_data['welcome'] =  $this->escaper->escapeQuote($this->_data['welcome'], true);
         return __($this->_data['welcome']);

@Hexmage
Copy link
Author

Hexmage commented Jul 12, 2023

@dmanners
A bit hacky but that does fix the issue.

$this->_data['welcome'] = $this->escaper->escapeQuote($this->_data['welcome'] ?? '', true);

Think I would have fixed it like this.

@dmanners
Copy link
Contributor

@Hexmage yeah that looks like a nice clean solution. My main thought was if I already know it is an empty string do I really need/want to run it through the escaper and the translation class.

@engcom-Bravo
Copy link
Contributor

engcom-Bravo commented Jul 13, 2023

Hi @Hexmage,

Thanks for your update.

Verified the issue on Magento 2.4-develop instance with php 8.2 and the issue is not reproducible.Kindly refer the screenshots.

Steps to reproduce

  • In the Adminpanel navigate to Content -> Design -> Configuration.
  • Select your default storeview.
  • Go to Other Settings -> Header -> Welcome text, and empty it.
  • Flush cache.
  • Open the frontend homepage.
Screenshot 2023-07-13 at 1 57 42 PM Screenshot 2023-07-13 at 1 57 26 PM Screenshot 2023-07-13 at 1 56 01 PM

There is no welcome message while visiting the frontend for the default store view.Please let us know still if we are missing.

Kindly recheck the behaviour on Magento 2.4-develop instance and elaborate steps to reproduce if the issue is still reproducible.

Thanks.

@hostep
Copy link
Contributor

hostep commented Jul 13, 2023

This sounds like a duplicate of #37208

Fix might be this one: #37208 (comment) and is already included in Magento 2.4.7-beta1

@engcom-Bravo
Copy link
Contributor

engcom-Bravo commented Jul 14, 2023

@hostep Thanks for your contribution & collaboration over here.

@Hexmage
The issue is fixed with this commit 4b5c1dc and it is no longer reproducible in Magento 2.4-develop instance and also changes included in Magento latest version.we have verified the issue in Magento 2.4.7-beta 1 and it is not reproducible.

Thanks.

@Hexmage
Copy link
Author

Hexmage commented Jul 14, 2023

Must have missed that issue when I searched for "welcome" (probably because I only searched through open issues). I'll close this now as it looks like its already fixed.

@Hexmage Hexmage closed this as completed Jul 14, 2023
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 Reported on 2.4.6-p1 Indicates original Magento version for the Issue report.
Projects
None yet
Development

No branches or pull requests

6 participants