• Hi,

    I have a cron job where I import a remote image and do some processing on it. The job adds the intermediate_image_sizes filter to return an empty sizes array, so as to bypass any processing/scaling by wordpress media or your (wonderful!) plugin.

    add_filter( 'intermediate_image_sizes', function( $sizes ) {
    	return [];
    });

    During the job a couple of warnings are thrown by the plugin. They seem to be related to the empty array returned by the filter translating to a bool value.

    Warning: Trying to access array offset on value of type bool in /wp-content/plugins/image-regenerate-select-crop/image-regenerate-select-crop.php on line 3076

    Warning: foreach() argument must be of type array|object, bool given in /wp-content/plugins/image-regenerate-select-crop/image-regenerate-select-crop.php on line 582

    These are quiet warnings in the log. The job completes successfully, following which the defined image sizes are restored and the plugin and wordpress media work normally. There is no problem at my end. I’m just bringing this to your attention in case it’s something you would want to look at.

    All the best.

Viewing 1 replies (of 1 total)
  • Plugin Author Iulia Cazan

    (@iulia-cazan)

    Hi,

    Thanks for the heads-up! I will add some additional checks in the next release, in order to avoid these warnings.

    Regards,
    Iulia

Viewing 1 replies (of 1 total)
  • The topic ‘Warnings thrown during custom cron job’ is closed to new replies.