summaryrefslogtreecommitdiff
path: root/ext/standard/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r--ext/standard/string.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index c5c6520cf7..ec86b08d3c 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -197,8 +197,18 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out)
tsrm_mutex_lock( locale_mutex );
# endif
+#if defined(PHP_WIN32) && defined(ZTS)
+ {
+ /* Even with the enabled per thread locale, localeconv
+ won't check any locale change in the master thread. */
+ _locale_t cur = _get_current_locale();
+
+ res = cur->locinfo->lconv;
+ }
+#else
/* localeconv doesn't return an error condition */
res = localeconv();
+#endif
*out = *res;
@@ -1662,18 +1672,11 @@ static int php_needle_char(zval *needle, char *target TSRMLS_DC)
*target = (char)(int)Z_DVAL_P(needle);
return SUCCESS;
case IS_OBJECT:
- {
- zval holder;
-
- ZVAL_LONG(&holder, zval_get_long(needle));
-
- *target = (char)Z_LVAL(holder);
- return SUCCESS;
- }
- default: {
+ *target = (char) zval_get_long(needle);
+ return SUCCESS;
+ default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "needle is not a string or an integer");
return FAILURE;
- }
}
}
/* }}} */