From: Ilia Alshanetsky Date: Sat, 26 Oct 2002 22:00:36 +0000 (+0000) Subject: Added a sanity check (hopefuly will fix bug #20109). According to X-Git-Tag: php-4.3.0pre2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d5870ef54440591433e16ef5439424b7e92c155d;p=php Added a sanity check (hopefuly will fix bug #20109). According to http://developer.netscape.com/docs/manuals/enterprise/40/nsapi/05_nsapi.htm#551539 util_hostname() can return a NULL value. --- diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c index 522df34479..f2e4efacb6 100644 --- a/sapi/nsapi/nsapi.c +++ b/sapi/nsapi/nsapi.c @@ -318,7 +318,9 @@ sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_DC) } sprintf(buf, "%d", conf_getglobals()->Vport); php_register_variable("SERVER_PORT", buf, track_vars_array TSRMLS_CC ); - php_register_variable("SERVER_NAME", util_hostname(), track_vars_array TSRMLS_CC ); + if ((value = util_hostname())) { + php_register_variable("SERVER_NAME", value, track_vars_array TSRMLS_CC ); + } php_register_variable("SERVER_URL", http_uri2url("", ""), track_vars_array TSRMLS_CC ); php_register_variable("HTTPS", (security_active ? "ON" : "OFF"), track_vars_array TSRMLS_CC ); /* php_register_variable("SERVER_SOFTWARE", MAGNUS_VERSION_STRING, track_vars_array TSRMLS_CC ); */