Closed remyperona closed 7 months ago
@Tabrisrp Thanks for the PR, please find exploratory test notes below (WIP)
[x] Warning after uploading images with a fresh install of Imagify and optimization, it keeps loading 1- fresh install and activate of Imagify 2- upload image => see the warning
[x] Fatal error when uploading image/ optimize image while filter is used 1- fresh install/activation of Imagify 2- Enable the Next-Gen filter
add_filter('imagify_nextgen_images_formats', function($formats){
$formats['webp'] = 'webp';
return $formats ;
});
3- upload an image or click optimize for a previously uploaded image
[18-Apr-2024 07:27:09 UTC] PHP Fatal error: Uncaught TypeError: Imagify\Optimization\Process\AbstractProcess::get_suffix_from_format(): Argument #1 ($format) must be of type string, null given, called in /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/classes/Optimization/Process/AbstractProcess.php on line 1554 and defined in /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/classes/Optimization/Process/AbstractProcess.php:1570
Stack trace:
#0 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/classes/Optimization/Process/AbstractProcess.php(1554): Imagify\Optimization\Process\AbstractProcess->get_suffix_from_format()
#1 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/classes/Optimization/Process/AbstractProcess.php(500): Imagify\Optimization\Process\AbstractProcess->is_size_next_gen()
#2 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/classes/Job/MediaOptimization.php(181): Imagify\Optimization\Process\AbstractProcess->optimize_size()
#3 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/classes/Job/MediaOptimization.php(66): Imagify\Job\MediaOptimization->task_optimize()
#4 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/inc/classes/Dependencies/deliciousbrains/wp-background-processing/classes/wp-background-process.php(516): Imagify\Job\MediaOptimization->task()
#5 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/inc/classes/Dependencies/deliciousbrains/wp-background-processing/classes/wp-background-process.php(333): Imagify_WP_Background_Process->handle()
#6 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(324): Imagify_WP_Background_Process->maybe_handle()
#7 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#8 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/plugin.php(517): WP_Hook->do_action()
#9 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-admin/admin-ajax.php(192): do_action()
#10 {main}
thrown in /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/classes/Optimization/Process/AbstractProcess.php on line 1570
[18-Apr-2024 08:20:03 UTC] PHP Deprecated: strpos(): Passing null to parameter #2 ($needle) of type string is deprecated in /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/classes/Bulk/WP.php on line 194
[18-Apr-2024 08:20:03 UTC] PHP Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/classes/Bulk/WP.php on line 208
[18-Apr-2024 08:20:03 UTC] PHP Fatal error: Uncaught Error: Undefined constant Imagify\Optimization\Process\WP::_SUFFIX in /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/classes/Bulk/WP.php:208
Stack trace:
#0 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/classes/Bulk/WP.php(208): constant()
#1 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/classes/Bulk/Bulk.php(237): Imagify\Bulk\WP->get_optimized_media_ids_without_format()
#2 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/classes/Bulk/Bulk.php(606): Imagify\Bulk\Bulk->run_generate_nextgen()
#3 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(326): Imagify\Bulk\Bulk->maybe_generate_missing_nextgen()
#4 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#5 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/plugin.php(517): WP_Hook->do_action()
#6 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/option.php(889): do_action()
#7 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/inc/classes/class-imagify-abstract-options.php(372): update_option()
#8 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/inc/classes/class-imagify-abstract-options.php(231): Imagify_Abstract_Options->set_raw()
#9 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/inc/admin/upgrader.php(318): Imagify_Abstract_Options->set()
#10 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(324): _imagify_new_upgrade()
#11 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#12 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/plugin.php(517): WP_Hook->do_action()
#13 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/inc/admin/upgrader.php(69): do_action()
#14 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(324): _imagify_upgrader()
#15 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#16 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-includes/plugin.php(517): WP_Hook->do_action()
#17 /var/www/mai.rocketlabsqa.ovh/htdocs/wp-admin/admin-ajax.php(45): do_action()
#18 {main}
thrown in /var/www/mai.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify/classes/Bulk/WP.php on line 208
Note: the same fatal error occurred if we enabled avif and save settings after a fresh install of 2.2.2
Description
Add a new UI setting option to select the next-gen format to generate, or disable it.
Fixes #875
Checklists
Feature validation
Code style
Observability