Skip to content

Commit

Permalink
fix: E_WARNING: Undefined array key 'HTTP_REFERER' (#206)
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Klein <[email protected]>
  • Loading branch information
schakko committed Jan 9, 2025
1 parent 9833d49 commit 30264d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/shared/WordPress/Multisite/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ private function __clone()
*/
public static function isOnNetworkDashboard()
{
$referer = $_SERVER['HTTP_REFERER'] ?? '';

// network admin + ajax requests
// see: https://core.trac.wordpress.org/ticket/22589
if (defined('DOING_AJAX') && DOING_AJAX && is_multisite()
&& preg_match('#^' . network_admin_url() . '#i', $_SERVER['HTTP_REFERER'])
&& preg_match('#^' . network_admin_url() . '#i', $referer)
) {
return true;
}
Expand Down

0 comments on commit 30264d9

Please sign in to comment.