Skip to content

Commit c464f5c

Browse files
committed
Add class_exists check for FFmpeg VideoInfo class
Fix: Fatal error when FFmpeg addon is installed but class not loaded - Check if FFmpeg addon is available (isAvailable) - Check if VideoInfo class exists (class_exists) - Prevents fatal error if addon is in wrong state - Gracefully returns null if FFmpeg not ready Error was: Class FriendsOfRedaxo\FFmpeg\VideoInfo not found
1 parent 087b72f commit c464f5c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/BackendIntegration.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,16 @@ private static function renderFFmpegInfo(string $filename): ?string
6565
return null;
6666
}
6767

68+
// Check if FFmpeg VideoInfo class exists
69+
if (!class_exists('\FriendsOfRedaxo\FFmpeg\VideoInfo')) {
70+
return null;
71+
}
72+
6873
if (PlatformDetector::isAudio($filename)) {
6974
return null;
7075
}
7176

7277
try {
73-
/** @phpstan-ignore undefinedClass */
7478
$videoInfo = \FriendsOfRedaxo\FFmpeg\VideoInfo::getBasicInfo($filename);
7579

7680
if (!$videoInfo) {

0 commit comments

Comments
 (0)