summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJonathan Hawkes <jonathan@yyyep.com>2019-07-24 21:43:53 -0600
committerDavey Shafik <me@daveyshafik.com>2019-07-24 23:43:53 -0400
commit2236e6f4cd5fec4439cba781bc938301b7caaddc (patch)
treea97829a014823265233d605c694df16e1ba87926 /lib
parent829dac55b8d67c8cb359e93865bfdc6d128655fe (diff)
downloadphp7-mysql-shim-2236e6f4cd5fec4439cba781bc938301b7caaddc.zip
php7-mysql-shim-2236e6f4cd5fec4439cba781bc938301b7caaddc.tar.gz
php7-mysql-shim-2236e6f4cd5fec4439cba781bc938301b7caaddc.tar.bz2
Use the parameter in a way compatible with the parameter in mysql_connect (#45)
Diffstat (limited to 'lib')
-rw-r--r--lib/mysql.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/mysql.php b/lib/mysql.php
index 025d6af..7b0201d 100644
--- a/lib/mysql.php
+++ b/lib/mysql.php
@@ -40,9 +40,6 @@ 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;
}
@@ -55,7 +52,8 @@ namespace {
$hash = sha1($hostname . $username . $flags);
/* persistent connections start with p: */
- if ($hostname{1} !== ':' && isset(\Dshafik\MySQL::$connections[$hash])) {
+ /* don't use a cached link for those */
+ if (!$new && $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'];