wez Thu Dec 4 17:38:23 2003 EDT
Modified files:
/php-src/ext/standard basic_functions.c
Log:
Work around a bug in putenv() in the VS.Net C run time library (MSVCRT71) where it
will double free a string.
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.644
php-src/ext/standard/basic_functions.c:1.645
--- php-src/ext/standard/basic_functions.c:1.644 Sat Nov 29 16:46:47 2003
+++ php-src/ext/standard/basic_functions.c Thu Dec 4 17:38:22 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.644 2003/11/29 21:46:47 wez Exp $ */
+/* $Id: basic_functions.c,v 1.645 2003/12/04 22:38:22 wez Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -1448,6 +1448,14 @@
}
}
+#if _MSC_VER >= 1300
+ /* VS.Net has a bug in putenv() when setting a variable that
+ * is already set; if the SetEnvironmentVariable() API call
+ * fails, the Crt will double free() a string.
+ * We try to avoid this by setting our own value first */
+ SetEnvironmentVariable(pe.key, "bugbug");
+#endif
+
if (putenv(pe.putenv_string) == 0) { /* success */
zend_hash_add(&BG(putenv_ht), pe.key, pe.key_len+1, (void **)
&pe, sizeof(putenv_entry), NULL);
#ifdef HAVE_TZSET
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php