Skip to content

Commit 3b2b613

Browse files
authored
Merge pull request #1 from davemednick/MAD-15428_fix_dsn_processing_for_influxdb
[MAD-15428] Fix DSN processing for influxdbs that use http and port 8086
2 parents 61581e3 + b00361b commit 3b2b613

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/InfluxDB/Client.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,16 @@ public function listUsers()
269269
*/
270270
public static function fromDSN($dsn, $timeout = 0, $verifySSL = false, $connectTimeout = 0)
271271
{
272-
$connParams = parse_url($dsn);
272+
273+
$encodedUrl = preg_replace_callback(
274+
'/:\/\/([^:@]+):([^@]+)@/',
275+
function ($matches) {
276+
return '://' . urlencode($matches[1]) . ':' . urlencode($matches[2]) . '@';
277+
},
278+
$dsn
279+
);
280+
281+
$connParams = parse_url($encodedUrl);
273282

274283
if ($connParams === false) {
275284
throw new ClientException('Unable to parse the InfluxDB DSN');

0 commit comments

Comments
 (0)