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

Magento_Theme title.phtml template invalid for PHP 8.2 #39092

Open
1 of 5 tasks
adamlavery opened this issue Aug 22, 2024 · 12 comments · May be fixed by #39392
Open
1 of 5 tasks

Magento_Theme title.phtml template invalid for PHP 8.2 #39092

adamlavery opened this issue Aug 22, 2024 · 12 comments · May be fixed by #39392
Assignees
Labels
Area: Framework Component: Ui Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: PR in progress Reported on 2.4.7 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@adamlavery
Copy link

Preconditions and environment

OS 2.4.7

Steps to reproduce

There's a code error in vendor\magento\module-theme\view\frontend\templates\html\title.phtml

Expected result

Should be written for PHP 8.2 but is not.

Actual result

Template crashes if there's no page title.

Additional information

This code:

if (trim($block->getPageHeading())) {
    $titleHtml = '<span class="base" data-ui-id="page-title-wrapper" '
        . $block->getAddBaseAttribute()
        . '>'
        . $block->escapeHtml($block->getPageHeading())
        . '</span>';
}

Needs correcting to:

if ($block->getPageHeading()) {
    $titleHtml = '<span class="base" data-ui-id="page-title-wrapper" '
        . $block->getAddBaseAttribute()
        . '>'
        . $block->escapeHtml(trim($block->getPageHeading()))
        . '</span>';
}

Release note

Fix code that fails with PHP 8.2

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”.
Copy link

m2-assistant bot commented Aug 22, 2024

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

@engcom-Bravo engcom-Bravo added the Reported on 2.4.7 Indicates original Magento version for the Issue report. label Aug 22, 2024
@engcom-Hotel engcom-Hotel moved this to Ready for Confirmation in Issue Confirmation and Triage Board Aug 26, 2024
@engcom-Bravo engcom-Bravo added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Aug 28, 2024
@hostep
Copy link
Contributor

hostep commented Aug 28, 2024

It would help if you could specify the error message you're seeing? But I guess it happens when $block->getPageHeading() returns null and not a string?

@adamlavery
Copy link
Author

@hostep sorry, didn't think a log of this error was necessary. Yes, as of PHP 8.? you can no longer pass null to most/all PHP string functions. I'm sure there must be a valid reason for this change which breaks code all over the place, although I can't see it!!

@engcom-November engcom-November self-assigned this Aug 29, 2024
Copy link

m2-assistant bot commented Aug 29, 2024

Hi @engcom-November. 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-November
Copy link
Contributor

engcom-November commented Aug 29, 2024

Hello @adamlavery,

Thank you for the report and collaboration!

If the function $block->getPageHeading() returns null by any case which it should not, will cause the error as php string functions won't accept null as parameter.
Hence confirming this.

@engcom-November engcom-November added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: Ui Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Framework labels Aug 29, 2024
@github-jira-sync-bot
Copy link

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

Copy link

m2-assistant bot commented Aug 29, 2024

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

@engcom-Bravo engcom-Bravo moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Sep 2, 2024
@engcom-Hotel engcom-Hotel added the Priority: P3 May be fixed according to the position in the backlog. label Sep 3, 2024
@magentoabu
Copy link

@magento i'm working on this

Copy link

m2-assistant bot commented Nov 20, 2024

Hi @magentoabu! 👋
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.

@magentoabu
Copy link

@magento add to contributors team

Copy link

m2-assistant bot commented Nov 20, 2024

Hi @magentoabu! 👋
Thank you for joining. Please accept team invitation 👉 here 👈 and add your comment one more time.

@magentoabu
Copy link

@magento I'm working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Component: Ui Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: PR in progress Reported on 2.4.7 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants