Skip to content

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

Description

@jasonbahl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: medLess than a weekimpact: medMinor performance improvements, fix broad user base issuesneeds: reproductionThis issue needs to be reproduced independentlyscope: extensionsIntegrating plugins, add-ons, or other extensionstype: bugIssue that causes incorrect or unexpected behavior

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions