@@ -1007,29 +1007,30 @@ SAPI_API zend_stat_t *sapi_get_stat(void)
1007
1007
1008
1008
SAPI_API char * sapi_getenv (const char * name , size_t name_len )
1009
1009
{
1010
+ char * value , * tmp ;
1011
+
1012
+ if (!sapi_module .getenv ) {
1013
+ return NULL ;
1014
+ }
1010
1015
if (!strncasecmp (name , "HTTP_PROXY" , name_len )) {
1011
1016
/* Ugly fix for HTTP_PROXY issue, see bug #72573 */
1012
1017
return NULL ;
1013
1018
}
1014
- if (sapi_module .getenv ) {
1015
- char * value , * tmp = sapi_module .getenv (name , name_len );
1016
- if (tmp ) {
1017
- value = estrdup (tmp );
1019
+ tmp = sapi_module .getenv (name , name_len );
1020
+ if (!tmp ) {
1021
+ return NULL ;
1022
+ }
1023
+ value = estrdup (tmp );
1018
1024
#ifdef PHP_WIN32
1019
- if (strlen (sapi_module .name ) == sizeof ("cgi-fcgi" ) - 1 && !strcmp (sapi_module .name , "cgi-fcgi" )) {
1020
- /* XXX more modules to go, if needed. */
1021
- free (tmp );
1022
- }
1025
+ if (strlen (sapi_module .name ) == sizeof ("cgi-fcgi" ) - 1 && !strcmp (sapi_module .name , "cgi-fcgi" )) {
1026
+ /* XXX more modules to go, if needed. */
1027
+ free (tmp );
1028
+ }
1023
1029
#endif
1024
- } else {
1025
- return NULL ;
1026
- }
1027
- if (sapi_module .input_filter ) {
1028
- sapi_module .input_filter (PARSE_STRING , name , & value , strlen (value ), NULL );
1029
- }
1030
- return value ;
1030
+ if (sapi_module .input_filter ) {
1031
+ sapi_module .input_filter (PARSE_STRING , name , & value , strlen (value ), NULL );
1031
1032
}
1032
- return NULL ;
1033
+ return value ;
1033
1034
}
1034
1035
1035
1036
SAPI_API int sapi_get_fd (int * fd )
0 commit comments