From 04a4de4923b99066b157febb15137fb15ab345e2 Mon Sep 17 00:00:00 2001 From: thisgun Date: Mon, 10 Aug 2026 03:11:34 +0000 Subject: [PATCH] =?UTF-8?q?=EC=8A=A4=ED=82=A8=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EC=98=B5=EC=85=98=20=EC=83=9D=EC=84=B1=20=EC=8B=9C=20=EB=94=94?= =?UTF-8?q?=EB=A0=89=ED=86=A0=EB=A6=AC=20=EC=97=B4=EA=B8=B0=20=EC=8B=A4?= =?UTF-8?q?=ED=8C=A8=20=EC=B2=98=EB=A6=AC=20=EB=B3=B4=EA=B0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit get_list_skin_options()에서 존재하지 않는 스킨 경로가 지정된 경우 opendir() 반환값을 그대로 readdir()에 넘겨 PHP 8 이상에서 스크립트가 중단되던 문제를 수정한다. 아울러 결과 배열을 미리 초기화하여 패턴에 일치하는 스킨 파일이 하나도 없을 때 sort()에서 중단되던 경로도 함께 처리하고, readdir() 종료 조건을 명시적으로 비교하도록 변경한다. Co-Authored-By: Claude Opus 5 (1M context) (cherry picked from commit 4010d29295001c43b6ccd7b4e6414d0adfcc7b2e) --- lib/shop.lib.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/shop.lib.php b/lib/shop.lib.php index cdb7538a7..eb11e4b15 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -1354,14 +1354,16 @@ function get_list_skin_options($pattern, $dirname='./', $sval='') { $str = ''.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) {