1
0
mirror of https://github.com/phpmyadmin/phpmyadmin.git synced 2026-10-23 18:29:15 +03:00

Fix #19841 - Strip port from host when linking to user privileges in processes list

The Host column of SHOW PROCESSLIST contains the client connection address
in "hostname:port" format (e.g., localhost:64776). Passing this directly as
the hostname URL parameter to /server/privileges causes the user lookup to
fail, since mysql.user.Host stores bare hostnames without port numbers.

Strip the trailing port suffix before building the privileges link URL.
The Host column display is unchanged.

Signed-off-by: Dennis Vorobyov <roadhero@gmail.com>
This commit is contained in:
Dennis Vorobyov
2026-05-24 16:30:40 +01:00
parent 0c4a294f0e
commit 366d165982
2 changed files with 3 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ use function array_keys;
use function count;
use function mb_strtolower;
use function number_format;
use function preg_replace;
use function strlen;
use function ucfirst;
@@ -93,6 +94,7 @@ final class Processes
'id' => $process['Id'],
'user' => $process['User'],
'host' => $process['Host'],
'user_host' => preg_replace('/:\d+$/', '', $process['Host'] ?? ''),
'db' => ! isset($process['Db']) || strlen($process['Db']) === 0 ? '' : $process['Db'],
'command' => $process['Command'],
'time' => $process['Time'],

View File

@@ -49,7 +49,7 @@
{% if row.user not in ['system user', 'event_scheduler', 'unauthenticated user'] %}
<a href="{{ url('/server/privileges', {
'username': row.user,
'hostname': row.host,
'hostname': row.user_host,
'dbname': row.db,
'tablename': '',
'routinename': '',