mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58: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,7 +4022,13 @@ PHP_FUNCTION(getenv)
|
|||
|
||||
ptr = emalloc(size);
|
||||
size = GetEnvironmentVariableA(str, ptr, size);
|
||||
RETURN_STRING(ptr, 0);
|
||||
if (size == 0) {
|
||||
/* has been removed between the two calls */
|
||||
efree(ptr);
|
||||
RETURN_EMPTY_STRING();
|
||||
} else {
|
||||
RETURN_STRING(ptr, 0);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* system method returns a const */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue