Skip to content

Commit

Permalink
Merge pull request #2 from qnnp-me/master
Browse files Browse the repository at this point in the history
优化在 phar 模式下多个系统同时使用此组件时可能会造成的临时文件权限问题
  • Loading branch information
walkor authored Mar 28, 2024
2 parents 00ea475 + f5adb97 commit e80f271
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 e80f271

Please sign in to comment.