Bug found and resolved
-
Hello folks,
this is a bug report, as I couldnt find another place for this.
A few days ago one of my colleagues set a focus point on one of our images located on our homepage. Suddenly the whole site broke, and exited with a HTTP 500 response and with this error:
[02-Oct-2026 09:49:41 UTC] PHP Fatal error: Uncaught TypeError: number_format(): Argument #1 ($num) must be of type float, string given in wp-content/plugins/theia-smart-thumbnails/src/WeCodePixels/TheiaSmartThumbnails/Pro/ProPostOptions.php:108
Stack trace: 0 wp-content/plugins/theia-smart-thumbnails/src/WeCodePixels/TheiaSmartThumbnails/Pro/ProPostOptions.php(108): number_format() 1 wp-includes/class-wp-hook.php(353): WeCodePixels\TheiaSmartThumbnails\Pro\ProPostOptions::attachment_fields_to_edit() 2 wp-includes/plugin.php(206): WP_Hook->apply_filters() 3 wp-admin/includes/media.php(1955): apply_filters() 4 wp-includes/media.php(4885): get_compat_media_markup() 5 [internal function]: wp_prepare_attachment_for_js() 6 wp-admin/includes/ajax-actions.php(3126): array_map() 7 wp-includes/class-wp-hook.php(353): wp_ajax_query_attachments() 8 wp-includes/class-wp-hook.php(377): WP_Hook->apply_filters() 9 wp-includes/plugin.php(523): WP_Hook->do_action() 10 wp-admin/admin-ajax.php(192): do_action() 11 {main}
thrown in wp-content/plugins/theia-smart-thumbnails/src/WeCodePixels/TheiaSmartThumbnails/Pro/ProPostOptions.php on line 108I was able to arrange some debug outputs:
[02-Oct-2026 09:49:41 UTC] PHP Notice: UIM-DEBUG: focus_point[0] on Image-ID [theiaSmartThumbnails_picker_image_77109] on Post-ID [77109] with Preview-ID [theiaSmartThumbnails_picker_preview_77109] at Meta-POSITION [theiaSmartThumbnails_position] has VALUE [0] in wp-content/plugins/theia-smart-thumbnails/src/WeCodePixels/TheiaSmartThumbnails/Pro/ProPostOptions.php on line 89
[02-Oct-2026 09:49:41 UTC] PHP Notice: UIM-DEBUG: focus_point[1] on Image-ID [theiaSmartThumbnails_picker_image_77109] on Post-ID [77109] with Preview-ID [theiaSmartThumbnails_picker_preview_77109] at Meta-POSITION [theiaSmartThumbnails_position] has VALUE [.] in wp-content/plugins/theia-smart-thumbnails/src/WeCodePixels/TheiaSmartThumbnails/Pro/ProPostOptions.php on line 93So, the values of the x,y coordinates became “0” and “,”. I was able to quick fix the bug within two plugin files by casting the passed values to float:
// ~/wp-content/plugins/theia-smart-thumbnails/src/WeCodePixels/TheiaSmartThumbnails/Frontend.php (line 37+38):
'focusPointX' => round( (float) $focusPoint[0], 4 ),
'focusPointY' => round( (float) $focusPoint[1], 4 )This solved the issue, the website showed up again without any error. The backend media screen was broken too, I fixed it with these lines:
// ~/wp-content/plugins/theia-smart-thumbnails/src/WeCodePixels/TheiaSmartThumbnails/Pro/ProPostOptions.php (line 96+97):
x: ' . number_format( (float) $focus_point[0], 10 ) . ',
y: ' . number_format( (float) $focus_point[1], 10 ) . 'So far for my bug report, hope this helps. Versions:
WordPress: 7.1.2
Smush: 4.3.4
You must be logged in to reply to this topic.