Menu

#4478 (ok 4.2.6) Server validation does not work while in setup/mysqli

4.2.5
fixed
None
1
2014-07-18
2014-06-27
No

PMA 4.1.14.1, PHP 5.3.28:
- run setup/index.php,
- create a new server with the following parameters: Connection type: tcp, PHP extension to use: mysqli, Server port: 3306 (or any other value which your MySQL server is listening to, this value cannot be left blank),
- click Apply,
- click Edit link, on the server list, next to a recently appended server,
- ,,Could not connect to MySQL server - mysqli_connect() expects parameter 5 to be long, string given'' message appears.

This bug appears to be born with PMA 3.x (when server validation was added to the setup script) and stills until PMA 4.2.5. It occurs in test_db_connection() at setup/lib/validate.lib.php (3.x), and in test_db_connection() at libraries/config/validate.lib.php (4.0.x), and in PMA_Validator::testDBConnection() at libraries/config/Validator.class.php (4.1.x, 4.2.x).

In these functions $port value is constructed as a string of the form: ":XXXX", where XXXX is the actual port number. Ad hoc solution:

in mentioned above functions/files change:

$conn = @mysqli_connect($host, $user, $pass, null, $port, $socket);

to:

$conn = @mysqli_connect($host, $user, $pass, null, $port ? (int)substr($port, 1) : null, $socket);

Discussion

  • Marc Delisle

    Marc Delisle - 2014-06-27
    • Group: 4.1.14 --> 4.2.5
     
  • Marc Delisle

    Marc Delisle - 2014-07-05
    • assigned_to: Marc Delisle
     
  • Marc Delisle

    Marc Delisle - 2014-07-05
    • summary: Server validation does not work while in setup/mysqli --> (ok 4.2.6) Server validation does not work while in setup/mysqli
    • status: open --> resolved
    • Priority: 5 --> 1
     
  • Marc Delisle

    Marc Delisle - 2014-07-18
    • Status: resolved --> fixed