: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : '' ?>>
$cron = _get_cron_array();
foreach ($cron as $timestamp => $values) {
foreach ($values as $cron_job => $v) {
if (is_numeric($timestamp)) {
$overdue = ((time() - 1800) > $timestamp);
<tr<?php echo $overdue ? ' class="wf-overdue-cron"' : ''; ?>>
<td><?php echo esc_html(date('r', $timestamp)) . ($overdue ? ' <strong>(' . esc_html__('Overdue', 'wordfence') . ')</strong>' : '') ?></td>
<td><?php echo esc_html($cron_job) ?></td>
//This must be done this way because MySQL with InnoDB tables does a full regeneration of all metadata if we don't. That takes a long time with a large table count.
$tables = $wfdb->querySelect('SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() ORDER BY TABLE_NAME ASC LIMIT 250');
$total = $wfdb->querySingle('SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE()');
foreach ($tables as &$t) {
$t = "'" . esc_sql($t['TABLE_NAME']) . "'";
$q = $wfdb->querySelect("SHOW TABLE STATUS WHERE Name IN (" . implode(',', $tables) . ')');
$databaseCols = count($q[0]);
<div class="wf-block<?php echo(wfPersistenceController::shared()->isActive('wf-diagnostics-database-tables') ? ' wf-active' : '') ?>" data-persistence-key="<?php echo esc_attr('wf-diagnostics-database-tables') ?>">
<div class="wf-block-header">
<div class="wf-block-header-content">
<div class="wf-block-title">
<strong><?php esc_html_e('Database Tables', 'wordfence') ?></strong>
<span class="wf-text-small"><?php esc_html_e('Database table names, sizes, timestamps, and other metadata.', 'wordfence') ?></span>
<div class="wf-block-header-action">
<div class="wf-block-header-action-disclosure" role="checkbox" aria-checked="<?php echo (wfPersistenceController::shared()->isActive('wf-diagnostics-database-tables') ? 'true' : 'false'); ?>" tabindex="0"></div>
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
<ul class="wf-block-list wf-padding-add-left-large wf-padding-add-right-large">
<div style="width: 75%; min-width: 300px;"><?php esc_html_e('Wordfence Table Check', 'wordfence'); ?></div>
<?php if ($total > 250): ?>
<div class="wf-result-info"><?php esc_html_e('Unable to verify - table count too high', 'wordfence'); ?></div>
$schemaTables = wfSchema::tableList();
$existingTables = wfUtils::array_column($q, 'Name');
if (WFWAF_IS_WINDOWS) { $existingTables = wfUtils::array_strtolower($existingTables); } //Windows MySQL installations are case-insensitive
$missingTables = array();
foreach ($schemaTables as $t) {
$table = wfDB::networkTable($t);
if (WFWAF_IS_WINDOWS) { $table = strtolower($table); }
if (!in_array($table, $existingTables)) {
\WordfenceLS\Controller_DB::TABLE_2FA_SECRETS,
\WordfenceLS\Controller_DB::TABLE_SETTINGS,
$table = \WordfenceLS\Controller_DB::network_table($t);
if (!in_array($table, $existingTables)) {
<div class="wf-result-success"><?php esc_html_e('All Tables Exist', 'wordfence'); ?></div>
<div class="wf-result-error"><?php echo esc_html(sprintf(
/* translators: 1. WordPress table prefix. 2. Wordfence table case. 3. List of database tables. */
__('Tables missing (prefix %1$s, %2$s): %3$s', 'wordfence'), wfDB::networkPrefix(), wfSchema::usingLowercase() ? __('lowercase', 'wordfence') : __('regular case', 'wordfence'), implode(', ', $missingTables))); ?></div>
<li style="border-bottom: 1px solid #e2e2e2;">
<div style="width: 75%; min-width: 300px;"><?php esc_html_e('Number of Database Tables', 'wordfence'); ?></div>
<div class="wf-result-info"><?php echo esc_html( $total ); ?></div>
<div class="wf-add-top-large" style="max-width: 100%; overflow: auto; padding: 1px;">
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : '' ?>>
<tbody class="thead thead-subhead" style="font-size: 85%">
$val = wfUtils::array_first($q);
$actualKeyOrder = array_keys($val);
$preferredKeyOrder = array('Name', 'Comment', 'Engine', 'Rows', 'Avg_row_length', 'Data_length', 'Index_length', 'Auto_increment', 'Create_time', 'Row_format', 'Collation', 'Version', 'Max_data_length', 'Data_free', 'Update_time', 'Check_time', 'Checksum', 'Create_options');
$displayKeyOrder = array();
foreach ($preferredKeyOrder as $k) {
if (in_array($k, $actualKeyOrder)) {
$diff = array_diff($actualKeyOrder, $preferredKeyOrder);
$displayKeyOrder = array_merge($displayKeyOrder, $diff);
<?php foreach ($displayKeyOrder as $tkey): ?>
<th><?php echo esc_html($tkey) ?></th>
<tbody style="font-size: 85%">
<?php foreach ($displayKeyOrder as $tkey): ?>
<td><?php if (isset($val[$tkey])) { echo esc_html($val[$tkey]); } ?></td>
if ($count >= 250 && $total > $count) {
<td colspan="<?php echo $databaseCols; ?>"><?php echo esc_html(sprintf(/* translators: Row/record count. */ __('and %d more', 'wordfence'), $total - $count)); ?></td>
<div class="wf-block<?php echo(wfPersistenceController::shared()->isActive('wf-diagnostics-log-files') ? ' wf-active' : '') ?>" data-persistence-key="<?php echo esc_attr('wf-diagnostics-log-files') ?>">
<div class="wf-block-header">
<div class="wf-block-header-content">
<div class="wf-block-title">
<strong><?php esc_html_e('Log Files', 'wordfence') ?></strong>
<span class="wf-text-small"><?php esc_html_e('PHP error logs generated by your site, if enabled by your host.', 'wordfence') ?></span>
<div class="wf-block-header-action">
<div class="wf-block-header-action-disclosure" role="checkbox" aria-checked="<?php echo (wfPersistenceController::shared()->isActive('wf-diagnostics-log-files') ? 'true' : 'false'); ?>" tabindex="0"></div>
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
<div style="max-width: 100%; overflow: auto; padding: 1px;">
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : '' ?>>
<tbody class="thead thead-subhead" style="font-size: 85%">
<th><?php esc_html_e('File', 'wordfence'); ?></th>
<th><?php esc_html_e('Download', 'wordfence'); ?></th>
<tbody style="font-size: 85%">
$errorLogs = wfErrorLogHandler::getErrorLogs();
if (count($errorLogs) < 1): ?>
<td colspan="2"><em><?php esc_html_e('No log files found.', 'wordfence'); ?></em></td>
foreach ($errorLogs as $log => $readable): ?>
if (is_callable('filesize')) {
$rawSize = @filesize($log);
if ($rawSize !== false) {
$metadata[] = wfUtils::formatBytes(filesize($log));
if (is_callable('lstat')) {
if (is_array($rawStat) && isset($rawStat['mtime'])) {
$utc = new DateTimeZone('UTC');
$dtStr = gmdate("c", (int) $ts); //Have to do it this way because of PHP 5.2
$dt = new DateTime($dtStr, $utc);
$metadata[] = $dt->format('M j, Y G:i:s') . ' ' . __('UTC', 'wordfence');
if (strpos($shortLog, ABSPATH) === 0) {
$shortLog = '~/' . substr($shortLog, strlen(ABSPATH));
<td style="width: 100%"><?php echo esc_html($shortLog); if (!empty($metadata)) { echo ' (' . esc_html(implode(', ', $metadata)) . ')'; } ?></td>
<td style="white-space: nowrap; text-align: right;"><?php echo($readable ? '<a href="#" data-logfile="' . esc_attr($log) . '" class="downloadLogFile" target="_blank" rel="noopener noreferrer" role="button">' . esc_html__('Download', 'wordfence') . '<span class="screen-reader-text"> (' . esc_html__('opens in new tab', 'wordfence') . ')</span></a>' : '<em>' . esc_html__('Requires downloading from the server directly', 'wordfence') . '</em>'); ?></td>
echo '<h1>' . esc_html__('Scan Issues', 'wordfence') . "</h1>\n";
$issues = wfIssues::shared()->getIssues(0, 50, 0, 50);
$issueCounts = array_merge(array('new' => 0, 'ignoreP' => 0, 'ignoreC' => 0), wfIssues::shared()->getIssueCounts());
$issueTypes = wfIssues::validIssueTypes();
echo '<h2>' . esc_html(sprintf(/* translators: Number of scan issues. */ __('New Issues (%d total)', 'wordfence'), $issueCounts['new'])) . "</h2>\n";
if (isset($issues['new']) && count($issues['new'])) {
foreach ($issues['new'] as $i) {
if (!in_array($i['type'], $issueTypes)) {
$viewContent = wfView::create('scanner/issue-' . $i['type'], array('textOutput' => $i))->render();
catch (wfViewNotFoundException $e) {
//Ignore -- should never happen since we validate the type
if (!empty($viewContent)) {
echo nl2br($viewContent) . "<br><br>\n";
echo '<h1>' . esc_html__('No New Issues', 'wordfence') . "</h1>\n";
<?php if (!empty($inEmail)): ?>
<div class="wf-diagnostics-wrapper">
<div class="wf-block<?php echo(wfPersistenceController::shared()->isActive('wf-diagnostics-wordfence-settings') ? ' wf-active' : '') ?>" data-persistence-key="<?php echo esc_attr('wf-diagnostics-wordfence-settings') ?>">
<div class="wf-block-header">
<div class="wf-block-header-content">
<div class="wf-block-title">
<strong><?php esc_html_e('Wordfence Settings', 'wordfence') ?></strong>
<span class="wf-text-small"><?php esc_html_e('Diagnostic Wordfence settings/constants.', 'wordfence') ?></span>
<div class="wf-block-header-action">
<div class="wf-block-header-action-disclosure" role="checkbox" aria-checked="<?php echo (wfPersistenceController::shared()->isActive('wf-diagnostics-wordfence-settings') ? 'true' : 'false'); ?>" tabindex="0"></div>
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : '' ?>>
foreach (wfDiagnostic::getWordfenceValues() as $settingName => $settingData):
if (isset($settingData['subheader'])) {
<td colspan="2"><strong><?php echo esc_html($settingData['subheader']) ?></strong></td>
$escapedDescription = strip_tags($settingData['description']);
$escapedValue = __('(not set)', 'wordfence');
if (isset($settingData['value'])) {
$escapedValue = nl2br(strip_tags($settingData['value']));
<td><?php echo $escapedDescription ?></td>
<td><?php echo $escapedValue ?></td>
<?php if (!empty($inEmail)): ?>
<div class="wf-diagnostics-wrapper">
<div class="wf-block<?php echo(wfPersistenceController::shared()->isActive('wf-diagnostics-wordfence-central') ? ' wf-active' : '') ?>" data-persistence-key="<?php echo esc_attr('wf-diagnostics-wordfence-central') ?>">
<div class="wf-block-header">
<div class="wf-block-header-content">
<div class="wf-block-title">
<strong><?php esc_html_e('Wordfence Central', 'wordfence') ?></strong>
<span class="wf-text-small"><?php esc_html_e('Diagnostic connection information for Wordfence Central.', 'wordfence') ?></span>
<div class="wf-block-header-action">
<div class="wf-block-header-action-disclosure" role="checkbox" aria-checked="<?php echo (wfPersistenceController::shared()->isActive('wf-diagnostics-wordfence-central') ? 'true' : 'false'); ?>" tabindex="0"></div>
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : '' ?>>
foreach (wfDiagnostic::getWordfenceCentralValues() as $settingName => $settingData):
if (isset($settingData['subheader'])) {
<td colspan="2"><strong><?php echo esc_html($settingData['subheader']) ?></strong></td>
$escapedDescription = strip_tags($settingData['description']);
$escapedValue = __('(not set)', 'wordfence');
if (isset($settingData['value'])) {
$escapedValue = nl2br(strip_tags($settingData['value']));
<td><?php echo $escapedDescription ?></td>
<td><?php echo $escapedValue ?></td>
<?php if (!empty($inEmail)): ?>
<?php if (wfUtils::funcEnabled('phpinfo')) { phpinfo(); } else { echo '<strong>' . esc_html__('Unable to output phpinfo content because it is disabled', 'wordfence') . "</strong>\n"; } ?>
<?php if (!empty($emailForm)): ?>
<div class="wf-diagnostics-wrapper">
<div id="wf-diagnostics-other-tests" class="wf-block<?php echo(wfPersistenceController::shared()->isActive('wf-diagnostics-other-tests') ? ' wf-active' : '') ?>" data-persistence-key="<?php echo esc_attr('wf-diagnostics-other-tests') ?>">
<div class="wf-block-header">
<div class="wf-block-header-content">
<div class="wf-block-title">
<strong><?php esc_html_e('Other Tests', 'wordfence') ?></strong>
<span class="wf-text-small"><?php esc_html_e('System configuration, memory test, send test email from this server.', 'wordfence') ?></span>
<div class="wf-block-header-action">
<div class="wf-block-header-action-disclosure" role="checkbox" aria-checked="<?php echo (wfPersistenceController::shared()->isActive('wf-diagnostics-other-tests') ? 'true' : 'false'); ?>" tabindex="0"></div>
<div class="wf-block-content wf-clearfix">
<ul class="wf-block-list">
<a href="<?php echo wfUtils::siteURLRelative(); ?>?_wfsf=sysinfo&nonce=<?php echo wp_create_nonce('wp-ajax'); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Click to view your system\'s configuration in a new window', 'wordfence'); ?><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a>
<a href="<?php echo wfSupportController::esc_supportURL(wfSupportController::ITEM_DIAGNOSTICS_SYSTEM_CONFIGURATION); ?>" target="_blank" rel="noopener noreferrer" class="wfhelp wf-inline-help"><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a>
<a href="<?php echo wfUtils::siteURLRelative(); ?>?_wfsf=testmem&nonce=<?php echo wp_create_nonce('wp-ajax'); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Test your WordPress host\'s available memory', 'wordfence'); ?><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a>
<a href="<?php echo wfSupportController::esc_supportURL(wfSupportController::ITEM_DIAGNOSTICS_TEST_MEMORY); ?>" target="_blank" rel="noopener noreferrer" class="wfhelp wf-inline-help"><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a>
<?php esc_html_e('Send a test email from this WordPress server to an email address:', 'wordfence'); ?> <a href="<?php echo wfSupportController::esc_supportURL(wfSupportController::ITEM_DIAGNOSTICS_TEST_EMAIL); ?>" target="_blank" rel="noopener noreferrer" class="wfhelp wf-inline-help"><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a>
<input type="text" id="testEmailDest" value="" size="20" maxlength="255" class="wfConfigElem"/>
<input class="wf-btn wf-btn-default wf-btn-sm" type="button" value="<?php esc_attr_e('Send Test Email', 'wordfence'); ?>" onclick="WFAD.sendTestEmail(jQuery('#testEmailDest').val());"/>
<?php esc_html_e('Send a test activity report email:', 'wordfence'); ?> <a href="<?php echo wfSupportController::esc_supportURL(wfSupportController::ITEM_DIAGNOSTICS_TEST_ACTIVITY_REPORT); ?>" target="_blank" rel="noopener noreferrer" class="wfhelp wf-inline-help"><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a>
<input type="email" id="email_summary_email_address_debug" value="" size="20" maxlength="255" class="wfConfigElem"/>
<input class="wf-btn wf-btn-default wf-btn-sm" type="button" value="<?php esc_attr_e('Send Test Activity Report', 'wordfence'); ?>" onclick="WFAD.sendTestActivityReport(jQuery('#email_summary_email_address_debug').val());"/>
<?php esc_html_e('Clear all Wordfence Central connection data', 'wordfence'); ?> <a href="<?php echo wfSupportController::esc_supportURL(wfSupportController::ITEM_DIAGNOSTICS_REMOVE_CENTRAL_DATA); ?>" target="_blank" rel="noopener noreferrer" class="wfhelp wf-inline-help"><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a>
<input class="wf-btn wf-btn-default wf-btn-sm" type="button" value="<?php esc_attr_e('Clear All Connection Data', 'wordfence'); ?>" onclick="WFAD.ajax('wordfence_wfcentral_disconnect', { force: true }, function() { WFAD.colorboxModal((self.isSmallScreen ? '300px' : '400px'), <?php echo esc_attr(json_encode(__('Successfully removed data', 'wordfence'))) ?>, <?php echo esc_attr(json_encode(__('All associated Wordfence Central connection data has been cleared.', 'wordfence'))) ?>); });"/>
<input class="wf-btn wf-btn-default wf-btn-sm" type="button" value="<?php esc_attr_e('Clear Local Connection Data', 'wordfence'); ?>" onclick="WFAD.ajax('wordfence_wfcentral_disconnect', { local: true }, function() { WFAD.colorboxModal((self.isSmallScreen ? '300px' : '400px'), <?php echo esc_attr(json_encode(__('Successfully removed data', 'wordfence'))) ?>, <?php echo esc_attr(json_encode(__('All associated Wordfence Central connection data has been removed from the local database.', 'wordfence'))) ?>); });"/>
<div class="wf-block<?php echo(wfPersistenceController::shared()->isActive('wf-diagnostics-debugging-options') ? ' wf-active' : '') ?>" data-persistence-key="<?php echo esc_attr('wf-diagnostics-debugging-options') ?>">
<div class="wf-block-header">
<div class="wf-block-header-content">
<div class="wf-block-title">
<strong><?php esc_html_e('Debugging Options', 'wordfence') ?></strong>
<div class="wf-block-header-action">
<div class="wf-block-header-action-disclosure" role="checkbox" aria-checked="<?php echo (wfPersistenceController::shared()->isActive('wf-diagnostics-debugging-options') ? 'true' : 'false'); ?>" tabindex="0"></div>
<div class="wf-block-content wf-clearfix">
<form action="#" id="wfDebuggingConfigForm">
<ul class="wf-block-list">
echo wfView::create('options/option-toggled', array(
'optionName' => 'debugOn',
'value' => $w->get('debugOn') ? 1 : 0,
'title' => __('Enable debugging mode (increases database load)', 'wordfence'),
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_DIAGNOSTICS_OPTION_DEBUGGING_MODE),
echo wfView::create('options/option-toggled', array(
'optionName' => 'startScansRemotely',
'value' => $w->get('startScansRemotely') ? 1 : 0,
'title' => __('Start all scans remotely (Try this if your scans aren\'t starting and your site is publicly accessible)', 'wordfence'),
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_DIAGNOSTICS_OPTION_REMOTE_SCANS),
echo wfView::create('options/option-toggled', array(
'optionName' => 'ssl_verify',
'value' => $w->get('ssl_verify') ? 1 : 0,
'title' => __('Enable SSL Verification (Disable this if you are consistently unable to connect to the Wordfence servers.)', 'wordfence'),
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_DIAGNOSTICS_OPTION_SSL_VERIFICATION),
echo wfView::create('options/option-toggled', array(
'optionName' => 'avoid_php_input',
'value' => wfWAF::getInstance()->getStorageEngine()->getConfig('avoid_php_input', false) ? 1 : 0,
'title' => __('Disable reading of php://input', 'wordfence'),
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_DIAGNOSTICS_OPTION_DISABLE_PHP_INPUT),
echo wfView::create('options/option-toggled', array(
'optionName' => 'wordfenceI18n',
'value' => $w->get('wordfenceI18n') ? 1 : 0,
'title' => 'Enable Wordfence translations',
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_DIAGNOSTICS_OPTION_WORDFENCE_TRANSLATIONS),
<a id="wf-restore-defaults" class="wf-btn wf-btn-default wf-btn-callout-subtle" href="#" data-restore-defaults-section="<?php echo esc_attr(wfConfig::OPTIONS_TYPE_DIAGNOSTICS); ?>" role="button"><?php esc_html_e('Restore Defaults', 'wordfence'); ?></a>
<a id="wf-cancel-changes" class="wf-btn wf-btn-default wf-btn-callout-subtle wf-disabled" href="#" role="button"><?php esc_html_e('Cancel Changes', 'wordfence'); ?></a>
<a id="wf-save-changes" class="wf-btn wf-btn-primary wf-btn-callout-subtle wf-disabled" href="#" role="button"><?php esc_html_e('Save Changes', 'wordfence'); ?></a>