com php-src: partially fixed bug #66265: ext/standard/basic_f unctions.c

From: Date: Fri, 21 Nov 2014 08:57:12 +0000
Subject: com php-src: partially fixed bug #66265: ext/standard/basic_f unctions.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-83219@lists.php.net to get a copy of this message
Commit: 56fac96bec882ac59a7fc298c98407bf4a17629d Author: Anatol Belski <ab@php.net> Fri, 21 Nov 2014 09:57:12 +0100 Parents: 502ce90873d1d7ffc0c359b58d7d49691080804e Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=56fac96bec882ac59a7fc298c98407bf4a17629d Log: partially fixed bug #66265 NTS mode should additionally use _putenv to satisfy libs like gettext relying on _getenv. As _putenv isn't thread safe, it wouldn't bring much for the TS mode as it would change locale across all the threads and require locking to avoid random fails with concurrent _getenv calls. Bugs: https://bugs.php.net/66265 Changed paths: M ext/standard/basic_functions.c Diff: diff --git a/ext/standard/basic_functions..c b/ext/standard/basic_functions.c index ace6540..cadbb7f 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4138,13 +4138,17 @@ PHP_FUNCTION(putenv) if (putenv(pe.putenv_string) == 0) { /* success */ # else 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 + + if (error_code != 0 +# ifndef ZTS + /* We need both SetEnvironmentVariable and _putenv here as some + dependency lib could use either way to read the environment. + Obviously the CRT version will be useful more often. But + generally, doing both brings us on the safe track at least + in NTS build. */ + && _putenv(pe.putenv_string) == 0 +# endif + ) { /* success */ # endif #endif zend_hash_add(&BG(putenv_ht), pe.key, pe.key_len + 1, (void **) &pe, sizeof(putenv_entry), NULL);

« previous php.cvs (#83219) next »