[6.x] Fix Glide throwing when proc_open is disabled - #15334
Merged
Conversation
generateByAsset() checked ffmpeg availability before checking if the asset was a video, so every image request (not just videos) triggered ffmpeg detection via Symfony Process. On hosts with proc_open disabled this threw a LogicException instead of just serving the image. Also makes Ffmpeg binary resolution fail gracefully when proc_open is unavailable, so video assets fall back to the file icon instead of throwing.
The proc_open guard only covered ffmpeg auto-discovery, not an explicitly configured statamic.assets.ffmpeg.binary. With a configured binary and proc_open disabled, available() still reported true and extractThumbnail() threw when it shelled out to run ffmpeg.
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 of the Problem
#15291 fixed video thumbnails showing as broken images when ffmpeg isn't installed, but introduced a regression on hosts where
proc_openis disabled.ImageGenerator::generateByAsset()checkedThumbnailExtractor::available() && $asset->isVideo(), and PHP evaluates conditions left to right — so ffmpeg detection (which shells out via Symfony Process) ran for every image request, not just videos. Withproc_opendisabled, that threw aLogicExceptionand broke all Glide requests, including plain JPEGs.Reported in #15291 (comment).
What this PR Does
$asset->isVideo() && ThumbnailExtractor::available()so non-video assets never trigger ffmpeg detectionFfmpeg::resolveFfmpegBinary()bail out gracefully whenproc_openis unavailable, so even video assets fall back to the file icon instead of throwing