diff options
author | Михаил Красильников <m.krasilnikov@yandex.ru> | 2016-10-03 20:09:48 +0300 |
---|---|---|
committer | Davey Shafik <davey@php.net> | 2016-10-03 10:09:48 -0700 |
commit | cfbbe478a65a8ca8ea4ef0df2671fc1bfcfa81b8 (patch) | |
tree | e1a6d41690cb12f7f574e5f186e58849da369db0 /lib/mysql.php | |
parent | 02b8221e4fc6e6900f1746ea91ae9d6945910f6f (diff) | |
download | php7-mysql-shim-cfbbe478a65a8ca8ea4ef0df2671fc1bfcfa81b8.zip php7-mysql-shim-cfbbe478a65a8ca8ea4ef0df2671fc1bfcfa81b8.tar.gz php7-mysql-shim-cfbbe478a65a8ca8ea4ef0df2671fc1bfcfa81b8.tar.bz2 |
mysql_connect should return FALSE when mysqli_connect fails. (#15)
Diffstat (limited to 'lib/mysql.php')
-rw-r--r-- | lib/mysql.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/mysql.php b/lib/mysql.php index 17eb1b2..a777925 100644 --- a/lib/mysql.php +++ b/lib/mysql.php @@ -38,7 +38,11 @@ namespace { } if ($flags === 0) { - \Dshafik\MySQL::$last_connection = $conn = mysqli_connect($hostname, $username, $password); + $conn = mysqli_connect($hostname, $username, $password); + if (!$conn instanceof mysqli) { + return false; + } + \Dshafik\MySQL::$last_connection = $conn; $conn->hash = $hash; \Dshafik\MySQL::$connections[$hash] = ['refcount' => 1, 'conn' => $conn]; @@ -800,7 +804,7 @@ namespace Dshafik { $esc = $char; break; } - + return $esc; } } |