Title: Undefined variable: is_cron in ProcessController.php
Last modified: February 26, 2024

---

# Undefined variable: is_cron in ProcessController.php

 *  Resolved [Valdinia](https://wordpress.org/support/users/valdinia/)
 * (@valdinia)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/)
 * PHP Notice: Undefined variable: is_cron in /home/customer/www/mysite.com/public_html/
   wp-content/plugins/resmushit-image-optimizer/classes/Controller/ProcessController.
   php on line 42

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

 *  Plugin Support [Gerard Blanco](https://wordpress.org/support/users/sixaxis/)
 * (@sixaxis)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17455166)
 * Hi Valdinia,
 * Thank you for your message. We’re sorry to hear about this problem. 🙁
 * In order to help you troubleshoot this, it would be helpful if you could provide
   us with some additional information, including:
    - Screenshots or a screen recording showing the issue in action. If possible,
      please include relevant links as well.
    - Your site information. Please navigate to **Tools** > **Site Health** > **
      Info**, click on the “**Copy site info to clipboard**” button and paste the
      information in your reply.
    - Screenshots of your reSmush.it plugin settings.
    - Finally, when exactly is that message showing up? What action do you need 
      to do to reproduce the issue?
 * We look forward to working with you to resolve this.
 * Thank you!
 *  [wildewebmarketing](https://wordpress.org/support/users/wildewebmarketing/)
 * (@wildewebmarketing)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17456704)
 * I’m getting the same error, filling up my debug log fast, after updating to 1.0.0.
 * [27-Feb-2024 14:39:28 UTC] PHP Warning: Undefined variable $is_cron in /home/
   plugs/webapps/wp-content/plugins/resmushit-image-optimizer/classes/Controller/
   ProcessController.php on line 42
 *  Plugin Support [Gerard Blanco](https://wordpress.org/support/users/sixaxis/)
 * (@sixaxis)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17458631)
 * wildewebmarketing, I am unable to reproduce it on my test site. Could you please
   take a moment and send us some additional information?:
    - Screenshots or a screen recording showing the issue in action. If possible,
      please include relevant links as well.
    - Your site information. Please navigate to **Tools** > **Site Health** > **
      Info**, click on the “**Copy site info to clipboard**” button and paste the
      information in your reply.
    - Screenshots of your reSmush.it plugin settings.
    - Finally, when exactly is that message showing up? What action do you need 
      to do to reproduce the issue?
 * Thank you!
 *  [wildewebmarketing](https://wordpress.org/support/users/wildewebmarketing/)
 * (@wildewebmarketing)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17461387)
 * I gave you the exact error, which is multiplied repeatedly all day long in the
   debug log, every page view. I have multiple sites, the error is occurring on 
   75% of them. I tried to find a conflict, but even with all plugins disabled, 
   the error persists. No theme similarities. I’m not comfortable posting the site
   info here. I can email it if you need it. Settings are simple (90 quality, deactivate
   backup, activate statistics).
 * In addition, as it’s an undefined variable, using constants fixes the issue, 
   but I’d like to avoid having to change the code every time:
 * //Automatically optimize images if option is checked
   if(get_option(‘resmushit_on_upload’)
   OR ( isset($_POST[‘action’]) AND ($_POST[‘action’] === “resmushit_bulk_process_image”
   OR $_POST[‘action’] === “resmushit_optimize_single_attachment” )) OR (defined(‘
   WP_CLI’ ) && WP_CLI ) OR (defined(‘DOING_CRON’) && DOING_CRON) ){Log::addTemp(‘
   Gen Attachment metadta filter set’);add_filter(‘wp_generate_attachment_metadata’,
   array($this,’process_images’) );}}
 *  Plugin Support [Gerard Blanco](https://wordpress.org/support/users/sixaxis/)
 * (@sixaxis)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17461992)
 * Hello wildewebmarketing,
 * As mentioned before, we can not reproduce the problem, so unfortunately the exact
   error is not that useful and we need more information. Could you please send 
   an email to [help@shortpixel.com](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/help@shortpixel.com?output_format=md)
   with all the information we have requested so that we can help you further?
 * Thank you!
 *  [Gioxx](https://wordpress.org/support/users/gioxx/)
 * (@gioxx)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17472240)
 * I have the exact same problem that – even in my case – is constantly filling 
   up the php_error_log going for disk space unnecessarily.
 * I try to answer the questions about the need for information:
    - **Screenshots or a screen recording showing the issue in action. If possible,
      please include relevant links as well.**
      There is no screenshot. The problem
      is detected by going to look at the PHP-related error log, it gets bigger 
      and bigger and never stops getting bigger (fortunately the log rotate then
      intervenes to trim, compact and set aside the history unnecessarily overrun
      by this warning).
    - Your site information. Please navigate to **Tools** > **Site Health** > **
      Info**, click on the “**Copy site info to clipboard**” button and paste the
      information in your reply.
      [https://privatebin.cerbero.cc/?2df0ca0e4ccde26c#12nmhBB1pG4AWenfEJD2kDHUfS5BTPv4v5KTuEEhfoz5](https://privatebin.cerbero.cc/?2df0ca0e4ccde26c#12nmhBB1pG4AWenfEJD2kDHUfS5BTPv4v5KTuEEhfoz5)(
      password: resmush, content expires in one week)
    - **Screenshots of your reSmush.it plugin settings.**
 * ![](https://i0.wp.com/gxwarelabs.altervista.org/images/2024/03/04/Screenshot-
   2024-03-04-at-14-37-25-reSmush.it--WordPress.png?ssl=1)
    - **Finally, when exactly is that message showing up? What action do you need
      to do to reproduce the issue?**
      It has been happening since you updated the
      plugin to the latest version available (February 23, 2024).
 *  Plugin Author [Pedro](https://wordpress.org/support/users/petredobrescu/)
 * (@petredobrescu)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17472617)
 * Hello and thanks for reporting this!
 * Can you please test with the version below by installing it on top of version
   1.0.0 and let us know if you still get your logs filled up with that PHP Notice?
 * [https://shortpixel.com/downloads/resmushit-image-optimizer-1.0.1-DEV01.zip](https://shortpixel.com/downloads/resmushit-image-optimizer-1.0.1-DEV01.zip)
 * Thanks, I look forward to getting your feedback!
 *  [Gioxx](https://wordpress.org/support/users/gioxx/)
 * (@gioxx)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17472746)
 * Installed around 16:50 UTC+1, till now I am not detecting any additional warnings
   in the log file. _Bingo_! 🙂
 *  [lozula](https://wordpress.org/support/users/lozula/)
 * (@lozula)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17473020)
 * Same issue on all my sites with version 1.0.0, let me know when a fix is available.
 *  Plugin Author [Pedro](https://wordpress.org/support/users/petredobrescu/)
 * (@petredobrescu)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17493245)
 * Hello everyone,
 * Version 1.0.1 containing the fix for this issue has just been released.
 * Thanks for your patience with this!

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

The topic ‘Undefined variable: is_cron in ProcessController.php’ is closed to new
replies.

 * ![](https://ps.w.org/resmushit-image-optimizer/assets/icon-256x256.png?rev=3049668)
 * [reSmush.it : The original free image compressor and optimizer plugin](https://wordpress.org/plugins/resmushit-image-optimizer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/resmushit-image-optimizer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/resmushit-image-optimizer/)
 * [Active Topics](https://wordpress.org/support/plugin/resmushit-image-optimizer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/resmushit-image-optimizer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/resmushit-image-optimizer/reviews/)

## Tags

 * [undefined variable](https://wordpress.org/support/topic-tag/undefined-variable/)

 * 10 replies
 * 6 participants
 * Last reply from: [Pedro](https://wordpress.org/support/users/petredobrescu/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-is_cron-in-processcontroller-php/#post-17493245)
 * Status: resolved