Skip to content

Commit

Permalink
Don't set $_SERVER['HOSTNAME'] in CLI SAPI
Browse files Browse the repository at this point in the history
Summary: Matches the behavior of PHP.
Closes #2975

Reviewed By: @fredemmott

Differential Revision: D1393791

Pulled By: @LiraNuna
  • Loading branch information
atdt authored and facebook-github-bot committed Jul 1, 2014
1 parent 6e86577 commit 0126724
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hphp/runtime/base/program-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ void execute_command_line_begin(int argc, char **argv, int xhprof,
serverArr.set(s_argc, php_global(s_argc));
serverArr.set(s_PWD, g_context->getCwd());
char hostname[1024];
if (!gethostname(hostname, 1024)) {
if (RuntimeOption::ServerExecutionMode() && !gethostname(hostname, 1024)) {
serverArr.set(s_HOSTNAME, String(hostname, CopyString));
}

Expand Down

0 comments on commit 0126724

Please sign in to comment.