Problem
The Extensions page's Install & Activate flows surface multiple errors. Observed across two environments (local and deployed):
Environment 1:
- WPGraphQL for ACF card:
Uncaught Error: array_map(): Argument #2 ($array) must be of type array, null given in .../wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php on line 383 rendered as the card's error notice after clicking Install & Activate
- WPGraphQL Smart Cache card:
Plugin not found.
Environment 2:
- WPGraphQL for ACF card:
The response is not a valid JSON response.
- WPGraphQL IDE card:
The response is not a valid JSON response.
- WPGraphQL Yoast SEO Addon card:
Plugin file does not exist. (card still shows Install & Activate although the plugin appears to be installed)
In all cases the card button state does not reflect what actually happened, and the raw error strings (including a PHP fatal from WP core's REST plugins controller) are shown to the user as-is.
Suspected surfaces
- The install path proxies to the core
wp/v2/plugins REST controller, and the array_map(): Argument #2 must be of type array, null given fatal comes from inside that controller, suggesting unexpected/null data for the plugin being installed (e.g. a wp.org API response shape issue or a plugin without the expected headers)
Plugin file does not exist. / Plugin not found. point at slug → plugin-file resolution in the activate flow (src/Admin/Extensions/Extensions.php)
The response is not a valid JSON response. suggests the REST response contained PHP output/HTML, i.e. an underlying error leaking into the response body
- Client-side handling in
packages/extensions/useInstallPlugin.js surfaces raw error strings and doesn't reconcile card state after failures
Acceptance
- Install & Activate works for each extension in the official directory, from both not-installed and installed-but-inactive states
- Failures render user-friendly messages, never raw PHP fatals
- Card button/state reconciles with the actual plugin state after success and failure
- e2e coverage for the install and activate flows (these regressions are exactly what the widest-surface-first testing policy is for)
Related: #3203 (post-activation callback for extensions) touches the same flow.
Problem
The Extensions page's Install & Activate flows surface multiple errors. Observed across two environments (local and deployed):
Environment 1:
Uncaught Error: array_map(): Argument #2 ($array) must be of type array, null given in .../wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php on line 383rendered as the card's error notice after clicking Install & ActivatePlugin not found.Environment 2:
The response is not a valid JSON response.The response is not a valid JSON response.Plugin file does not exist.(card still shows Install & Activate although the plugin appears to be installed)In all cases the card button state does not reflect what actually happened, and the raw error strings (including a PHP fatal from WP core's REST plugins controller) are shown to the user as-is.
Suspected surfaces
wp/v2/pluginsREST controller, and thearray_map(): Argument #2 must be of type array, null givenfatal comes from inside that controller, suggesting unexpected/null data for the plugin being installed (e.g. a wp.org API response shape issue or a plugin without the expected headers)Plugin file does not exist./Plugin not found.point at slug → plugin-file resolution in the activate flow (src/Admin/Extensions/Extensions.php)The response is not a valid JSON response.suggests the REST response contained PHP output/HTML, i.e. an underlying error leaking into the response bodypackages/extensions/useInstallPlugin.jssurfaces raw error strings and doesn't reconcile card state after failuresAcceptance
Related: #3203 (post-activation callback for extensions) touches the same flow.