Patch getenv_notfound for Unknown/Other Function Bug #55749
Patch version 2011-09-21 06:24 UTC
Return to Bug #55749 |
Download this patch
Patch Revisions:
Developer: pajoye@php.net
Index: main/php_ini.c
===================================================================
--- main/php_ini.c (revision 316909)
+++ main/php_ini.c (working copy)
@@ -421,7 +421,11 @@
env_location = "";
} else {
size = GetEnvironmentVariableA("PHPRC", phprc_path, size);
- env_location = phprc_path;
+ if (size == 0) {
+ env_location = "";
+ } else {
+ env_location = phprc_path;
+ }
}
}
}
Index: ext/standard/basic_functions.c
===================================================================
--- ext/standard/basic_functions.c (revision 316909)
+++ ext/standard/basic_functions.c (working copy)
@@ -3989,7 +3989,13 @@
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 */
|