Description
Version
4.3.0
What did you expect to happen?
In a Radicle project we have the experimental Request handler enabled via ACORN_ENABLE_EXPERIMENTAL_WORDPRESS_REQUEST_HANDLER=true
.
We now installed WP Rocket (Previously we had WP Optimize where it also didn't work).
It should create static html files inside public/content/cache/wp-rocket/example.com
What actually happens?
It only creates those static html files when the experimental request handler is disabled.
It's related to output buffering. WP Rocket receives an empty output buffer at https://github.com/wp-media/wp-rocket/blob/09708aa55d362a9535ad4d45cb68280325efaecb/inc/classes/Buffer/class-cache.php#L259
The order of calls is:
- public/content/advanced-cache.php (generated) calls wp-media/wp-rocket@09708aa/inc/classes/Buffer/class-cache.php::maybe_init_process()
maybe_init_process
callsob_start( [ $this, 'maybe_process_buffer' ] );
- Some time later
maybe_process_buffer
is called with an empty string https://github.com/wp-media/wp-rocket/blob/09708aa55d362a9535ad4d45cb68280325efaecb/inc/classes/Buffer/class-cache.php#L256
When we disable the experimental request handler the buffer contains the correct content and the static file is generated.
Steps to reproduce
- Add
ACORN_ENABLE_EXPERIMENTAL_WORDPRESS_REQUEST_HANDLER=true
to.env
composer install wp-media/wp-rocket
- Activate WP Rocket (By default it will add
define( 'WP_CACHE', true ); // Added by WP Rocket
to wp-config.php, but that should be fine for testing. Can be disabled via https://docs.wp-rocket.me/article/958-how-to-use-wp-rocket-with-bedrock-wordpress-boilerplate) - Go to
public/content/cache/wp-rocket/your-domain.localhost
(or the wp-content path which is configured without Radicle) - Load a page and see that there are no generated files
- Remove
ACORN_ENABLE_EXPERIMENTAL_WORDPRESS_REQUEST_HANDLER=true
from.env
- Load a page and now it should generate static files
System info
No response
Log output
No response
Please confirm this isn't a support request.
Yes