Skip to content

Commit

Permalink
Merge pull request #275 from kdnetwork/fix-mysql-class
Browse files Browse the repository at this point in the history
- 修改 `wmysql` 中大小写错误的变量名,将 `$useSsl` 改为 `$useSSL`
- 移除 `wmysql` 中出现的命名参数
  • Loading branch information
BANKA2017 authored Dec 21, 2024
2 parents e1b6d1d + feb0169 commit 6335691
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/class.mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public function __construct($host, $user, $pw, $name, $long = false, $useSSL = f
}

$flag = 0;
if ($useSsl) {
if ($useSSL) {
$flag = $flag & MYSQL_CLIENT_SSL;
}

if ($long) {
$this->conn = @mysql_pconnect($host, $user, $pw, $flag);
} else {
$this->conn = @mysql_connect($host, $user, $pw, client_flags: $flag);
$this->conn = @mysql_connect($host, $user, $pw, false, $flag);
}
if (!$this->conn) {
switch ($this->geterrno()) {
Expand Down
8 changes: 4 additions & 4 deletions lib/class.mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct($host, $user, $pw, $name, $long = false, $useSSL = f

$flags = 0;
$mysqli = mysqli_init();
if ($useSsl) {
if ($useSSL) {
$flags = $flags | MYSQLI_CLIENT_SSL;
}

Expand All @@ -59,12 +59,12 @@ public function __construct($host, $user, $pw, $name, $long = false, $useSSL = f
if ($long) {
$host = 'p:' . $host;
}
$connected = $mysqli->real_connect($host, $user, $pw, $name, flags: $flags);
$connected = $mysqli->real_connect($host, $user, $pw, $name, null, $flags);
} else {
if ($long) {
$connected = $mysqli->real_connect('p:' . substr($host, 0, $coninfo), $user, $pw, $name, substr($host, $coninfo + 1), flags: $flags);
$connected = $mysqli->real_connect('p:' . substr($host, 0, $coninfo), $user, $pw, $name, substr($host, $coninfo + 1), null, $flags);
} else {
$connected = $mysqli->real_connect(substr($host, 0, $coninfo), $user, $pw, $name, substr($host, $coninfo + 1), flags: $flags);
$connected = $mysqli->real_connect(substr($host, 0, $coninfo), $user, $pw, $name, substr($host, $coninfo + 1), null, $flags);
}
}

Expand Down

0 comments on commit 6335691

Please sign in to comment.