Title: Error code when ZIP is not downloaded
Last modified: March 27, 2025

---

# Error code when ZIP is not downloaded

 *  Resolved [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/error-code-when-zip-is-not-downloaded/)
 * Hi David,
 * I’ve received a good number of support requests saying that “they cannot update
   the add-on”, as a general error is displayed, saying that the ZIP is not valid.
 * I checked the cause of that, and in `Updraft_Manager_Plugin`, the `pinfo_download`
   method just `die`s if there is no valid license or the license has expired.
 * So on the website requesting to download the ZIP, this results in an empty file
   but with a valid header (200).
 * Is there any reason for not setting a different header, like is done in the other
   checks?
 * I’ve updated the class on my side to have a 403 or 402 error, which translates
   on the update screen as a more appropriate message:
 *     ```wp-block-code
       if (empty($entitlements) && !$this->downloadable_base_plugin) {    header($_SERVER['SERVER_PROTOCOL'] . ' 403 No valid license found', true, 403);    die;}if ('expired' === $entitlements && !$this->downloadable_base_plugin) {    header($_SERVER['SERVER_PROTOCOL'] . ' 402 License expired', true, 402);    die;		}
       ```
   
 * Error 402 gives this result in WP when trying to update:
 * ![](https://i0.wp.com/i.postimg.cc/jC0gJGBF/Screenshot-2025-03-27-at-15-01-24.
   png?ssl=1)
 * What do you think?
 * Marc

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/error-code-when-zip-is-not-downloaded/#post-18387121)
 * Hi Marc,
 * I can see it would be helpful to display a better message. I’ve seen plugins 
   that do this – but which then display their message for *all* plugins. It’s many
   years since I looked into it, but if I remember rightly, the existing hooks in
   WP didn’t make it easy.
 * Looks like “Payment Required” comes from `get_status_header_desc()` in `wp-includes/
   functions.php`. I think the most appropriate one generally would be 401 (Unauthorized),
   since that’s always true; whether payment is needed may depend upon different
   sites’ use cases. But “Unauthorized’ is not adding a lot of useful info to the
   user.
 * I’m happy to add a filter if you know you’d be happy just with a specific HTTP
   code in the response. Or maybe you have time to look at the client-side of things
   to see if there are better ways of providing a custom message than I found when
   I looked several years ago?
 * David
 *  Thread Starter [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/error-code-when-zip-is-not-downloaded/#post-18390993)
 * Hi David,
 * A filter would be great, and I would separate the “no entitlement” response from“
   entitlement expired” if possible (or have a way to send a different response.
 * I was looking at changing this on the client side, but I didn’t find anywhere
   to hook into, at least in the ZIP download request.
 * I’ve also noticed that somehow there is no “expired license” warning at all in
   the admin.
   I checked the `admin_menu` method of the updater class, where the 
   warning is supposed to be displayed. The data used never contains `x-spm-expiry`(
   or anything x-spm-* for that matter). I haven’t investigated more though, so 
   i’m not sure why that data is missing, even though it is present in the responses
   from the license server.
 * Marc
 *  Thread Starter [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/error-code-when-zip-is-not-downloaded/#post-18393979)
 * > I’ve also noticed that somehow there is no “expired license” warning at all
   > in the admin.
 * Ignore this part. I had just updated the upgrader class, but the data had not
   reflected yet. It looks like it is working again.
 *  Plugin Author [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/error-code-when-zip-is-not-downloaded/#post-18400140)
 * > It looks like it is working again.
 * Yes, sorry about that – towards the end of last year someone discovered that 
   the `x-spm-` headers weren’t getting passed along correctly.
 * > A filter would be great, and I would separate the “no entitlement” response
   > from “entitlement expired” if possible (or have a way to send a different response.
 * If you send me a patch (here in this thread is fine) I’m happy to include it (
   filters are harmless).
 *  Thread Starter [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/error-code-when-zip-is-not-downloaded/#post-18419247)
 * Hi David,
 * Here’s the Diff which:
    - adds a header before `die` ing, with default code of 401
    - adds a filter to potentially alter the response code
 *     ```wp-block-code
       --- a/classes/updraftmanager-plugin.php+++ b/classes/updraftmanager-plugin.php@@ -317,7 +317,14 @@ class Updraft_Manager_Plugin {                 // Find out what they are entitled to                $entitlements = $this->get_user_addon_entitlements($download_info['id'], $download_info['sid'], true);-               if ((empty($entitlements) || 'expired' === $entitlements) && !$this->downloadable_base_plugin) die;+               if ((empty($entitlements) || 'expired' === $entitlements) && !$this->downloadable_base_plugin) {+                       header(+                               $_SERVER['SERVER_PROTOCOL'] . ' No valid entitlement found',+                               true, +                               apply_filters('updraftmanager_no_entitlement_error_code', 401, $entitlements)+                       );+                       die;+               }                 $ent_keys = array();                if (is_array($entitlements)) {
       ```
   
 * Marc
    -  This reply was modified 1 year, 1 month ago by [Marc Lacroix](https://wordpress.org/support/users/marcusig/).
 *  Thread Starter [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/error-code-when-zip-is-not-downloaded/#post-18419775)
 * I can’t edit the above, but the code above doesn’t work. The code must be changed
   both in the first and last parameter:
 *     ```wp-block-code
       --- a/classes/updraftmanager-plugin.php+++ b/classes/updraftmanager-plugin.php@@ -317,7 +317,15 @@ class Updraft_Manager_Plugin {                 // Find out what they are entitled to                $entitlements = $this->get_user_addon_entitlements($download_info['id'], $download_info['sid'], true);-               if ((empty($entitlements) || 'expired' === $entitlements) && !$this->downloadable_base_plugin) die;+               if ((empty($entitlements) || 'expired' === $entitlements) && !$this->downloadable_base_plugin) {+                       $response_code = (int) apply_filters('updraftmanager_no_entitlement_error_code', 401, $entitlements);+                       header(+                               $_SERVER['SERVER_PROTOCOL'] . ' ' . $response_code . ' No valid license found', +                               true,+                               $response_code+                       );+                       die;+               }
       ```
   
 *  Plugin Author [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/error-code-when-zip-is-not-downloaded/#post-18420729)
 * Thanks Marc… I’ve added this to. Again, if you put that in your current install,
   the same filter will be there next time there’s an update release.
 * David

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Error code when ZIP is not downloaded’ is closed to new replies.

 * ![](https://ps.w.org/simba-plugin-updates-manager/assets/icon-256x256.png?rev
   =1110626)
 * [Simba Plugin Updates Manager](https://wordpress.org/plugins/simba-plugin-updates-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simba-plugin-updates-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simba-plugin-updates-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/simba-plugin-updates-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simba-plugin-updates-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simba-plugin-updates-manager/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * Last activity: [1 year, 1 month ago](https://wordpress.org/support/topic/error-code-when-zip-is-not-downloaded/#post-18420729)
 * Status: resolved