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

Error 500 when design/header/welcome is null #37208

Closed
1 of 5 tasks
gorghoa opened this issue Mar 14, 2023 · 25 comments
Closed
1 of 5 tasks

Error 500 when design/header/welcome is null #37208

gorghoa opened this issue Mar 14, 2023 · 25 comments
Assignees
Labels
Area: Admin UI Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.6 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@gorghoa
Copy link

gorghoa commented Mar 14, 2023

Preconditions and environment

  • Magento version: 2.4.6 (upgrading from 2.4.5-p1)
  • PHP 8.1

Steps to reproduce

  • The config design/header/welcome is null

Expected result

  • Nothing special, just not crashing.

Actual result

Error 500, with exception when accessing the frontend:

TypeError: addslashes(): Argument #1 ($string) must be of type string, null given in /var/www/html/app/vendor/magento/framework/Escaper.php:440

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

WORKAROUND

If anyone stumbles upon the same issue : Set a value to the field in Content > Configuration > pick your scope > Header welcome text and you are good to go.

image

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 Mar 14, 2023

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

@gorghoa
Copy link
Author

gorghoa commented Mar 14, 2023

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

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

@engcom-Dash engcom-Dash self-assigned this Mar 14, 2023
@m2-assistant
Copy link

m2-assistant bot commented Mar 14, 2023

Hi @engcom-Dash. 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).
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    1. Add Area: XXXXX label to the ticket, indicating the functional areas 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!

@gorghoa
Copy link
Author

gorghoa commented Mar 14, 2023

@magento give me 2.4-develop instance

@engcom-Hotel engcom-Hotel added the Reported on 2.4.6 Indicates original Magento version for the Issue report. label Mar 14, 2023
@engcom-Dash
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Dash
Copy link
Contributor

Hi @gorghoa ,

Issue confirmed !

Verified the issue in 2.4.6 Instance and 2.4-Develop instance.The issue is reproducible in 2.4.6,But not reproducible in 2.4-develop instance.

We can reproduce the issue in 2.4.6 Magento instance,Hence we are confirming the issue.

Preconditions:
Magento Version 2.4.6 and 2.4-develop
PHP Version 8.1

1.The issue is not reproducible with 2.4-develop instance

Kindly refer the below screenshots:

fr3

fr4

Steps to reproduce:

  • Install Magento instance 2.4 - develop
  • Go to Admin Panel and click the content option
  • Select Configuration option under Design
  • Click the edit button of Main website store view
  • Click the header option and Select the Welcome text box
  • Delete the default welcome message and save the configuration
  • Go to front end hit the url.

In 2.4-develop instance when we are accessing the front end url with default welcome Message as null,its working without any issue,Without welcome msg front end running properly.So the issue is not reproducible in 2.4-develop.

2.But The issue is reproducible in 2.4.6

Kindly refer the below screenshots:

fr2

fr1

Steps to reproduce:

  • Install Magento instance 2.4.6
  • Go to Admin Panel and click the content option
  • Select Configuration option under Design
  • Click the edit button of Main website store view
  • Click the header option and Select the Welcome text box
  • Delete the default welcome message and save the configuration
  • Go to front end hit the url.

When we accessing the front with default welcome message as null,Its showing error with exception as per actual result and this is reproducible in 2.4.6 magento instance,Hence we are confirming the issue.

Regards,

@engcom-Dash engcom-Dash 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: Admin UI and removed Issue: ready for confirmation labels Mar 15, 2023
@github-jira-sync-bot
Copy link

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

@m2-assistant
Copy link

m2-assistant bot commented Mar 15, 2023

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

@slavvka
Copy link
Member

slavvka commented Mar 15, 2023

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

@github-jira-sync-bot github-jira-sync-bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Mar 15, 2023
@TuVanDev
Copy link
Member

@magento I am working on this

@chrisbadley
Copy link

chrisbadley commented Mar 16, 2023

I am working on this

I used your commit earlier to apply the fix, which worked well. Thanks.

@m2-assistant
Copy link

m2-assistant bot commented Mar 16, 2023

Hi @chrisbadley! 👋
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

@TuVanDev
Copy link
Member

I've created a pull request to solve this issue and it was approved yesterday.
You can apply this patch to your project:

From 5223d7e9c911f3a19a7ed42b28127b2a1afe7e1d Mon Sep 17 00:00:00 2001
From: Tu Van <[email protected]>
Date: Thu, 16 Mar 2023 14:20:38 +0700
Subject: [PATCH] Fix PHP Type error in Header block class

---
 vendor/magento/module-theme/Block/Html/Header.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vendor/magento/module-theme/Block/Html/Header.php b/vendor/magento/module-theme/Block/Html/Header.php
index 1550ebaa367d..e7eafc0b7316 100644
--- a/vendor/magento/module-theme/Block/Html/Header.php
+++ b/vendor/magento/module-theme/Block/Html/Header.php
@@ -54,7 +54,7 @@ public function __construct(
     public function getWelcome()
     {
         if (empty($this->_data['welcome'])) {
-            $this->_data['welcome'] = $this->_scopeConfig->getValue(
+            $this->_data['welcome'] = (string)$this->_scopeConfig->getValue(
                 'design/header/welcome',
                 ScopeInterface::SCOPE_STORE
             );

Document on how to apply a composer patch:

Pull request: #37222

@gorghoa
Copy link
Author

gorghoa commented Mar 21, 2023

Thank you to everyone involved :)

@chittima
Copy link
Contributor

Issue is closed as it is not reproducible on latest 2.4-develop

@hostep
Copy link
Contributor

hostep commented Mar 23, 2023

After a git bisect session, I've found the fix in core magento for this: 4b5c1dc

@Viper9x: it looks like your PR is no longer necessary.

@TuVanDev
Copy link
Member

TuVanDev commented Mar 24, 2023

Good catch @hostep . Thanks. I'll close my PR.

Although the purpose of that commit (4b5c1dc) was to fix the welcome message containing single quote character, it also inadvertently solved this issue since __() method return \Magento\Framework\Phrase which also force change the type of the text to string

@lano-vargas
Copy link

This appears to be still an issue for me when I've upgrade it to 2.4.6-p4

@hostep
Copy link
Contributor

hostep commented Mar 25, 2024

That's correct, the fix will be included in 2.4.7 (to be released in about 2 weeks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Admin UI Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.6 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Development

Successfully merging a pull request may close this issue.

10 participants