Skip to content

Commit 6a6f5a0

Browse files
committed
fix: Fix tests
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent a281da6 commit 6a6f5a0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.github/workflows/phpunit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
matrix:
3636
php-versions: ['8.2']
3737
databases: ['sqlite']
38-
server-versions: ['master', 'stable32', 'stable31', 'stable30']
38+
server-versions: ['master']
3939

4040
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
4141

lib/TaskProcessing/TextToImageProvider.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ public function process(?string $userId, array $input, callable $reportProgress,
8282
foreach ($urls as $url) {
8383
$imageResponse = $client->get($url);
8484
$image = $imageResponse->getBody();
85+
if ($image === null) {
86+
throw new \Exception('Response body is null');
87+
}
88+
if (is_resource($image)) {
89+
$image = stream_get_contents($image);
90+
if ($image === false) {
91+
throw new \Exception('stream_get_contents() failed');
92+
}
93+
}
94+
8595
$images[] = $includeWatermark ? $this->watermarkingService->markImage($image) : $image;
8696
}
8797

0 commit comments

Comments
 (0)