lcache / wp-lcache

A WordPress implementation of LCache
https://wordpress.org/plugins/wp-lcache/
GNU General Public License v2.0
88 stars 5 forks source link

Use the correct DSN format in all DB_HOST scenarios #115

Closed frankiejarrett closed 7 years ago

frankiejarrett commented 7 years ago

When attempting to use a host with a port (mysql.example.com:3307) I encountered a fatal because DB_HOST still has the port in it.

Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host

Proposed changes to fix the above, and more:

  1. Include the modified (portless) $host in the return array after parsing DB_HOST
  2. Use the portless $host when a $port exists
  3. Only use the port element when a $port exists
  4. Use the full DB_HOST when the host is portless, or on socket connections
  5. Support the charset element

https://codex.wordpress.org/Editing_wp-config.php#Set_Database_Host https://secure.php.net/manual/en/ref.pdo-mysql.connection.php

danielbachhuber commented 7 years ago

Working on the failed Travis test in #116

danielbachhuber commented 7 years ago

@fjarrett You can merge master now to get the fix for Travis.

danielbachhuber commented 7 years ago

@fjarrett This looks good to me. Happy with it?

danielbachhuber commented 7 years ago

If you merge master to include #118, Circle CI should pass.

danielbachhuber commented 7 years ago

Circle CI should pass.

Ugh. Terminus changed its behavior.

danielbachhuber commented 7 years ago

Thanks for your work on this, @fjarrett !