Skip to content

fix(core): omit TCP defaults for Unix-socket SQL config#209

Open
TDannhauer wants to merge 1 commit into
FRAMEWORK_6_0from
fix/dbservice-unix-omit-tcp-defaults
Open

fix(core): omit TCP defaults for Unix-socket SQL config#209
TDannhauer wants to merge 1 commit into
FRAMEWORK_6_0from
fix/dbservice-unix-omit-tcp-defaults

Conversation

@TDannhauer

Copy link
Copy Markdown
Contributor

Summary

  • Stop DbServiceFactory from injecting host=localhost / port=3306 when SQL protocol=unix.
  • Use phptype-aware TCP port defaults (5432 for pgsql, 3306 otherwise).
  • Extend unit coverage for unix-without-socket, explicit unix host/port, and pgsql TCP defaults.

Motivation

Follow-up to #198. That change preserved protocol/socket keys, but still always set TCP host/port defaults. PDO adapters strip protocol when building the DSN, so socket-based PostgreSQL deployments still attempted localhost:3306 and failed with connection refused.

This showed up after smartmobile login for non-admin users: the modern portal resolves SQL-backed Token / PermissionService via DbServiceFactory. Admins / legacy app entry points often avoided that path.

Changes

  • buildConnectionConfig(): for protocol=unix, only pass host/port when explicitly configured.
  • TCP path: default port 5432 for pgsql, 3306 otherwise.
  • Unit tests updated accordingly.

Test plan

  • vendor/bin/phpunit -c vendor/horde/core/phpunit.xml.dist --bootstrap vendor/autoload.php vendor/horde/core/test/Unit/Factory/DbServiceFactoryTest.php
  • Smartmobile login as a non-admin user on a Unix-socket PostgreSQL deployment reaches the portal without PDO localhost:3306 errors
  • TCP PostgreSQL and MySQL configs still connect with expected host/port defaults

Core#198 preserved protocol/socket keys but still injected
host=localhost and port=3306. PDO strips protocol from the DSN, so
socket PostgreSQL deployments still dial MySQL's port and fail
(e.g. smartmobile portal Token/PermissionService for non-admins).
@TDannhauer
TDannhauer requested a review from ralflang July 22, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant