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

fixes #7002 - filter rocket_lrc_processor to use regex if DOM extension is not found #7218

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

alfonso100
Copy link
Contributor

@alfonso100 alfonso100 commented Jan 8, 2025

as discussed with @wordpressfan switch rocket_lrc_processor to regex if PHP dom extension is not found

Description

Fixes #7002

Here we check if the dom module is loaded in php so use the dom processor other than that use the regex which should do the same functionality.

Type of change

  • Enhancement (non-breaking change which improves an existing functionality).

Detailed scenario

Disable the DOM extension, see a 500 error in the site frontend, in the console (As described in the issue).

With the new code, if DOM extension is not available it should switch rocket_lrc_processor to use regex instead, preventing the error

Technical description

Documentation

Mentioned above.

New dependencies

No.

Risks

In a few cases we may face slowness when using regex but I believe this will be better than the error 500.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

Because results for dom and regex are the same so we don't need to change anything in tests, we have integration tests covering this method.

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

as discussed with @wordpressfan switch rocket_lrc_processor  to regex if dom extension is not found
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for cd0de841 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (cd0de84) Report Missing Report Missing Report Missing
Head commit (6ce0191) 38760 17142 44.23%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7218) 1 1 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

Copy link
Contributor

@wordpressfan wordpressfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job @alfonso100

@piotrbak
Copy link
Contributor

@DahmaniAdame With this approach we'll reintroduce this risk:
https://wp-media.slack.com/archives/CUKB44GNN/p1720196732934469

I believe this is acceptable 🤔

Copy link
Contributor

@Mai-Saad Mai-Saad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No fatal error now (only deprecated notices with php8.4 which shall be fixed on other PR. If the risk mentioned about regex is accepted then we can merge this one

@DahmaniAdame
Copy link
Contributor

I believe this is acceptable 🤔

Yes. Let's go with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants