mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
- be sure to check if the var ha not been removed between the two calls
This commit is contained in:
parent
3e0e2820b8
commit
aeee365d72
1 changed files with 7 additions and 1 deletions
|
@ -4022,8 +4022,14 @@ PHP_FUNCTION(getenv)
|
||||||
|
|
||||||
ptr = emalloc(size);
|
ptr = emalloc(size);
|
||||||
size = GetEnvironmentVariableA(str, ptr, size);
|
size = GetEnvironmentVariableA(str, ptr, size);
|
||||||
|
if (size == 0) {
|
||||||
|
/* has been removed between the two calls */
|
||||||
|
efree(ptr);
|
||||||
|
RETURN_EMPTY_STRING();
|
||||||
|
} else {
|
||||||
RETURN_STRING(ptr, 0);
|
RETURN_STRING(ptr, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
/* system method returns a const */
|
/* system method returns a const */
|
||||||
ptr = getenv(str);
|
ptr = getenv(str);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue