Description
features/plugin-list-wporg-status.feature:32-41 mocks the plugin-info API response for no-longer-in-directory with unquoted keys:
{
error: "closed",
name: "No Longer in Directory",
...
}
That is not JSON. WpOrgApi::get_plugin_info() runs json_decode() and throws on the decode error (wp-cli/php/WP_CLI/WpOrgApi.php:311-314), so get_wporg_data() lands in the catch at src/Plugin_Command.php:1126 and marks the plugin closed only because the trac request is not a 404 (:1140-1141). The scenario therefore tests the "API request failed" path, not a real closure response.
The real API answers a closed plugin with HTTP 200 and a body like {"error":"closed","name":"...","closed":true,"closed_date":"2018-10-02","reason":"guideline-violation"}. get_wporg_data() treats any decoded body as active (:1129), so with a valid fixture the scenario would report active for a closed plugin.
Two things to do:
- Quote the keys in the fixture so it is valid JSON.
- Make
get_wporg_data()recogniseerror: "closed"(orclosed: true) in a decoded response and returnclosedwithout the trac round trip. Keep the trac fallback covered by a separate scenario where the API is unreachable.
Found while reviewing #547; predates it.
Activity
AnuragR3k commentedon Sep 12, 2026
@schlessera Hi, I worked on this issue and created PR #550 with the fix. could u please take a look when you get a chance? Thank you :