[3.0] Stop logging a warning for every attachment that is not a JPEG - #9480
Merged
live627 merged 1 commit intoAug 11, 2026
Merged
Conversation
createThumbnail() asks exif_thumbnail() whether the image already carries an embedded thumbnail. That function emits a warning for every format that cannot hold one, so uploading a PNG - or a GIF, or a WebP - wrote a row to the error log, at 2: exif_thumbnail(...): File not supported. The constructor already answered the same question into $embedded_thumb, and checkForEmbeddedThumb() silences its own call for exactly this reason. Read the property instead of asking twice. Signed-off-by: Mathias Papenbrock <mathiaspapealbert@hotmail.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Attaching a PNG to a post writes a row to
smf_log_errors:Image::createThumbnail()callsexif_thumbnail($this->source)to find out whether the image already has an embedded thumbnail. Only JPEG and TIFF can carry one; for every other format the function raisesE_WARNINGand returnsfalse, and SMF's error handler logs it. So every PNG, GIF or WebP attachment - and every avatar - leaves a warning behind for a completely ordinary upload.The constructor already answered this question:
checkForEmbeddedThumb()runs on load and sets$this->embedded_thumb, and it suppresses its ownexif_read_data()call for precisely this reason. Reading the property removes the warning and a redundant second read of the file.How to test
Attach a PNG to a post. Before: one
generalrow per upload insmf_log_errors. After: none, and the thumbnail is still generated (smf_attachmentsgets itsattachment_type = 3row and the post shows a clickable thumb).Issues References (Fixes|Related|Closes)
Found while sweeping the topic display for the #7933 split.