Skip to content

Commit cbcf3b2

Browse files
is_readable error fix
1 parent a3042f7 commit cbcf3b2

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Capsule/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public static function permissions(string $path): int|false
395395
*/
396396
public static function isReadable(string $path): bool
397397
{
398-
return is_readable($path);
398+
return @is_readable($path);
399399
}
400400

401401
/**

src/ImageToText.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ private static function resolveInput(array $config): array
181181

182182
} elseif (is_string($config['source']) && $config['source'] !== '') {
183183
// Validate source file
184-
if (!is_readable($config['source'])) {
184+
if (!@is_readable($config['source'])) {
185185
throw new CustomException('Source image is not readable: ' . $config['source']);
186186
}
187187

@@ -255,7 +255,7 @@ private static function autoEngine(string $imagePath, array $config, array $temp
255255
*/
256256
private static function ocrspaceEngine(string $imagePath, string $language, string $apiKey): string
257257
{
258-
if (!is_readable($imagePath)) {
258+
if (!@is_readable($imagePath)) {
259259
throw new CustomException('OCR input not readable.');
260260
}
261261

src/NameToImage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ private static function sanitizeFilename(string $name): string
352352
private static function resolveFontPath(?string $path, string $weight = 'bold'): ?string
353353
{
354354
// If user provided a readable path, use it as-is regardless of weight
355-
if (is_string($path) && $path !== '' && is_readable($path)) {
355+
if (is_string($path) && $path !== '' && @is_readable($path)) {
356356
return $path;
357357
}
358358

@@ -386,7 +386,7 @@ private static function resolveFontPath(?string $path, string $weight = 'bold'):
386386
: array_merge($winFontsBold, $unixFontsBold, $winFontsRegular, $unixFontsRegular);
387387

388388
foreach ($ordered as $cand) {
389-
if (is_readable($cand)) {
389+
if (@is_readable($cand)) {
390390
return $cand;
391391
}
392392
}

0 commit comments

Comments
 (0)