mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -05:00
ntbb-database: Don't leak partial passwords in errors (#1838)
This commit is contained in:
parent
fb9ceab6f9
commit
5458936f2e
|
|
@ -23,12 +23,17 @@ class PSDatabase {
|
|||
|
||||
function connect() {
|
||||
if (!$this->db) {
|
||||
$this->db = new PDO(
|
||||
"mysql:dbname={$this->database};host={$this->server};charset={$this->charset}",
|
||||
$this->username,
|
||||
$this->password
|
||||
);
|
||||
$this->db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
try {
|
||||
$this->db = new PDO(
|
||||
"mysql:dbname={$this->database};host={$this->server};charset={$this->charset}",
|
||||
$this->username,
|
||||
$this->password
|
||||
);
|
||||
$this->db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
} catch (Exception $e) {
|
||||
// hide passwords and stuff from stacktrace
|
||||
throw new ErrorException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
function query($query, $params=false) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user