• Resolved ramblurr

    (@ramblurr)


    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 2 replies - 1 through 2 (of 2 total)
  • Hey Ramblurr,

    Thanks for the feedback! I’ll try and have a look at this soon, probably won’t make the next release but it should be in one of the up and coming releases…

    Cheers~

    Hey Ramblurr,

    This has been updated in the developer line. There is an interesting issue with mysqli_connect. In some PHP versions the $host param will except the port as part of the host i.e. “localhost:55” in other versions only the $port parameter works. So for the fix I added a specific port field to support both methods. Can you let me know if this works for you?

    If you can give the developer version a try it may have your fixes for the issue your seeing. The very latest version (0.5.19) can be found by following these instructions:

    -> Browse to http://wordpress.org/extend/plugins/duplicator/developers/
    -> Look for the section “Other Versions”
    -> Click on “Development Version” and download the zip plugin file
    -> Uninstall your current version and install this one

    Let me know if this solves your issue…

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[bug report] installer.php not properly parsing host and port’ is closed to new replies.