Repository navigation
Ensured dynamic rendering of forms - #1023
Conversation
There was a problem hiding this comment.
🟡 Changes requested
The fix works for the default widget setting, but the per-widget "Cache Settings: Active" option still caches the form nonce.
Questions for the author
- Do supported full-page caches bypass or refresh the nonce-bearing form markup for each visitor? The form still prints its nonce into the page HTML.
Validation details
- Files reviewed: 2/2 changed files.
- Elementor 4.4.1, element cache on, admin loads first. At HEAD the visitor gets a new nonce and sends: `mkdir -p /var/www/html/wp-content/mu-plugins && cat > /var/www/html/wp-content/mu-plugins/r2-mail-stub.php <<'EOF'
Untested areas
- Elementor versions before 4.4.1 were not checked. - A manual file upload update that skips the core upgrader was not checked for stale element cache. - The variant pass did not settle these places, where the fixed cause may still reach: - `/repo/obfx_modules/elementor-extra-widgets/widgets/elementor/posts-grid.php:1519-1528,1745-1752,1798-1805` — unverified: Renders request pagination, Woo prices and full post content without overriding the classifier. E1 must establish Elementor’s inherited default and cache guards before this is OPEN… - `/repo/obfx_modules/elementor-extra-widgets/widgets/woo/featured-products.php:31-46,94-116` — unverified: Separate widget-ID-only caches replay shortcode/excerpt HTML. Whether supported producers emit visitor-dependent output needs version-matched WooCommerce/WordPress evidence; siblin… - `widgets/wp/eaw-posts-widget-plus.php:31-46,100-120` — unverified: Separate widget-ID-only caches replay shortcode/excerpt HTML. Whether supported producers emit visitor-dependent output needs version-matched WooCommerce/WordPress evidence; siblin…There was a problem hiding this comment.
🟡 Changes requested
The form nonce fix now works under every cache setting, but the posts grid still caches page-dependent output under "Cache Settings: Active".
obfx_modules/elementor-extra-widgets/widgets/elementor/posts-grid.php:1528—correctnessThe posts grid still serves cached request-dependent output when a widget's "Cache Settings" is "Active". The grid prints pagination and the posts of the current page. Elementor reads_element_cache = 'no'beforeis_dynamic_content()and stores the HTML in_elementor_element_cache, one copy per document. Later visitors then see the first request's page of posts. Apply the sameshould_render_shortcode()override to the posts grid when pagination is on. Add a case intests/test-elementor-posts-grid.phpwith_element_cache => 'no'and pagination on.
Validation details
- Files reviewed: 3/3 changed files.
- Elementor 4.4.1, contact form set to "Active", admin loads first. The visitor gets a fresh nonce:
cd /workspace/checks/R1; cd /var/www/html; MODE=set wp eval-file /workspace/checks/R1/set-active.php 2>&1 | tail -3 | te…printedVISITOR_NONCE=1003a07913(run R8) - The element cache holds no form nonce:
cd /var/www/html; wp post meta get 6 _elementor_element_cache > /workspace/checks/R1/element-cache-meta.txt 2>&1; wc -c …printedmeta_has_wpnonce=0(run R9) - The new test fails on the base code:
PL=/var/www/html/wp-content/plugins; ln -sfn /tmp/ab-base $PL/themeisle-companion; cd /tmp/ab-base && set -o pipefail; t…printedFailed asserting that false is true.(run R4) It passes at HEAD:cd /repo; sed -n 375,378p tests/test-content-forms-markup.php; cd /repo && set -o pipefail; timeout 300 phpunit --do-not…printedOK (9 tests, 18 assertions)(run R5) - The new override matches Elementor's untyped
protectedparent in 3.22.0, 4.4.1 and 4.5.0.
Untested areas
- Beaver Builder form widgets were not checked, because Beaver Builder is not installed.
- WooCommerce and excerpt widget caches were not checked, because WooCommerce is absent.
- Elementor versions before 4.4.1 were not run.
- Full-page caches outside Elementor were not checked.
- The variant pass did not settle these places, where the fixed cause may still reach:
obfx_modules/content-forms/includes/widgets-admin/beaver/beaver_widget_base.php:689-698— unverified: All three Beaver forms print nonces. Beaver Builder is absent from the installed plugins; missing fact: whether a supported version caches this PHP-rendered HTML or executes it eac…includes/frontend.php:1-2— unverified: All three Beaver forms print nonces. Beaver Builder is absent from the installed plugins; missing fact: whether a supported version caches this PHP-rendered HTML or executes it eac…obfx_modules/elementor-extra-widgets/widgets/woo/featured-products.php:31-46,94-116— unverified: Widget-ID-only caching replays WooCommerce shortcode HTML. WooCommerce is absent; its resolved version and visitor-dependent shortcode output remain unverified.obfx_modules/elementor-extra-widgets/widgets/wp/eaw-posts-widget-plus.php:31-46,100-120— unverified: Both cache excerpts without visitor variation. WordPress 7.1.5 confirms excerpts depend on the password cookie (/var/www/html/wp-includes/post-template.php:423-424,882-903). Cross-…widgets/wp/eaw-posts-widget.php:97-117— unverified: Both cache excerpts without visitor variation. WordPress 7.1.5 confirms excerpts depend on the password cookie (/var/www/html/wp-includes/post-template.php:423-424,882-903). Cross-…- not reached: requirements.md:29 encoded Playground blueprint
🤖 Automated review · run code-review-agent_6afe9c4a7a3669.70069526.
🤖 Review agent — review posted ✅ on e83cf72f · changes requested · 1 finding · 12 min
Run code-review-agent_6afe9c4a7a3669.70069526 · trail
There was a problem hiding this comment.
🟢 Approved
The PR passes: the paginated posts grid now renders on every request under "Cache Settings: Active", which fixes the earlier finding.
Validation details
- Files reviewed: 5/5 changed files. The commit since the prior review changes 2 of them.
- Elementor 4.4.1, paginated grid set to "Active". At HEAD, page 2 shows other posts than page 1, and the element cache holds only a placeholder (runs R6, R16). The pr-base code shows page 1's posts on page 2 (run R15).
- A grid without pagination stays cached at HEAD (run R16).
- The new posts grid test passes at HEAD. It fails on pr-base code with
Failed asserting that false is true(run R3). - Form nonce runs are reused from run code-review-agent_6afe9c4a7a3669.70069526, not rerun.
Untested areas
- The variant pass was not rerun. Beaver Builder forms and WooCommerce and excerpt widget caches stay unverified.
- Elementor versions other than 4.4.1 were not run.
- Full-page caches outside Elementor were not checked.
🤖 Automated review · run code-review-agent_6afea1e51a2de5.38171258.
🤖 Review agent — review posted ✅ on e0d287f7 · approved · 0 findings · 8 min
Run code-review-agent_6afea1e51a2de5.38171258 · trail
Summary
Updated Elementor-rendered forms to always be treated as dynamic content, preventing cached form markup from reusing per-visitor nonces and ensuring each visitor receives freshly rendered forms. Added a regression test to verify the dynamic content handling.
Check before Pull Request is ready:
Closes #1011