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

Automatic Lazy Rendering: 500 error in browser console if dom extension is disabled - Class "DOMDocument" not found #7002

Open
alfonso100 opened this issue Oct 2, 2024 · 7 comments · May be fixed by #7218
Labels
module: ALR Issues related to the Automatic Lazy Rendering feature needs: product direction priority: medium Issues which are important, but no one will go out of business. type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Milestone

Comments

@alfonso100
Copy link
Contributor

Before submitting an issue please check that you’ve completed the following steps:
Yes - Made sure you’re on the latest version
Yes - Used the search feature to ensure that the bug hasn’t been reported before

Describe the bug
A 500 error appears in the browser console, the website is still functional but cache and optimizations are not applied.

This is related to Automatic Lazy Rendering and its usage of PHP dom extension
When the dom extension (https://www.php.net/en/dom) is disabled in the server, it triggers the error here:

Error log:
5818 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Class "DOMDocument" not found in /wp-content/plugins/wp-rocket/inc/Engine/Optimization/LazyRenderContent/Frontend/Processor/Dom.php:81
To solve they need to enable the dom extension in PHP

To Reproduce
Steps to reproduce the behavior:

  1. Disable DOM extension in PHP
  2. Visit the frontend of the site
  3. See the 500 error console error

Expected behavior
We should check if DOM extension is enabled or not, and:

  • show a warning to the users in the backend
  • Avoid the fatal error

Additional context
Ticket 1: https://secure.helpscout.net/conversation/2720908346/514956?folderId=2683093
Ticket 2: https://secure.helpscout.net/conversation/2723174345/515454?folderId=2683093
Slack thread: https://wp-media.slack.com/archives/C43T1AYMQ/p1727853713650349

Acceptance Criteria (for WP Media team use only)
Clear instructions for developers, to be added before the grooming

@piotrbak piotrbak added type: enhancement Improvements that slightly enhance existing functionality and are fast to implement priority: medium Issues which are important, but no one will go out of business. needs: product direction module: ALR Issues related to the Automatic Lazy Rendering feature labels Oct 2, 2024
@Adrianadla
Copy link

@webtrainingwheels
Copy link

@jekayode
Copy link

@worldwildweb
Copy link
Contributor

@jekayode
Copy link

@alfonso100
Copy link
Contributor Author

alfonso100 added a commit that referenced this issue Dec 13, 2024
fixes #7002 disabling Automatic Lazy Rendering if dom extension is not loaded
alfonso100 added a commit that referenced this issue Jan 8, 2025
as discussed with @wordpressfan switch rocket_lrc_processor  to regex if dom extension is not found
@piotrbak piotrbak added this to the 3.18.1 milestone Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: ALR Issues related to the Automatic Lazy Rendering feature needs: product direction priority: medium Issues which are important, but no one will go out of business. type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Projects
None yet
6 participants