Skip to content

Commit 9d9a0f1

Browse files
committed
Site Health: Account for missing or slashed $_SERVER data in WP_Debug_Data.
Developed in #10870 Follow-up to [56056], [45156], [44986] Props vishalkakadiya, sabernhardt, peterwilsoncc, mukesh27, westonruter. Fixes #64599. git-svn-id: https://develop.svn.wordpress.org/trunk@61606 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f8b2285 commit 9d9a0f1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/wp-admin/includes/class-wp-debug-data.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ private static function get_wp_server(): array {
373373
);
374374
$fields['httpd_software'] = array(
375375
'label' => __( 'Web server' ),
376-
'value' => $_SERVER['SERVER_SOFTWARE'] ?? __( 'Unable to determine what web server software is used' ),
377-
'debug' => $_SERVER['SERVER_SOFTWARE'] ?? 'unknown',
376+
'value' => ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) : __( 'Unable to determine what web server software is used' ),
377+
'debug' => ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) : 'unknown',
378378
);
379379
$fields['php_version'] = array(
380380
'label' => __( 'PHP version' ),
@@ -545,7 +545,7 @@ private static function get_wp_server(): array {
545545
);
546546
$fields['server-time'] = array(
547547
'label' => __( 'Current Server time' ),
548-
'value' => wp_date( 'c', $_SERVER['REQUEST_TIME'] ),
548+
'value' => isset( $_SERVER['REQUEST_TIME'] ) ? wp_date( 'c', (int) $_SERVER['REQUEST_TIME'] ) : __( 'Unable to determine server time' ),
549549
);
550550

551551
return array(

0 commit comments

Comments
 (0)