Skip to content

Commit

Permalink
Patch empty SERVER_NAME (bcosca/fatfree#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
xfra35 committed Mar 13, 2018
1 parent 420f904 commit 8bf3b4c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base.php
Original file line number Diff line number Diff line change
Expand Up @@ -2205,7 +2205,7 @@ function($level,$text,$file,$line) {
$this->error(500,$text,NULL,$level);
}
);
if (!isset($_SERVER['SERVER_NAME']))
if (empty($_SERVER['SERVER_NAME']))
$_SERVER['SERVER_NAME']=gethostname();
if ($cli=PHP_SAPI=='cli') {
// Emulate HTTP request
Expand Down

3 comments on commit 8bf3b4c

@jtojnar
Copy link
Contributor

@jtojnar jtojnar commented on 8bf3b4c Mar 13, 2018

Choose a reason for hiding this comment

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

This looks better but what if server name is '0' ? It should be possible according to and Section 2.1 of [RFC1123].

@KOTRET
Copy link
Contributor

@KOTRET KOTRET commented on 8bf3b4c Mar 14, 2018

Choose a reason for hiding this comment

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

Although 0 is a valid hostname, its not very likely that this name is used (some implementations have issues handling numeric-only hostnames).
Imho this is an edge-case we can omit.

@xfra35
Copy link
Member Author

@xfra35 xfra35 commented on 8bf3b4c Mar 14, 2018

Choose a reason for hiding this comment

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

I didn't know it was a valid hostname!

As @KOTRET stated, I doubt this case will happen but anyway, it's fixed in 5f63fca

Please sign in to comment.