cvs: /php3 tls.h /php3/functions basic_functions.c php3_string.h string.c
| From: | Jouni Ahto | Date: | Thu, 07 Oct 1999 22:17:28 +0000 |
| Subject: | cvs: /php3 tls.h /php3/functions basic_functions.c php3_string.h string.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-11613@lists.php.net to get a copy of this message | ||
jah Thu Oct 7 18:17:28 1999 EDT
Modified files:
/php3 tls.h
/php3/functions basic_functions.c php3_string.h string.c
Log:
Restore locale to "C" at request shutdown if it was changed to something else.
Index: php3/tls.h
diff -u php3/tls.h:1.62 php3/tls.h:1.63
--- php3/tls.h:1.62 Wed Jun 16 07:34:13 1999
+++ php3/tls.h Thu Oct 7 18:16:57 1999
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tls.h,v 1.62 1999/06/16 11:34:13 ssb Exp $ */
+/* $Id: tls.h,v 1.63 1999/10/07 22:16:57 jah Exp $ */
#ifndef _TLS_H_
#define _TLS_H_
@@ -189,6 +189,7 @@
char *strtok_string;
char *strtok_pos1; /*STATIC VAR*/
char *strtok_pos2; /*STATIC VAR*/
+ char *locale_string;
#ifndef HAVE_STRERROR
char str_ebuf[40]; /*STATIC VAR*/
#endif
Index: php3/functions/basic_functions.c
diff -u php3/functions/basic_functions.c:1.278 php3/functions/basic_functions.c:1.279
--- php3/functions/basic_functions.c:1.278 Tue Sep 28 13:04:52 1999
+++ php3/functions/basic_functions.c Thu Oct 7 18:16:58 1999
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.278 1999/09/28 17:04:52 markonen Exp $ */
+/* $Id: basic_functions.c,v 1.279 1999/10/07 22:16:58 jah Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
@@ -68,6 +68,9 @@
#include "functions/basic_functions.h"
#include "functions/phpmath.h"
#include "functions/php3_string.h"
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
#include "functions/dns.h"
#include "functions/md5.h"
#include "functions/html.h"
@@ -404,6 +407,7 @@
{
TLS_VARS;
GLOBAL(strtok_string) = NULL;
+ GLOBAL(locale_string) = NULL;
#if HAVE_PUTENV
if (_php3_hash_init(&putenv_ht, 1, NULL, (void (*)(void *)) _php3_putenv_destructor, 0) ==
FAILURE) {
return FAILURE;
@@ -419,6 +423,11 @@
{
TLS_VARS;
STR_FREE(GLOBAL(strtok_string));
+ /* Check if locale was set and not returned to C */
+ if (GLOBAL(locale_string) != "C" || GLOBAL(locale_string) != NULL) {
+ setlocale(LC_ALL, "C");
+ }
+ STR_FREE(GLOBAL(locale_string));
#if HAVE_PUTENV
_php3_hash_destroy(&putenv_ht);
#endif
Index: php3/functions/php3_string.h
diff -u php3/functions/php3_string.h:1.44 php3/functions/php3_string.h:1.45
--- php3/functions/php3_string.h:1.44 Mon Sep 20 11:51:44 1999
+++ php3/functions/php3_string.h Thu Oct 7 18:16:58 1999
@@ -29,13 +29,14 @@
*/
-/* $Id: php3_string.h,v 1.44 1999/09/20 15:51:44 rasmus Exp $ */
+/* $Id: php3_string.h,v 1.45 1999/10/07 22:16:58 jah Exp $ */
#ifndef _PHPSTRING_H
#define _PHPSTRING_H
#ifndef THREAD_SAFE
extern char *strtok_string;
+extern char *locale_string;
#endif
PHP_FUNCTION(bin2hex);
Index: php3/functions/string.c
diff -u php3/functions/string.c:1.199 php3/functions/string.c:1.200
--- php3/functions/string.c:1.199 Tue Sep 21 13:46:53 1999
+++ php3/functions/string.c Thu Oct 7 18:16:58 1999
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP HTML Embedded Scripting Language Version 3.0 |
+ | Php HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-1999 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
@@ -30,7 +30,7 @@
*/
-/* $Id: string.c,v 1.199 1999/09/21 17:46:53 rasmus Exp $ */
+/* $Id: string.c,v 1.200 1999/10/07 22:16:58 jah Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
@@ -1788,6 +1788,10 @@
/* }}} */
+#ifndef THREAD_SAFE
+char *locale_string;
+#endif
+
/* {{{ proto string setlocale(string category, string locale)
Set locale information */
void php3_setlocale(INTERNAL_FUNCTION_PARAMETERS)
@@ -1823,6 +1827,9 @@
loc = locale->value.str.val;
retval = setlocale (cat, loc);
if (retval) {
+ STR_FREE(GLOBAL(locale_string));
+ GLOBAL(locale_string) = estrdup(retval);
+
RETVAL_STRING(retval,1);
return;
}