com php-src: Fixed PCRE locale crash in Windows/TS: ext/pcre/php_pcre.c
| From: | Anatol Belski | Date: | Mon, 04 Mar 2013 08:09:45 +0000 |
| Subject: | com php-src: Fixed PCRE locale crash in Windows/TS: ext/pcre/php_pcre.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-71387@lists.php.net to get a copy of this message | ||
Commit: b6fdb60ecf33b3d549d5d69e245b04d68ab3e824
Author: Stephen A. Zarkos <stephen.zarkos@microsoft.com> Mon, 4 Mar 2013 09:09:45
+0100
Committer: Anatol Belski <ab@php.net> Mon, 4 Mar 2013 09:09:45 +0100
Parents: 656fcb67f1edbd2bde1b93577cdc273ad27e0d8f
Branches: PHP-5.3 PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src..git;a=commitdiff;h=b6fdb60ecf33b3d549d5d69e245b04d68ab3e824
Log:
Fixed PCRE locale crash in Windows/TS
Changed paths:
M ext/pcre/php_pcre.c
Diff:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index b9cb4f4..cab3a4c 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -244,11 +244,18 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int
regex_le
int count = 0;
unsigned const char *tables = NULL;
#if HAVE_SETLOCALE
- char *locale = setlocale(LC_CTYPE, NULL);
+ char *locale;
#endif
pcre_cache_entry *pce;
pcre_cache_entry new_entry;
+#if HAVE_SETLOCALE
+# ifdef PHP_WIN32 && ZTS
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+# endif
+ locale = setlocale(LC_CTYPE, NULL);
+#endif
+
/* Try to lookup the cached regex entry, and if successful, just pass
back the compiled pattern, otherwise go on and compile it. */
if (zend_hash_find(&PCRE_G(pcre_cache), regex, regex_len+1, (void **)&pce) == SUCCESS) {