Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#55212 closed defect (bug) (fixed)

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

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

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.


5 years ago
#1

  • Keywords has-patch added

#2 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review → 6.0

#3 @SergeyBiryukov
5 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → 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.