diff options
author | Davey Shafik <me@daveyshafik.com> | 2020-08-11 07:51:29 +0000 |
---|---|---|
committer | Davey Shafik <me@daveyshafik.com> | 2020-08-11 07:51:29 +0000 |
commit | 7454c1456fa9fe4dd4b17a2945479566c5d1e11d (patch) | |
tree | c46753ce402985f351c9479f712b2f9a32e4cca4 | |
parent | f673ca4cc0ec4e43c26a0ea1ce2cef8ed6d0a67a (diff) | |
download | php7-mysql-shim-7454c1456fa9fe4dd4b17a2945479566c5d1e11d.zip php7-mysql-shim-7454c1456fa9fe4dd4b17a2945479566c5d1e11d.tar.gz php7-mysql-shim-7454c1456fa9fe4dd4b17a2945479566c5d1e11d.tar.bz2 |
$new is **NOT** supported by mysqli, reverting #45
-rw-r--r-- | lib/mysql.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/mysql.php b/lib/mysql.php index 527ba3b..924d68f 100644 --- a/lib/mysql.php +++ b/lib/mysql.php @@ -40,6 +40,10 @@ namespace { $new = false, $flags = 0 ) { + 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; } @@ -53,7 +57,7 @@ namespace { $hash = sha1($hostname . $username . $flags); /* persistent connections start with p: */ /* don't use a cached link for those */ - if (!$new && $hostname[1] !== ':' && isset(\Dshafik\MySQL::$connections[$hash])) { + if ($hostname[1] !== ':' && isset(\Dshafik\MySQL::$connections[$hash])) { \Dshafik\MySQL::$last_connection = \Dshafik\MySQL::$connections[$hash]['conn']; \Dshafik\MySQL::$connections[$hash]['refcount'] += 1; return \Dshafik\MySQL::$connections[$hash]['conn']; |