Adminer version: 6.0.1
Compiled: single file
Driver: ClickHouse (bundled driver plugin plugins/drivers/clickhouse.php)
Database version: n/a — this fails before any connection is attempted
Plugins used: plugins/drivers/clickhouse.php from v6.0.1
The bundled ClickHouse driver plugin cannot be loaded into the compiled single-file release:
Fatal error: Declaration of Adminer\Driver::slowQuery(string $query, int $timeout)
must be compatible with Adminer\SqlDriver::slowQuery($G, $cl)
in clickhouse.php on line 210
Cause
The compile step removes scalar parameter type declarations from the base classes while keeping array. Comparing adminer/include/driver.inc.php with the compiled adminer-6.0.1.php:
Source SqlDriver |
Compiled SqlDriver |
slowQuery(string $query, int $timeout) |
slowQuery($G, $cl) |
update(string $table, array $set, string $queryWhere, int $limit = 0, string $separator = "\n") |
update($R, array $O, $Vi, $z = 0, $Lj = "\n") |
insert(string $table, array $set) |
insert($R, array $O) |
supportsAlterIndex(array $table_status): bool |
supportsAlterIndex(array $S) |
The driver plugins are distributed as uncompiled source and keep their scalar types. PHP does not allow a subclass to narrow parameter types, so Driver::slowQuery(string $query, int $timeout) can never extend SqlDriver::slowQuery($G, $cl).
plugins/drivers/clickhouse.php:210 is the only bundled driver where this occurs. plugins/drivers/simpledb.php:255 declares the same method untyped (slowQuery($query, $timeout)) and loads fine, which suggests the annotation was added inconsistently in 6.0 rather than deliberately. The Elasticsearch driver also declares a scalar-typed method (view(string $name): array) but does not hit this.
This is a regression in 6.0: the 5.5.1 ClickHouse driver had no slowQuery() override, so it loaded.
Reproduction
mkdir adminer-repro && cd adminer-repro
curl -fsSLO https://github.com/vrana/adminer/releases/download/v6.0.1/adminer-6.0.1.php
mv adminer-6.0.1.php adminer.php
curl -fsSLO https://raw.githubusercontent.com/vrana/adminer/v6.0.1/plugins/drivers/clickhouse.php
index.php:
<?php
function adminer_object() {
require_once 'clickhouse.php';
return new \Adminer\Plugins([]);
}
require('adminer.php');
Open http://localhost:8080/?clickhouse= — the fatal error appears immediately. Verified on PHP 8.4; no Docker image or custom compilation involved.
Expected
The bundled driver plugins should load into the compiled release, since that is the distribution most people run.
Possible fixes
- Remove the scalar parameter types from
plugins/drivers/clickhouse.php::slowQuery(), matching simpledb.php.
- Keep scalar parameter types in the compiled output.
- Apply the compile step to the bundled driver plugins so both sides are consistent.
Workaround
Strip scalar parameter types from the driver file before loading it:
sed -i -E '/^[[:space:]]*function /s/(string|int|bool|float) \$/$/g' clickhouse.php
Adminer version: 6.0.1
Compiled: single file
Driver: ClickHouse (bundled driver plugin
plugins/drivers/clickhouse.php)Database version: n/a — this fails before any connection is attempted
Plugins used:
plugins/drivers/clickhouse.phpfrom v6.0.1The bundled ClickHouse driver plugin cannot be loaded into the compiled single-file release:
Cause
The compile step removes scalar parameter type declarations from the base classes while keeping
array. Comparingadminer/include/driver.inc.phpwith the compiledadminer-6.0.1.php:SqlDriverSqlDriverslowQuery(string $query, int $timeout)slowQuery($G, $cl)update(string $table, array $set, string $queryWhere, int $limit = 0, string $separator = "\n")update($R, array $O, $Vi, $z = 0, $Lj = "\n")insert(string $table, array $set)insert($R, array $O)supportsAlterIndex(array $table_status): boolsupportsAlterIndex(array $S)The driver plugins are distributed as uncompiled source and keep their scalar types. PHP does not allow a subclass to narrow parameter types, so
Driver::slowQuery(string $query, int $timeout)can never extendSqlDriver::slowQuery($G, $cl).plugins/drivers/clickhouse.php:210is the only bundled driver where this occurs.plugins/drivers/simpledb.php:255declares the same method untyped (slowQuery($query, $timeout)) and loads fine, which suggests the annotation was added inconsistently in 6.0 rather than deliberately. The Elasticsearch driver also declares a scalar-typed method (view(string $name): array) but does not hit this.This is a regression in 6.0: the 5.5.1 ClickHouse driver had no
slowQuery()override, so it loaded.Reproduction
index.php:Open
http://localhost:8080/?clickhouse=— the fatal error appears immediately. Verified on PHP 8.4; no Docker image or custom compilation involved.Expected
The bundled driver plugins should load into the compiled release, since that is the distribution most people run.
Possible fixes
plugins/drivers/clickhouse.php::slowQuery(), matchingsimpledb.php.Workaround
Strip scalar parameter types from the driver file before loading it:
sed -i -E '/^[[:space:]]*function /s/(string|int|bool|float) \$/$/g' clickhouse.php