pajoye          Wed Aug 20 22:23:16 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/standard       basic_functions.c 
  Log:
  - MFH: work around vc6 bug
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.64.2.57&r2=1.725.2.31.2.64.2.58&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.57 
php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.58
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.57 Wed Aug 20 
09:01:24 2008
+++ php-src/ext/standard/basic_functions.c      Wed Aug 20 22:23:16 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.57 2008/08/20 09:01:24 tony2001 
Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.58 2008/08/20 22:23:16 pajoye 
Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -4451,6 +4451,7 @@
 #ifdef PHP_WIN32
                char *value = NULL;
                int equals = 0;
+               int error_code;
 #endif
 
                pe.putenv_string = estrndup(setting, setting_len);
@@ -4532,7 +4533,14 @@
 # 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);
@@ -4543,6 +4551,8 @@
 #endif
                        RETURN_TRUE;
                } else {
+                       int error = GetLastError();
+                       printf("error: %i\n", error);
                        efree(pe.putenv_string);
                        efree(pe.key);
                        RETURN_FALSE;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to