Skip to content

Commit

Permalink
remove err details from err CB to logger, for avoid leaking private i…
Browse files Browse the repository at this point in the history
…nformation
  • Loading branch information
ColdeZhang committed Aug 18, 2024
1 parent 3afd4ba commit 1da2d88
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions BlueMapCommon/webapp/public/sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ function send($data) {
$sql = new PDO("$driver:host=$hostname;port=$port;dbname=$database", $username, $password);
$sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e ) {
error(500, "Failed to connect to database: ".$e->getMessage());
error_log($e->getMessage(), 0); // Logs the detailed error message
error(500, "Failed to connect to database");
}

// provide map-tiles
Expand Down Expand Up @@ -201,7 +202,10 @@ function send($data) {
exit;
}

} catch (PDOException $e) { error(500, "Failed to fetch data: ".$e->getMessage()); }
} catch (PDOException $e) {
error_log($e->getMessage(), 0);
error(500, "Failed to fetch data");
}

// no content if nothing found
http_response_code(204);
Expand Down Expand Up @@ -240,7 +244,10 @@ function send($data) {
send($line["data"]);
exit;
}
} catch (PDOException $e) { error(500, "Failed to fetch data: ".$e->getMessage()); }
} catch (PDOException $e) {
error_log($e->getMessage(), 0);
error(500, "Failed to fetch data");
}
}

}
Expand Down

0 comments on commit 1da2d88

Please sign in to comment.