Skip to content

Commit 3bb779e

Browse files
committed
4.0.2 For PHP 8
Fix Bug PHP message: PHP Fatal error: Uncaught Error: Cannot instantiate abstract class sinri\ark\database\pdo\ArkPDOConfig in /app/Gibeah/vendor/sinri/ark/src/TheArk.php:172 Stack trace: #0 /app/Gibeah/src/mysql/AssetModel.php(39): sinri\ark\TheArk->pdo() #1 /app/Gibeah/vendor/sinri/ark-pdo/src/model/query/ArkDatabaseSelectTableQuery.php(578): sinri\gibeah\mysql\AssetModel->db() #2 /app/Gibeah/vendor/sinri/ark-pdo/src/model/ArkDatabaseSQLReaderTrait.php(32): sinri\ark\database\model\query\ArkDatabaseSelectTableQuery->getTargetPDO() #3 /app/Gibeah/src/mysql/AssetModel.php(287): sinri\ark\database\model\query\ArkDatabaseSelectTableQuery->queryForRows() #4 /app/Gibeah/src/web/controller/GibeahStoreViewer.php(112): sinri\gibeah\mysql\AssetModel->searchFetchedAssets() #5 [internal function]: sinri\gibeah\web\controller\GibeahStoreViewer->listAssetsInFishFarm() #6 /app/Gibeah/vendor/sinri/ark-web/src/web/ArkRouterRule.php(346): call_user_func_array()
1 parent b4d1448 commit 3bb779e

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

composer.lock

Lines changed: 17 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/TheArk.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
namespace sinri\ark;
1010

1111

12-
use http\Exception\RuntimeException;
1312
use Psr\Log\LogLevel;
13+
use RuntimeException;
1414
use sinri\ark\cache\ArkCache;
1515
use sinri\ark\cache\implement\ArkDummyCache;
1616
use sinri\ark\cache\implement\ArkFileCache;
1717
use sinri\ark\core\ArkHelper;
1818
use sinri\ark\core\ArkLogger;
1919
use sinri\ark\database\pdo\ArkPDO;
2020
use sinri\ark\database\pdo\ArkPDOConfig;
21+
use sinri\ark\database\pdo\engine\ArkPDOConfigForMySQL;
22+
use sinri\ark\database\pdo\engine\ArkPDOConfigForSqlite;
2123
use sinri\ark\io\ArkWebInput;
2224
use sinri\ark\io\ArkWebOutput;
2325
use sinri\ark\web\ArkWebService;
@@ -169,7 +171,14 @@ public function pdo(string $name = 'default', bool $shouldConnectFirst = true):
169171
if ($dbConfigDict === null) {
170172
$pdo = new ArkPDO();
171173
} else {
172-
$pdoConfig = new ArkPDOConfig($dbConfigDict);
174+
if ($dbConfigDict[ArkPDOConfig::CONFIG_ENGINE] === ArkPDOConfigForMySQL::ENGINE) {
175+
$pdoConfig = new ArkPDOConfigForMySQL($dbConfigDict);
176+
} elseif ($dbConfigDict[ArkPDOConfig::CONFIG_ENGINE] === ArkPDOConfigForSqlite::ENGINE) {
177+
$pdoConfig = new ArkPDOConfigForSqlite($dbConfigDict);
178+
} else {
179+
throw new RuntimeException("Unsupported PDO engine");
180+
}
181+
173182
$pdo = new ArkPDO($pdoConfig);
174183
if ($shouldConnectFirst) $pdo->connect();
175184
}

0 commit comments

Comments
 (0)