mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-08-24 12:01:57 -05:00
ntbb-database: Don't leak partial passwords in errors (#1838)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user