Skip to content

[Issue] Avoid lots of uncessary exceptions during layout XML merge loading #39877

Open
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #37570: Avoid lots of uncessary exceptions during layout XML merge loading


Description

  • Introduce a new function (for B/C compat we don't overwrite the protected _loadXmlString) to load and not throw an exception
  • Use it in extract handlers -> no need to catch the exception any more

Related Pull Requests

See also: justbetter/magento2-sentry#113

Fixed Issues (if relevant)

No magento issue created.

Manual testing scenarios (*)

  1. Install the sentry plugin
  2. Have some invalid XML there
  3. Exception is reported, even it is not necessary

Reason

When using tools like Sentry, because of there inner workings, such exceptions still might be reported. While this is not exactly the root cause, it's always cleaner to not throw an exception and immediately catch it, if invalid cases can happen often.

This might even improve performance a bit and improves developer's experience.

Remarks

There seems some invalid XML at that place in the code happen quite often - it might be also interesting to check if that can be avoided.

This is a simple, trivial change to the code and should not break anything, so hopefully this can get triaged quickly and without to much back-and-forth about the testing procedure :-)

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • [not applicable] All new or changed code is covered with unit/integration tests (if applicable)
  • [not applicable] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • [waiting] All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: FrontendIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Reported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    Status

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions