Making WordPress.org

Opened 7 weeks ago

Last modified 6 weeks ago

#8218 new defect (bug)

Set_Plugin_Project - validate JSON via json_validate()

Reported by: timse201's profile timse201 Owned by:
Milestone: Priority: normal
Component: Translate Site & Plugins Keywords: has-patch
Cc:

Description

Currently, Set Plugin checks if the API response is valid JSON by looking at the first character ($json && '{' == $json[0]).

If the API response starts with a simple space, a new line, or a hidden character the check fails. It will reject the data, even if the JSON is fine.

Change History (2)

This ticket was mentioned in PR #592 on WordPress/wordpress.org by @timse201.


7 weeks ago
#1

  • Keywords has-patch added

fixes: https://meta.trac.wordpress.org/ticket/8218

Replaces the manual string check with PHP 8.3 native json_validate() function.

@dd32 commented on PR #592:


6 weeks ago
#2

At present we're running PHP 8.1 on WordPress.org (PHP 8.3 to come shortly).

This check is primarily supposed to catch HTML output from the endpoint, in the case of errors.

Note: See TracTickets for help on using tickets.