fix: handle array ids in bulk action admin notices - #753
Conversation
📝 WalkthroughWalkthroughThe admin bulk notice handler now unslashes the ChangesAdmin notice ID parsing
Estimated code review effort: 2 (Simple) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 PHPStan (2.2.7)PHP Warning: require(/vendor/composer/../guzzlehttp/promises/src/functions_include.php): Failed to open stream: No such file or directory in /vendor/composer/autoload_real.php on line 39 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
includes/admin/bulk-actions.php (1)
204-205: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd regression coverage for both request formats.
Test
custom_bulk_admin_notices()withidsas an array and as a comma-separated string. Verify that both inputs produce the correct selected-post count.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@includes/admin/bulk-actions.php` around lines 204 - 205, Add regression tests for custom_bulk_admin_notices() covering ids supplied as an array and as a comma-separated string, and assert that each format produces the correct selected-post count. Reuse the existing test setup and notice-count expectations without changing the request parsing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@includes/admin/bulk-actions.php`:
- Around line 204-205: Add regression tests for custom_bulk_admin_notices()
covering ids supplied as an array and as a comma-separated string, and assert
that each format produces the correct selected-post count. Reuse the existing
test setup and notice-count expectations without changing the request parsing
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: dc9c85ea-ac7e-46d5-b37d-a6d65b7beed3
📒 Files selected for processing (1)
includes/admin/bulk-actions.php
Task:: Error Report on bulk-actions.php
Description:: Fixed a
TypeErrorinbulk-actions.phpthat occurred when theidsparameter was passed as an array instead of a comma-separated string.Previously, the code directly used
explode(',', $_REQUEST['ids']), which caused a fatal error when$_REQUEST['ids']was an array.Updated the logic to support both formats by checking whether the
idsvalue is an array or a string before processing it.This resolves the fatal error encountered when updating category protection through the Simple Membership plugin.
Before:: Link
After:: Link
Summary by CodeRabbit