Skip to content

Show an error when a submit is cut off by max_input_vars - #3626

Open
vivi-the-going-merry[bot] wants to merge 1 commit into
masterfrom
fix/issue-6922-max-input-vars
Open

vivi-the-going-merry[bot] wants to merge 1 commit into
masterfrom
fix/issue-6922-max-input-vars

Conversation

@vivi-the-going-merry

@vivi-the-going-merry vivi-the-going-merry Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What was broken

When a form sends more values than PHP's max_input_vars, PHP drops the extra ones. The hidden item_key field comes last, so it is lost. process_entry() then returns early, no entry is saved, and the visitor sees "It looks like you've already submitted that."

What changed

process_entry() now checks a POST that has form_id but no item_key. If the POST has at least max_input_vars values, it adds a form error. The form shows again with the visitor's values and says it has more fields than the server accepts. Requests under the limit behave as before.

Not changed: the AJAX part of the issue (send action and the nonce first). With AJAX on, the JS already falls back to a full submit, which now shows this error.

How it was verified

  • Two PHPUnit tests added: a POST at the limit gets the error; a POST under the limit is left alone.
  • Not run locally: local PHPUnit here is on a PHPUnit version the WP test lib doesn't support. Relying on CI (run tests, run analysis).
  • No before/after screenshot yet: max_input_vars can't be changed in the preview env.

Fixes Strategy11/formidable-pro#6922

🤖 Generated with Claude Code

PHP drops every input var past max_input_vars, so item_key never arrives and the visitor saw the failed/duplicate message. Add a form error instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@deepsource-io

deepsource-io Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in c5b435b...3acab5e on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Oct 27, 2026 12:27p.m. Review ↗
JavaScript Oct 27, 2026 12:27p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@vivi-the-going-merry

Copy link
Copy Markdown
Contributor Author

No before/after image yet: the preview env can't set max_input_vars. Left franky-review off until someone with a PHP-FPM site can capture it. PHPUnit and analysis are running via the run tests and run analysis labels.

);
FrmEntriesController::process_entry();

$this->assertNotEmpty( $frm_vars['created_entries'][ $form_id ]['errors']['form'] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmEntriesController::assertNotEmpty()


The method you are trying to call is not defined, which can result in a fatal error.

FrmEntriesController::process_entry();

$this->assertNotEmpty( $frm_vars['created_entries'][ $form_id ]['errors']['form'] );
$this->assertArrayNotHasKey( 'entry_id', $frm_vars['created_entries'][ $form_id ] );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmEntriesController::assertArrayNotHasKey()


The method you are trying to call is not defined, which can result in a fatal error.

);
FrmEntriesController::process_entry();

$this->assertArrayNotHasKey( $form_id, $frm_vars['created_entries'] ?? array() );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmEntriesController::assertArrayNotHasKey()


The method you are trying to call is not defined, which can result in a fatal error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants