wp-graphql / wp-graphql/wp-graphql

Extensions page: Install & Activate flows surface multiple errors (array_map fatal, plugin not found, invalid JSON, plugin file does not exist)

Open
#3,934 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

effort: med impact: med plugin: core scope: extensions status: actionable type: bug
Dominant language
PHP
Stars
3.8k
Forks
472
Avg merge
1d 7h
Merged PRs (30d)
85

Description

Problem

The Extensions page's Install & Activate flows surface multiple errors. Observed across two environments (local and deployed):

Image Image

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Install & Activate flows for installed and uninstalled extensions, then read src/Admin/Extensions/Extensions.php for slug-to-plugin-file resolution and packages/extensions/useInstallPlugin.js for client-side error and card-state handling. Use the reported REST errors to trace the install response, and add e2e coverage showing friendly failures and state reconciliation for each flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, javascript, php
Domain
api, backend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.