friends-of-reactphp / mysql

Async MySQL database client for ReactPHP.
MIT License
334 stars 66 forks source link

cant use database containing question mark in the password! #152

Closed amir-khoshbakht closed 2 years ago

amir-khoshbakht commented 2 years ago

React\MySQL\Factory:166 is trying parse the given URL but it doesn't allow to use database with question mark in password. and in this case it will throw : 'Invalid MySQL URI given (EINVAL)'

amir-khoshbakht commented 2 years ago

example address : mysql://test_user:11111????1111@127.0.0.1/test_database?charset=utf8mb4 it works with PDO

amir-khoshbakht commented 2 years ago

it seems the documentation explicitly described this situation :

Note that both the username and password must be URL-encoded (percent-encoded) if they contain special characters:

$user = 'he:llo';
$pass = 'p@ss';

$promise = $factory->createConnection(
    rawurlencode($user) . ':' . rawurlencode($pass) . '@localhost:3306/db'
);
clue commented 2 years ago

@my-random-username Glad to see you've solved this already! And thanks for reporting back, I'm sure this may also help others :+1: