Browse Source

- work around ENV VC6 bug

experimental/first_unicode_implementation
Pierre Joye 18 years ago
parent
commit
96310b8905
  1. 10
      ext/standard/basic_functions.c

10
ext/standard/basic_functions.c

@ -4446,6 +4446,7 @@ PHP_FUNCTION(putenv)
#ifdef PHP_WIN32
char *value = NULL;
int equals = 0;
int error_code;
#endif
pe.putenv_string = estrndup(setting, setting_len);
@ -4495,7 +4496,14 @@ PHP_FUNCTION(putenv)
# ifndef PHP_WIN32
if (putenv(pe.putenv_string) == 0) { /* success */
# else
if (SetEnvironmentVariableA(pe.key, value) != 0) { /* success */
error_code = SetEnvironmentVariable(pe.key, value);
# if _MSC_VER < 1500
/* Yet another VC6 bug, unset may return env not found */
if (error_code != 0 ||
(error_code == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)) {
# else
if (error_code != 0) { /* success */
# endif
# endif
#endif
zend_hash_add(&BG(putenv_ht), pe.key, pe.key_len + 1, (void **) &pe, sizeof(putenv_entry), NULL);

Loading…
Cancel
Save