Skip to content

fix deprecation warning error when inspecting server hostname#497

Merged
dati18 merged 1 commit into
mainfrom
fix-deprecation-warning
Oct 31, 2025
Merged

fix deprecation warning error when inspecting server hostname#497
dati18 merged 1 commit into
mainfrom
fix-deprecation-warning

Conversation

@dati18
Copy link
Copy Markdown
Contributor

@dati18 dati18 commented Oct 29, 2025

LocalSettings.php detects whether the current request is coming from a local dev env by inspecting the server hostname. I added isset($_SERVER['SERVER_NAME']) so preg_match() method is called only when the variable exists. This helps remove these type of errors in the logs:

Warning: Undefined array key "SERVER_NAME" in /var/www/html/w/wbstack/src/Settings/LocalSettings.php on line 27
Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /var/www/html/w/wbstack/src/Settings/LocalSettings.php on line 27

Copy link
Copy Markdown
Contributor

@tarrow tarrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me! Looks like the deprecation warning comes from preg_match.

I didn't test locally but given the automated smoke tests work I'm happy. Let's ship this to staging sooner than later though just in case it blows up

Copy link
Copy Markdown
Member

@outdooracorn outdooracorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's goooo! 🚀 :shipit:

@dati18 dati18 merged commit 1acf948 into main Oct 31, 2025
9 checks passed
@dati18 dati18 deleted the fix-deprecation-warning branch October 31, 2025 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants