Skip to content

Commit

Permalink
Exception mediaInfoContainer
Browse files Browse the repository at this point in the history
In a video, the following instruction generates an exception:

$mediaInfoContainer = $mediaInfo->getInfo($url);

The reason for this is that the Mode class receives an (empty) array as parameter.

This is the log:

Mhor\MediaInfo\Attribute\Mode::__construct(): Argument mhor#2 ($fullName) must be of type string, array given, called in /var/app/current/vendor/mhor/php-mediainfo/src/Checker/ModeChecker.php on line 22 {"userId":13,"exception":"[object] (TypeError(code: 0): Mhor\\MediaInfo\\Attribute\\Mode::__construct(): Argument mhor#2 ($fullName) must be of type string, array given, called in /var/app/current/vendor/mhor/php-mediainfo/src/Checker/ModeChecker.php on line 22 at /var/app/current/vendor/mhor/php-mediainfo/src/Attribute/Mode.php:25)
[stacktrace]
#0 /var/app/current/vendor/mhor/php-mediainfo/src/Checker/ModeChecker.php(22): Mhor\\MediaInfo\\Attribute\\Mode->__construct('    0', Array)
mhor#1 /var/app/current/vendor/mhor/php-mediainfo/src/Factory/AttributeFactory.php(27): Mhor\\MediaInfo\\Checker\\ModeChecker->create(Array)
mhor#2 /var/app/current/vendor/mhor/php-mediainfo/src/Builder/MediaInfoContainerBuilder.php(71): Mhor\\MediaInfo\\Factory\\AttributeFactory::create('writing_library', Array)
mhor#3 /var/app/current/vendor/mhor/php-mediainfo/src/Builder/MediaInfoContainerBuilder.php(53): Mhor\\MediaInfo\\Builder\\MediaInfoContainerBuilder->addAttributes(Object(Mhor\\MediaInfo\\Type\\Audio), Array)
mhor#4 /var/app/current/vendor/mhor/php-mediainfo/src/Parser/MediaInfoOutputParser.php(49): Mhor\\MediaInfo\\Builder\\MediaInfoContainerBuilder->addTrackType('Audio', Array)
mhor#5 /var/app/current/vendor/mhor/php-mediainfo/src/MediaInfo.php(44): Mhor\\MediaInfo\\Parser\\MediaInfoOutputParser->getMediaInfoContainer(false)
mhor#6 /var/app/current/app/Http/Controllers/Backend/MediaController.php(103): Mhor\\MediaInfo\\MediaInfo->getInfo('https://d3q5g9h...')
  • Loading branch information
padre committed Jun 10, 2022
1 parent 77ef4bb commit 3e86eca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Checker/ModeChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public function create($rateMode): \Mhor\MediaInfo\Attribute\Mode
$rateMode[1] = $rateMode[0];
}

return new Mode($rateMode[0], $rateMode[1]);
return new Mode(
is_array($rateMode[0]) ? implode(" ", $rateMode[0]) : $rateMode[0],
is_array($rateMode[1]) ? implode(" ", $rateMode[1]) : $rateMode[1]
);
}

/**
Expand Down

0 comments on commit 3e86eca

Please sign in to comment.