Skip to content

Ensured action is string to prevent fatal - #1148

Merged
pirate-bot merged 1 commit into
developmentfrom
bugfix/1147
Sep 16, 2026
Merged

pirate-bot merged 1 commit into
developmentfrom
bugfix/1147

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

Improves AJAX request detection to avoid potential errors when the action parameter isn't a string. It also adds comprehensive unit tests to ensure correct behavior for various action values, including arrays and missing keys.

Closes #1147

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@pirate-bot

Copy link
Copy Markdown
Collaborator

Plugin build for 34bc4ec is ready 🛎️!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The targeted guard resolves the reported TypeError while preserving existing behavior with comprehensive regression coverage.

Pull request overview

Prevents fatal errors when malformed AJAX action parameters are arrays.

Changes:

  • Guards strpos() with an is_string() check.
  • Adds coverage for array, nested-array, missing, excluded, and normal actions.
File summaries
File Description
inc/manager.php Safely validates AJAX action type.
tests/test-ajax-request-detection.php Tests malformed and valid action scenarios.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced (auto)

Note

Copilot is running an experiment and ran this review at Balanced.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pirate-bot pirate-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved: The guard prevents malformed AJAX actions from crashing while preserving existing string behavior.

PHP 8.3 execution verified every asserted action shape and the security review found no changed trust-boundary risk.

Validation details
  • PHP 8.3 executed the extracted method. Arrays returned true, wpmdb returned false, and other supported inputs returned true.
  • The base method threw the reported strpos() TypeError for an array.
  • Source inspection found no authorization, capability, nonce, database, file, or outbound-access effect.
  • PHP 8.3 syntax checks passed for both changed files.
Untested areas
  • The WordPress PHPUnit class was not run because its runtime and Composer dependencies were absent.

🤖 Automated review · run code-review-agent_6aa7f3b9992878.18996665.


🤖 Review agent — review posted ✅

Run code-review-agent_6aa7f3b9992878.18996665 · trail

@girishpanchal30 girishpanchal30 linked an issue Sep 14, 2026 that may be closed by this pull request
@pirate-bot
pirate-bot merged commit 449ad4a into development Sep 16, 2026
15 checks passed
@pirate-bot
pirate-bot deleted the bugfix/1147 branch September 16, 2026 13:01
@pirate-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 4.2.14 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Indicate that an issue has been resolved and released in a particular version of the product.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array-valued AJAX action causes strpos() TypeError

4 participants