For SQL debug, if we see an insert into alert_log with details column then we mask the output

This commit is contained in:
laf
2015-12-13 18:31:45 +00:00
parent 52647a92a0
commit 757017d4ef
2 changed files with 12 additions and 2 deletions

View File

@@ -28,7 +28,12 @@ function dbQuery($sql, $parameters=array()) {
$fullSql = dbMakeQuery($sql, $parameters);
if ($debug) {
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
if (preg_match('/(INSERT INTO `alert_log`).*(details)/i',$fullSql)) {
echo "\nINSERT INTO `alert_log` entry masked due to binary data\n";
}
else {
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
}
}
else {
$sql_debug[] = $fullSql;

View File

@@ -28,7 +28,12 @@ function dbQuery($sql, $parameters=array()) {
$fullSql = dbMakeQuery($sql, $parameters);
if ($debug) {
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
if (preg_match('/(INSERT INTO `alert_log`).*(details)/i',$fullSql)) {
echo "\nINSERT INTO `alert_log` entry masked due to binary data\n";
}
else {
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
}
}
else {
$sql_debug[] = $fullSql;