summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2013-03-04 09:14:14 +0100
committerAnatol Belski <ab@php.net>2013-03-04 09:14:14 +0100
commit4e46a873923b9a608cd2cdcef98ec7faad749d0e (patch)
tree69d20a0ceb25c7cfdf2ff9d54c7a5b513927ef8b /ext/pcre/php_pcre.c
parent2578f7bcc05c3a304599e978df3900323d3b1b70 (diff)
parentb6fdb60ecf33b3d549d5d69e245b04d68ab3e824 (diff)
downloadphp-git-4e46a873923b9a608cd2cdcef98ec7faad749d0e.tar.gz
Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3: Fixed PCRE locale crash in Windows/TS
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r--ext/pcre/php_pcre.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index b74b81276c..20fb2a20b3 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -244,12 +244,19 @@ 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;
char *tmp = NULL;
+#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) {