Skip to content

Licensing: an "inactive" license status falls through to the generic unknown-error message #1728

Description

@jakejackson1

An EDD inactive license status has no handler anywhere in the licensing code, so it falls through to the generic "An unknown error occurred while checking the license." message.

site_inactive is handled; inactive is not. They are different conditions — site_inactive means "the key is valid but not activated for this domain", inactive means the license record itself is not active — so the existing site_inactive wording ("does not match your current domain … please resave the settings") would be actively misleading if reused.

Where

Helper_Data::addon_license_responses() has no inactive key:

https://github.com/GravityPDF/gravity-pdf/blob/development/src/Helper/Helper_Data.php#L190

Helper_Abstract_Addon::update_license_status_from_response() takes the status straight off the response and looks it up in that table, falling back to generic:

$status = 'error';
if ( ! empty( $license_data->error ) ) {
    $status = $license_data->error;
} elseif ( ! empty( $license_data->license ) ) {
    $status = $license_data->license;
}

$license_info = [
    'license' => $license_key,
    'status'  => $status,
    'message' => $possible_responses[ $status ] ?? $possible_responses['generic'],
];

schedule_license_check() sends edd_action=check_license and hands anything that isn't valid to that method, so the status reaches the table verbatim.

Second, smaller consequence

EDD_SL_Plugin_Updater::UNENTITLED_LICENSE_STATUSES omits inactive too:

https://github.com/GravityPDF/gravity-pdf/blob/development/src/Helper/Licensing/EDD_SL_Plugin_Updater.php#L46

A site can only promote a package to the network cache while is_license_active() (active/valid), so the only reachable case is a site that promoted while valid and later went inactive. Its package then lingers until NETWORK_CACHE_TTL (3 days) rather than being withdrawn on the next check. Minor and self-healing, but it is the same omission.

Suggested fix

  1. Add an inactive entry to addon_license_responses() with its own wording — something on the lines of "This license key is not active. Please check your account or contact support." rather than reusing the site_inactive string.
  2. Add 'inactive' to UNENTITLED_LICENSE_STATUSES.
  3. Add [ 'inactive' ] to providerUnentitledLicenseStatus() in tests/phpunit/integration/Helper/Licensing/Test_EDD_SL_Plugin_Updater.php.

Confidence

The absence of handling is confirmed by reading the source — there is no inactive license-status branch anywhere in src/ (the other 'inactive' hits are the PDF active/inactive toggle and the plugin-active check, unrelated).

What is worth confirming before fixing is reachability: this rests on EDD Software Licensing returning license => inactive from check_license for a license whose record is inactive, which is in its documented response set but which I could not verify against the actual store. If the store never emits it, this reduces to dead-code tidying and can be closed.

Provenance

Found while auditing Image Hopper's port of the 6.16.0 licensing work (34473c0a) back against this repo. Image Hopper handles inactive alongside site_inactive in its own error table and had added it to its copy of UNENTITLED_LICENSE_STATUSES; that addition has since been reverted there to keep the vendored updater diffable against this one, on the basis that the status belongs in both or neither.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions