Skip to content

Commit

Permalink
优化在 phar 模式下多个系统同时使用此组件时可能会造成的临时文件权限问题
Browse files Browse the repository at this point in the history
  • Loading branch information
qnnp committed Mar 28, 2024
1 parent 9270838 commit f5adb97
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/CaptchaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,12 @@ protected function getFontPath($font)
}

$tmpPath = sys_get_temp_dir() ?: '/tmp';
if (function_exists('runtime_path')) {
$tmpPath = runtime_path('tmp');
if (!is_dir($tmpPath)) {
mkdir($tmpPath, 0777, true);
}
}
$filePath = "$tmpPath/" . basename($font);
clearstatcache();
if (!isset($fontPathMap[$font]) || !is_file($filePath)) {
Expand Down

0 comments on commit f5adb97

Please sign in to comment.