diff options
author | Davey Shafik <davey@php.net> | 2016-02-03 02:45:24 -0500 |
---|---|---|
committer | Davey Shafik <davey@php.net> | 2016-02-03 02:45:24 -0500 |
commit | f0ea8a8e3dc476e5deb1e6ef0c4dbe6237fe8459 (patch) | |
tree | 5e8ad48ab48b3d940e2e17c513d58b83a7e079a8 /lib/mysql.php | |
parent | a8a17b83d51679a6ec6251f79e41f93b76b6b3f8 (diff) | |
parent | cb3cce2392a9022cc8493a93c76a113ebbb764e8 (diff) | |
download | php7-mysql-shim-f0ea8a8e3dc476e5deb1e6ef0c4dbe6237fe8459.zip php7-mysql-shim-f0ea8a8e3dc476e5deb1e6ef0c4dbe6237fe8459.tar.gz php7-mysql-shim-f0ea8a8e3dc476e5deb1e6ef0c4dbe6237fe8459.tar.bz2 |
Merge pull request #5 from gimler/mysql_defaults
Use INI defaults
Diffstat (limited to 'lib/mysql.php')
-rw-r--r-- | lib/mysql.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/mysql.php b/lib/mysql.php index 9fa32cb..e587c2a 100644 --- a/lib/mysql.php +++ b/lib/mysql.php @@ -20,6 +20,15 @@ namespace { if ($new !== false) { trigger_error('Argument $new is no longer supported in PHP > 7', E_USER_WARNING); } + if (null === $hostname) { + $hostname = ini_get('mysqli.default_host') ?: null; + } + if (null === $username) { + $username = ini_get('mysqli.default_user') ?: null; + } + if (null === $password) { + $password = ini_get('mysqli.default_pw') ?: null; + } $hash = sha1($hostname . $username . $flags); if ($hostname{1} != ':' && isset(\Dshafik\MySQL::$connections[$hash])) { |