Skip to content

Synchronous export path uses do_action_ref_array incorrectly with extra ignored argument #1015

Description

@superdav42

Bug

The synchronous export path in wu_exporter_export() uses do_action_ref_array() incorrectly:

do_action_ref_array(
    'wu_export_site',
    [
        'site_id' => $site_id,
        'options' => $options,
    ],
    'site-exporter'  // this 3rd arg is silently ignored
);

do_action_ref_array() only accepts 2 arguments: the hook name and an array of args. The third argument 'site-exporter' is silently ignored.

The handler handle_site_export() expects (int $site_id, array $options, string $hash):

add_action('wu_export_site', [$this, 'handle_site_export'], 10, 3);

While the array values are correctly unpacked as positional params, the $hash parameter is never passed in the synchronous path, so it defaults to ''. This means the export tries to delete a non-existent transient on line 1527:

wu_exporter_delete_transient("wu_pending_site_export_{$hash}");
// hash is '' — deletes "wu_pending_site_export_" which never exists

This is harmless but indicates confused API design — the synchronous path shouldn't be using the same handler as the async path.

Impact

Low — mostly code quality and potential for confusion. The extra do_action_ref_array argument and the empty hash transient deletion are both no-ops.

Suggested Fix

  1. Remove the extra 3rd argument from the do_action_ref_array() call
  2. Guard the transient deletion in handle_site_export() with if (!empty($hash))

Files to modify

  • EDIT: inc/functions/exporter.php:45-52 — remove extra argument
  • EDIT: inc/site-exporter/class-site-exporter.php:1527 — guard with !empty($hash)

Severity

Low — code quality issue, no functional impact.


aidevops.sh v3.13.11 plugin for OpenCode v1.3.17 with claude-opus-4-6 spent 9m and 19,115 tokens on this as a headless worker.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingorigin:workerAuto-created by pulse labelless backfill (t2112)status:in-progressWorker actively running

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions