Skip to content

wp plugin verify-checksums inconsistent output in JSON format #160

Closed as duplicate

Description

@koocotte

Bug Report

Describe the current, buggy behavior

wp plugin verify-checksums as documented in version 2.12.0 support a --format=json option (same problem with yaml, I did not test others formats)

When running, the output is not always JSON, and some of the output is done on STDERR:

Here are the ouput for success and fail:

$ wp plugin verify-checksums hello --format=json
On STDOUT: [{"plugin_name":"hello","file":"hello.php","message":"Checksum does not match"}]
On STDERR: Error: No plugins verified (1 failed).
Return code 1

$ wp plugin verify-checksums akismet --format=json
On STDOUT: Success: Verified 1 of 1 plugins.
Nothing on STDERR
return code 0

Describe what you would expect as the correct outcome

As the command run without error (it perform the test I asked), I expect nothing on STDERR, and I expect the result as JSON in both cases.

If the checksums are correct, I expect a JSON document with a key/value telling me if the plugin's checksums are OK or not. For example: {"plugin_name":"akismet","result":"OK"} (or an empty list that I can interpret as an empty of error, but it's less easy to work with)

If there is an error, I expect a list of errors, as it is currently. Or a list of errors as a child of the plugin.

For example

$ wp plugin verify-checksums --all --format=json
[
    {"plugin_name":"akismet","result":"OK"},
    {"plugin_name":"hello","result":"Failed", "errors": 
        [
            {"file":"hello.php","message":"Checksum does not match"}
        ]
    }
]

Let us know what environment you are running this on

OS:     Linux 6.1.0-52-amd64 wp-cli/builds#1 SMP PREEMPT_DYNAMIC Debian 6.1.180-1 (2026-08-03) x86_64
Shell:  /bin/bash
PHP binary:     /usr/bin/php8.2
PHP version:    8.2.33
php.ini used:   /etc/php/8.2/cli/php.ini
MySQL binary:   /usr/bin/mariadb
MySQL version:  mariadb  Ver 15.1 Distrib 10.11.18-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
SQL modes:
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       phar:///usr/bin/wp
WP-CLI packages dir:
WP-CLI cache dir:       /home/xxx/.wp-cli/cache
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.12.0

Provide a possible solution

Sorry, I do not have the skill to help you on code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions