Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5527

ramblurr on "[Plugin: Duplicator] [bug report] installer.php not properly parsing host and port"

$
0
0

In an instance where the DB host is running on a non-standard port, and when you want to set the port after exporting the built package, Duplicator isn't properly parsing the HOST:PORT string in installer.php.

In the host field I type: 10.1.0.2:3307

Then Test Connection fails with:

Using Connection String:
Server=10.7.0.2:3307; Database=wp_dbname; Uid=dbuser; Pwd=password; Port=3307

Notice the port in the server string: Server=10.7.0.2:3307

The offending code is at ~line 150 in installer.php:

//SHARED POST PARMS
...
$_POST['dbhost']	= isset($_POST['dbhost']) ? trim($_POST['dbhost']) : null;
...
$_POST['dbport']	= isset($_POST['dbhost'])	  ? parse_url($_POST['dbhost'], PHP_URL_PORT) : 3306;
$_POST['dbport']    = (! empty($_POST['dbport'])) ? $_POST['dbport'] : 3306;
...

That first line should use parse_url($_POST['dbhost'], PHP_URL_HOST)
to parse the HOST's url. Of course just blindly adding that will break the port parsing.

So I'd parse the port first, then parse the host, using parse_url.

Duplicator version: 0.5.16

https://wordpress.org/plugins/duplicator/


Viewing all articles
Browse latest Browse all 5527

Trending Articles