Commit 33844aa5 authored by platyhouse's avatar platyhouse

# PHP 5.6 호환성 개선

## ptyLibrary_PHP/mysql/ptyMysqlConfig.php

### 배열 리터럴 문법 수정
- `[]` 문법을 `array()`로 변경하여 PHP 5.6 이하 버전 호환성 확보
- `getSections()`, `load()`, `connect()` 메서드의 배열 반환문 수정

### null 병합 연산자 대체
- `??` 연산자를 `isset()` 삼항 연산자로 변경
- username, database, charset 필드의 기본값 처리 로직 수정
parent 5c4a6ff2
......@@ -34,11 +34,11 @@ class ptyMysqlConfig
$configPath = self::getConfigPath();
if (!file_exists($configPath)) {
return [];
return array();
}
$config = parse_ini_file($configPath, true);
return $config ? array_keys($config) : [];
return $config ? array_keys($config) : array();
}
/**
......@@ -74,13 +74,13 @@ class ptyMysqlConfig
throw new \Exception("MySQL 설정 [{$section}] 섹션에 필수 필드 'host'가 없습니다.");
}
return [
return array(
'host' => $sectionConfig['host'],
'username' => $sectionConfig['username'] ?? 'root',
'username' => isset($sectionConfig['username']) ? $sectionConfig['username'] : 'root',
'password' => isset($sectionConfig['password']) ? trim($sectionConfig['password'], '"\'') : null,
'database' => $sectionConfig['database'] ?? null,
'charset' => $sectionConfig['charset'] ?? 'utf8mb4',
];
'database' => isset($sectionConfig['database']) ? $sectionConfig['database'] : null,
'charset' => isset($sectionConfig['charset']) ? $sectionConfig['charset'] : 'utf8mb4',
);
}
/**
......@@ -109,10 +109,10 @@ class ptyMysqlConfig
mysqli_set_charset($connection, $config['charset']);
}
return [
return array(
'connection' => $connection,
'config' => $config,
];
);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment