cakephp / cakephp/phinx

Cannot use DSN with URL-encoded password

Open
#2,421 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
4.5k
Forks
884
PR merge metrics
No merged PRs in 30d

Description

Phinx supports passing connection options via dsn.

However, an URL-encoded password is passed through as is which lets the connection fail.

However, skipping the encoding would lead to ambiguous or broken DSN, e.g. if the password contains @:

mysql://root:p@ssword@localhost:3306/mydb?charset=utf8

Correct would be:

mysql://root:p%40ssword@localhost:3306/mydb?charset=utf8

In this case Phinx would literally use the password p%40ssword instead of p@ssword for the DB connection.

See e.g. the Doctrine DBAL DsnParser which properly URL decodes all URL parts.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no Phinx file or test; start by locating the DSN configuration and database-connection parsing entry points. Compare their URL-part handling with Doctrine DBAL's DsnParser, linked in the issue, and verify that an encoded password such as p%40ssword reaches the connection as p@ssword without making an unencoded DSN ambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.