Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#55212 closed defect (bug) (fixed)

PHP Notice: Array to string conversion in admin ajax points.

Reported by: dd32's profile dd32 Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.0 Priority: lowest
Severity: trivial Version:
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

Requests similar to the following trigger a PHP Notice:

PHP Notice:  Array to string conversion in ...

While it would be possible for a plugin to be expecting wp_ajax_Array or admin_post_Array to be fired. I don't see these as valid or remotely expected use-cases though.

Additionally, this applies the changes in response-code to the admin-ajax endpoint in [41120] & [41926] to the admin-post endpoint.

Change History (4)

This ticket was mentioned in PR #2337 on WordPress/wordpress-develop by dd32.


3 years ago
#1

  • Keywords has-patch added

#2 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 6.0

#3 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 52813:

Administration: Require a valid action parameter to be set for admin-ajax.php requests.

This avoids Array to string conversion PHP notices when an array is passed as the action parameter.

Additionally, send an appropriate HTTP response status code when an invalid action is passed to admin-post.php.

Follow-up to [13175], [19738], [41120], [41926].

Props dd32.
Fixes #55212.

Note: See TracTickets for help on using tickets.