스킨 목록 옵션 생성 시 디렉토리 열기 실패 처리 보강

get_list_skin_options()에서 존재하지 않는 스킨 경로가 지정된 경우
opendir() 반환값을 그대로 readdir()에 넘겨 PHP 8 이상에서 스크립트가
중단되던 문제를 수정한다. 아울러 결과 배열을 미리 초기화하여 패턴에
일치하는 스킨 파일이 하나도 없을 때 sort()에서 중단되던 경로도 함께
처리하고, readdir() 종료 조건을 명시적으로 비교하도록 변경한다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 4010d29295001c43b6ccd7b4e6414d0adfcc7b2e)
This commit is contained in:
thisgun committed 2026-08-24 07:44:22 +00:00
1 parent 96df43480b
commit 04a4de4923
1 file changed
+8 -6
+8 -6
View File
@@ -1354,14 +1354,16 @@ function get_list_skin_options($pattern, $dirname='./', $sval='')
{
$str = '<option value="">선택</option>'.PHP_EOL;
unset($arr);
$handle = opendir($dirname);
while ($file = readdir($handle)) {
if (preg_match("/$pattern/", $file, $matches)) {
$arr[] = $matches[0];
$arr = array();
$handle = @opendir($dirname);
if ($handle !== false) {
while (false !== ($file = readdir($handle))) {
if (preg_match("/$pattern/", $file, $matches)) {
$arr[] = $matches[0];
}
}
closedir($handle);
}
closedir($handle);
sort($arr);
foreach($arr as $value) {