Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions config/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@
/**
* Debugging Settings
*/
Config::define('WP_DEBUG_DISPLAY', false);
Config::define('WP_DEBUG_LOG', false);
Config::define('SCRIPT_DEBUG', false);
Config::define('WP_DEBUG_DISPLAY', env('WP_DEBUG_DISPLAY'), false);
Config::define('WP_DEBUG_LOG', env('WP_DEBUG_LOG'), false);
Config::define('SCRIPT_DEBUG', env('SCRIPT_DEBUG'), false);
ini_set('display_errors', '0');

/**
Expand All @@ -183,6 +183,33 @@

Config::apply();

// log the current configuration in use

$sensitive = '/(PASS|SECRET|KEY|TOKEN|SALT|AUTH|CREDENTIAL|DSN|DATABASE_URL|API_)/i';

function redact_constants(array $constants, string $pattern): array {
$out = [];
foreach ($constants as $name => $value) {
if (preg_match($pattern, $name)) {
if (is_string($value)) {
$out[$name] = '[REDACTED: ' . strlen($value) . ' chars]';
} else {
$out[$name] = '[REDACTED]';
}
} else {
$out[$name] = $value;
}
}
return $out;
}

$userConstants = get_defined_constants(true)['user'] ?? [];
$dump = redact_constants($userConstants, $sensitive);

error_log("=== CURRENT CONFIGURATION ===\n");
error_log(print_r($dump, true));
error_log("=============================\n");

/**
* Bootstrap WordPress
*/
Expand Down