Skip to content

Reports: Avoid deprecation notice when fields is not an array - #2236

Merged
bor0 merged 1 commit into
productionfrom
fix/wordcamp-details-fields-deprecation
Oct 22, 2026
Merged

bor0 merged 1 commit into
productionfrom
fix/wordcamp-details-fields-deprecation

Conversation

@bor0

@bor0 bor0 commented Oct 22, 2026

Copy link
Copy Markdown
Member

WordCamp_Details::export_to_file() runs on every admin_init, including anonymous admin-ajax.php requests. When fields is sent as a string, filter_input( ..., FILTER_REQUIRE_ARRAY ) returns false, and $fields[] = 'Name' logs Automatic conversion of false to array is deprecated. Bots probing other plugins trigger it.

This treats a non-array fields as an empty array. Nothing changes for real form submissions.

Testing

  1. Run curl -X POST -d 'action=foo&fields=bar' https://events.wordpress.test/wp-admin/admin-ajax.php.
  2. Before: the deprecation notice is logged from class-wordcamp-details.php. After: no notice.
  3. Running the WordCamp Details report and exporting it as CSV in wp-admin still works.

🤖 Generated with Claude Code

`filter_input()` with `FILTER_REQUIRE_ARRAY` returns `false` for a non-array
value, and appending `Name` to it triggers "Automatic conversion of false to
array is deprecated". This runs on every `admin_init`, so anonymous
admin-ajax requests with a string `fields` param fill the logs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@bor0
bor0 marked this pull request as ready for review October 22, 2026 11:46
@bor0
bor0 merged commit 54fb1c3 into production Oct 22, 2026
5 checks passed
@bor0
bor0 deleted the fix/wordcamp-details-fields-deprecation branch October 22, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant