summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_operators.h2
-rw-r--r--configure.ac2
-rw-r--r--ext/pcre/php_pcre.c36
-rw-r--r--ext/pcre/php_pcre.h2
-rw-r--r--ext/readline/readline_cli.c3
-rw-r--r--ext/standard/basic_functions.c9
-rw-r--r--ext/standard/formatted_print.c10
-rw-r--r--ext/standard/html.c6
-rw-r--r--ext/standard/php_string.h6
-rw-r--r--ext/standard/scanf.c2
-rw-r--r--ext/standard/string.c48
-rw-r--r--main/main.c6
-rw-r--r--main/snprintf.c10
-rw-r--r--main/spprintf.c10
-rw-r--r--sapi/cgi/cgi_main.c4
-rw-r--r--sapi/cli/php_cli.c3
-rw-r--r--sapi/cli/php_cli_server.c4
-rw-r--r--sapi/fpm/fpm/fpm_main.c4
-rw-r--r--sapi/phpdbg/phpdbg_out.c13
-rw-r--r--win32/build/config.w32.h.in2
20 files changed, 19 insertions, 163 deletions
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index c5965256e1..6fe0bddc3d 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -451,7 +451,7 @@ ZEND_API void ZEND_FASTCALL zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_D
convert_scalar_to_number(pzv); \
}
-#if HAVE_SETLOCALE && defined(ZEND_WIN32) && !defined(ZTS) && defined(_MSC_VER)
+#if defined(ZEND_WIN32) && !defined(ZTS) && defined(_MSC_VER)
/* This performance improvement of tolower() on Windows gives 10-18% on bench.php */
#define ZEND_USE_TOLOWER_L 1
#endif
diff --git a/configure.ac b/configure.ac
index 6cce236364..88629a7b49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -628,8 +628,6 @@ random \
rand_r \
scandir \
setitimer \
-setlocale \
-localeconv \
setenv \
setpgid \
setsockopt \
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 55864206c8..9ab5d44656 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -94,7 +94,6 @@ static MUTEX_T pcre_mt = NULL;
#define php_pcre_mutex_unlock()
#endif
-#if HAVE_SETLOCALE
ZEND_TLS HashTable char_tables;
static void php_pcre_free_char_table(zval *data)
@@ -102,7 +101,6 @@ static void php_pcre_free_char_table(zval *data)
void *ptr = Z_PTR_P(data);
pefree(ptr, 1);
}/*}}}*/
-#endif
static void pcre_handle_exec_error(int pcre_code) /* {{{ */
{
@@ -271,9 +269,7 @@ static PHP_GINIT_FUNCTION(pcre) /* {{{ */
#endif
php_pcre_init_pcre2(1);
-#if HAVE_SETLOCALE
zend_hash_init(&char_tables, 1, NULL, php_pcre_free_char_table, 1);
-#endif
}
/* }}} */
@@ -284,10 +280,7 @@ static PHP_GSHUTDOWN_FUNCTION(pcre) /* {{{ */
}
php_pcre_shutdown_pcre2();
-#if HAVE_SETLOCALE
zend_hash_destroy(&char_tables);
-#endif
-
php_pcre_mutex_free();
}
/* }}} */
@@ -578,24 +571,19 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
char *pattern;
size_t pattern_len;
uint32_t poptions = 0;
-#if HAVE_SETLOCALE
const uint8_t *tables = NULL;
-#endif
zval *zv;
pcre_cache_entry new_entry;
int rc;
zend_string *key;
pcre_cache_entry *ret;
-#if HAVE_SETLOCALE
if (BG(locale_string) &&
(ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) {
key = zend_string_alloc(ZSTR_LEN(regex) + ZSTR_LEN(BG(locale_string)) + 1, 0);
memcpy(ZSTR_VAL(key), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)) + 1);
memcpy(ZSTR_VAL(key) + ZSTR_LEN(BG(locale_string)), ZSTR_VAL(regex), ZSTR_LEN(regex) + 1);
- } else
-#endif
- {
+ } else {
key = regex;
}
@@ -603,11 +591,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
back the compiled pattern, otherwise go on and compile it. */
zv = zend_hash_find(&PCRE_G(pcre_cache), key);
if (zv) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
return (pcre_cache_entry*)Z_PTR_P(zv);
}
@@ -617,11 +603,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
get to the end without encountering a delimiter. */
while (isspace((int)*(unsigned char *)p)) p++;
if (*p == 0) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
php_error_docref(NULL, E_WARNING,
p < ZSTR_VAL(regex) + ZSTR_LEN(regex) ? "Null byte in regex" : "Empty regular expression");
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
@@ -632,11 +616,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
or a backslash. */
delimiter = *p++;
if (isalnum((int)*(unsigned char *)&delimiter) || delimiter == '\\') {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
php_error_docref(NULL,E_WARNING, "Delimiter must not be alphanumeric or backslash");
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
return NULL;
@@ -677,11 +659,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
if (*pp == 0) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
if (pp < ZSTR_VAL(regex) + ZSTR_LEN(regex)) {
php_error_docref(NULL,E_WARNING, "Null byte in regex");
} else if (start_delimiter == end_delimiter) {
@@ -742,11 +722,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
efree(pattern);
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
return NULL;
}
}
@@ -755,15 +733,12 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
php_error_docref(NULL, E_WARNING, "The /e modifier is no longer supported, use preg_replace_callback instead");
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
efree(pattern);
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
return NULL;
}
-#if HAVE_SETLOCALE
if (key != regex) {
tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(locale_string));
if (!tables) {
@@ -782,7 +757,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
pcre2_set_character_tables(cctx, tables);
}
-#endif
/* Set extra options for the compile context. */
if (PHP_PCRE_DEFAULT_EXTRA_COPTIONS != extra_coptions) {
@@ -798,11 +772,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
if (re == NULL) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
pcre2_get_error_message(errnumber, error, sizeof(error));
php_error_docref(NULL,E_WARNING, "Compilation failed: %s at offset %zu", error, erroffset);
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
@@ -847,11 +819,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
rc = pcre2_pattern_info(re, PCRE2_INFO_CAPTURECOUNT, &new_entry.capture_count);
if (rc < 0) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
php_error_docref(NULL, E_WARNING, "Internal pcre2_pattern_info() error %d", rc);
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
return NULL;
@@ -859,11 +829,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
rc = pcre2_pattern_info(re, PCRE2_INFO_NAMECOUNT, &new_entry.name_count);
if (rc < 0) {
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
php_error_docref(NULL, E_WARNING, "Internal pcre_pattern_info() error %d", rc);
pcre_handle_exec_error(PCRE2_ERROR_INTERNAL);
return NULL;
@@ -887,11 +855,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
ret = zend_hash_add_new_mem(&PCRE_G(pcre_cache), key, &new_entry, sizeof(pcre_cache_entry));
}
-#if HAVE_SETLOCALE
if (key != regex) {
zend_string_release_ex(key, 0);
}
-#endif
return ret;
}
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index b59f16e898..1a28d1733a 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -25,9 +25,7 @@
#include "pcre2.h"
#endif
-#if HAVE_LOCALE_H
#include <locale.h>
-#endif
PHPAPI zend_string *php_pcre_replace(zend_string *regex, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count);
PHPAPI pcre2_code* pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count);
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index f55de8e4f9..1629ed012e 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.c
@@ -33,10 +33,7 @@
#include "zend_modules.h"
#include "SAPI.h"
-
-#if HAVE_SETLOCALE
#include <locale.h>
-#endif
#include "zend.h"
#include "zend_extensions.h"
#include "php_ini.h"
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index ba4b5ee68c..29ee2fb3f2 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -76,10 +76,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
#include <string.h>
-
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
+#include <locale.h>
#if HAVE_SYS_MMAN_H
# include <sys/mman.h>
@@ -3685,7 +3682,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
BASIC_MINIT_SUBMODULE(password)
BASIC_MINIT_SUBMODULE(mt_rand)
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
+#if defined(ZTS)
BASIC_MINIT_SUBMODULE(localeconv)
#endif
@@ -3769,7 +3766,7 @@ PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */
BASIC_MSHUTDOWN_SUBMODULE(url_scanner_ex)
BASIC_MSHUTDOWN_SUBMODULE(file)
BASIC_MSHUTDOWN_SUBMODULE(standard_filters)
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
+#if defined(ZTS)
BASIC_MSHUTDOWN_SUBMODULE(localeconv)
#endif
BASIC_MSHUTDOWN_SUBMODULE(crypt)
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index e534d94753..b804cda500 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -23,7 +23,6 @@
#include "zend_execute.h"
#include <stdio.h>
-#ifdef HAVE_LOCALE_H
#include <locale.h>
#ifdef ZTS
#include "ext/standard/php_string.h"
@@ -31,9 +30,6 @@
#else
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
#endif
-#else
-#define LCONV_DECIMAL_POINT '.'
-#endif
#define ALIGN_LEFT 0
#define ALIGN_RIGHT 1
@@ -232,13 +228,11 @@ php_sprintf_appenddouble(zend_string **buffer, size_t *pos,
char *s = NULL;
size_t s_len = 0;
int is_negative = 0;
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
struct lconv lconv;
#else
struct lconv *lconv;
#endif
-#endif
PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n",
*buffer, pos, &ZSTR_LEN(*buffer), number, width, padding, alignment, fmt));
@@ -268,13 +262,11 @@ php_sprintf_appenddouble(zend_string **buffer, size_t *pos,
case 'E':
case 'f':
case 'F':
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
lconv = localeconv();
#endif
-#endif
s = php_conv_fp((fmt == 'f')?'F':fmt, number, 0, precision,
(fmt == 'f')?LCONV_DECIMAL_POINT:'.',
&is_negative, &num_buf[1], &s_len);
@@ -296,13 +288,11 @@ php_sprintf_appenddouble(zend_string **buffer, size_t *pos,
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
lconv = localeconv();
#endif
-#endif
s = php_gcvt(number, precision, LCONV_DECIMAL_POINT, (fmt == 'G')?'E':'e', &num_buf[1]);
is_negative = 0;
if (*s == '-') {
diff --git a/ext/standard/html.c b/ext/standard/html.c
index d69082939c..0cdfca6d85 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -45,9 +45,7 @@
#include "php_standard.h"
#include "php_string.h"
#include "SAPI.h"
-#if HAVE_LOCALE_H
#include <locale.h>
-#endif
#if HAVE_LANGINFO_H
#include <langinfo.h>
#endif
@@ -408,14 +406,13 @@ static enum entity_charset determine_charset(char *charset_hint)
}
/* try to detect the charset for the locale */
-#if HAVE_NL_LANGINFO && HAVE_LOCALE_H && defined(CODESET)
+#if HAVE_NL_LANGINFO && defined(CODESET)
charset_hint = nl_langinfo(CODESET);
if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) {
goto det_charset;
}
#endif
-#if HAVE_LOCALE_H
/* try to figure out the charset from the locale */
{
char *localename;
@@ -441,7 +438,6 @@ static enum entity_charset determine_charset(char *charset_hint)
len = strlen(charset_hint);
}
}
-#endif
det_charset:
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
index f88861cd5b..03d1ee8f8c 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_string.h
@@ -98,7 +98,7 @@ PHP_FUNCTION(strcoll);
PHP_FUNCTION(money_format);
#endif
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
+#if defined(ZTS)
PHP_MINIT_FUNCTION(localeconv);
PHP_MSHUTDOWN_FUNCTION(localeconv);
#endif
@@ -114,11 +114,7 @@ PHP_MINIT_FUNCTION(string_intrin);
#define strnatcasecmp(a, b) \
strnatcmp_ex(a, strlen(a), b, strlen(b), 1)
PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case);
-
-#ifdef HAVE_LOCALECONV
PHPAPI struct lconv *localeconv_r(struct lconv *out);
-#endif
-
PHPAPI char *php_strtoupper(char *s, size_t len);
PHPAPI char *php_strtolower(char *s, size_t len);
PHPAPI zend_string *php_string_toupper(zend_string *s);
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
index b128f0d54f..5740cd6412 100644
--- a/ext/standard/scanf.c
+++ b/ext/standard/scanf.c
@@ -68,9 +68,7 @@
#include <ctype.h>
#include "php.h"
#include "php_variables.h"
-#ifdef HAVE_LOCALE_H
#include <locale.h>
-#endif
#include "zend_execute.h"
#include "zend_operators.h"
#include "zend_strtod.h"
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 8fb0e81ab0..97725bf3f4 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -23,9 +23,7 @@
#include "php_rand.h"
#include "php_string.h"
#include "php_variables.h"
-#ifdef HAVE_LOCALE_H
-# include <locale.h>
-#endif
+#include <locale.h>
#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#endif
@@ -88,12 +86,8 @@ void register_string_constants(INIT_FUNC_ARGS)
REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT);
-#ifdef HAVE_LOCALECONV
/* If last members of struct lconv equal CHAR_MAX, no grouping is done */
REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT);
-#endif
-
-#ifdef HAVE_LOCALE_H
REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT);
@@ -103,7 +97,6 @@ void register_string_constants(INIT_FUNC_ARGS)
# ifdef LC_MESSAGES
REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT);
# endif
-#endif
}
/* }}} */
@@ -176,15 +169,14 @@ static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen)
}
/* }}} */
-#ifdef HAVE_LOCALECONV
/* {{{ localeconv_r
* glibc's localeconv is not reentrant, so lets make it so ... sorta */
PHPAPI struct lconv *localeconv_r(struct lconv *out)
{
-# ifdef ZTS
+#ifdef ZTS
tsrm_mutex_lock( locale_mutex );
-# endif
+#endif
/* cur->locinfo is struct __crt_locale_info which implementation is
hidden in vc14. TODO revisit this and check if a workaround available
@@ -202,15 +194,15 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out)
*out = *localeconv();
#endif
-# ifdef ZTS
+#ifdef ZTS
tsrm_mutex_unlock( locale_mutex );
-# endif
+#endif
return out;
}
/* }}} */
-# ifdef ZTS
+#ifdef ZTS
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(localeconv)
@@ -229,7 +221,6 @@ PHP_MSHUTDOWN_FUNCTION(localeconv)
return SUCCESS;
}
/* }}} */
-# endif
#endif
/* {{{ proto string bin2hex(string data)
@@ -4838,7 +4829,6 @@ PHP_FUNCTION(setlocale)
Z_PARAM_VARIADIC('+', args, num_args)
ZEND_PARSE_PARAMETERS_END();
-#ifdef HAVE_SETLOCALE
idx = 0;
while (1) {
if (Z_TYPE(args[0]) == IS_ARRAY) {
@@ -4907,7 +4897,6 @@ PHP_FUNCTION(setlocale)
}
}
-#endif
RETURN_FALSE;
}
/* }}} */
@@ -5600,7 +5589,6 @@ PHP_FUNCTION(localeconv)
array_init(&grouping);
array_init(&mon_grouping);
-#ifdef HAVE_LOCALECONV
{
struct lconv currlocdata;
@@ -5637,30 +5625,6 @@ PHP_FUNCTION(localeconv)
add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn);
add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn);
}
-#else
- /* Ok, it doesn't look like we have locale info floating around, so I guess it
- wouldn't hurt to just go ahead and return the POSIX locale information? */
-
- add_index_long(&grouping, 0, -1);
- add_index_long(&mon_grouping, 0, -1);
-
- add_assoc_string(return_value, "decimal_point", "\x2E");
- add_assoc_string(return_value, "thousands_sep", "");
- add_assoc_string(return_value, "int_curr_symbol", "");
- add_assoc_string(return_value, "currency_symbol", "");
- add_assoc_string(return_value, "mon_decimal_point", "\x2E");
- add_assoc_string(return_value, "mon_thousands_sep", "");
- add_assoc_string(return_value, "positive_sign", "");
- add_assoc_string(return_value, "negative_sign", "");
- add_assoc_long( return_value, "int_frac_digits", CHAR_MAX);
- add_assoc_long( return_value, "frac_digits", CHAR_MAX);
- add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX);
- add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX);
- add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX);
- add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX);
- add_assoc_long( return_value, "p_sign_posn", CHAR_MAX);
- add_assoc_long( return_value, "n_sign_posn", CHAR_MAX);
-#endif
zend_hash_str_update(Z_ARRVAL_P(return_value), "grouping", sizeof("grouping")-1, &grouping);
zend_hash_str_update(Z_ARRVAL_P(return_value), "mon_grouping", sizeof("mon_grouping")-1, &mon_grouping);
diff --git a/main/main.c b/main/main.c
index 95f6157d45..5eb34b7fa4 100644
--- a/main/main.c
+++ b/main/main.c
@@ -41,10 +41,7 @@
#endif
#include <signal.h>
-
-#if HAVE_SETLOCALE
#include <locale.h>
-#endif
#include "zend.h"
#include "zend_types.h"
#include "zend_extensions.h"
@@ -2176,11 +2173,8 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
zuf.getenv_function = sapi_getenv;
zuf.resolve_path_function = php_resolve_path_for_zend;
zend_startup(&zuf);
-
-#if HAVE_SETLOCALE
setlocale(LC_CTYPE, "");
zend_update_current_locale();
-#endif
#if HAVE_TZSET
tzset();
diff --git a/main/snprintf.c b/main/snprintf.c
index 15ed08175e..e3e0993ab5 100644
--- a/main/snprintf.c
+++ b/main/snprintf.c
@@ -34,7 +34,6 @@
#include <inttypes.h>
#endif
-#ifdef HAVE_LOCALE_H
#include <locale.h>
#ifdef ZTS
#include "ext/standard/php_string.h"
@@ -42,9 +41,6 @@
#else
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
#endif
-#else
-#define LCONV_DECIMAL_POINT '.'
-#endif
/*
* Copyright (c) 2002, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -612,13 +608,11 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
char num_buf[NUM_BUF_SIZE];
char char_buf[2]; /* for printing %% and %<unknown> */
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
struct lconv lconv;
#else
struct lconv *lconv = NULL;
#endif
-#endif
/*
* Flag variables
@@ -1025,7 +1019,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
s = "INF";
s_len = 3;
} else {
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
@@ -1033,7 +1026,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
lconv = localeconv();
}
#endif
-#endif
s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form,
(adjust_precision == NO) ? FLOAT_DIGITS : precision,
(*fmt == 'f')?LCONV_DECIMAL_POINT:'.',
@@ -1086,7 +1078,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
@@ -1094,7 +1085,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
lconv = localeconv();
}
#endif
-#endif
s = php_gcvt(fp_num, precision, (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]);
if (*s == '-') {
prefix_char = *s++;
diff --git a/main/spprintf.c b/main/spprintf.c
index 193da18c0a..a20705016a 100644
--- a/main/spprintf.c
+++ b/main/spprintf.c
@@ -89,7 +89,6 @@
#include <inttypes.h>
#endif
-#ifdef HAVE_LOCALE_H
#include <locale.h>
#ifdef ZTS
#include "ext/standard/php_string.h"
@@ -97,9 +96,6 @@
#else
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
#endif
-#else
-#define LCONV_DECIMAL_POINT '.'
-#endif
#include "snprintf.h"
@@ -215,13 +211,11 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
char num_buf[NUM_BUF_SIZE];
char char_buf[2]; /* for printing %% and %<unknown> */
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
struct lconv lconv;
#else
struct lconv *lconv = NULL;
#endif
-#endif
/*
* Flag variables
@@ -633,7 +627,6 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
s = "inf";
s_len = 3;
} else {
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
@@ -641,7 +634,6 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
lconv = localeconv();
}
#endif
-#endif
s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form,
(adjust_precision == NO) ? FLOAT_DIGITS : precision,
(*fmt == 'f')?LCONV_DECIMAL_POINT:'.',
@@ -693,7 +685,6 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
-#ifdef HAVE_LOCALE_H
#ifdef ZTS
localeconv_r(&lconv);
#else
@@ -701,7 +692,6 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
lconv = localeconv();
}
#endif
-#endif
s = php_gcvt(fp_num, precision, (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]);
if (*s == '-')
prefix_char = *s++;
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 8a461d8c44..14dccbde1e 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -47,9 +47,7 @@
#include <signal.h>
-#if HAVE_SETLOCALE
-# include <locale.h>
-#endif
+#include <locale.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 364fd13106..82051758f3 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -48,10 +48,7 @@
#endif
#include <signal.h>
-
-#if HAVE_SETLOCALE
#include <locale.h>
-#endif
#include "zend.h"
#include "zend_extensions.h"
#include "php_ini.h"
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index c814b73f26..46ba86e9c2 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -43,10 +43,10 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
+
#include <signal.h>
-#if HAVE_SETLOCALE
#include <locale.h>
-#endif
+
#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 3c637d5990..dd6671e102 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -45,9 +45,7 @@
#include <signal.h>
-#if HAVE_SETLOCALE
-# include <locale.h>
-#endif
+#include <locale.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
diff --git a/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c
index 95316e77c7..95f27b3c6f 100644
--- a/sapi/phpdbg/phpdbg_out.c
+++ b/sapi/phpdbg/phpdbg_out.c
@@ -114,13 +114,8 @@ typedef struct buf_area buffy;
*/
#define PREFIX( str, length, ch ) *--str = ch ; length++ ; has_prefix = YES
-
-#ifdef HAVE_LOCALE_H
#include <locale.h>
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
-#else
-#define LCONV_DECIMAL_POINT '.'
-#endif
#define NUL '\0'
#define S_NULL "(null)"
#define S_NULL_LEN 6
@@ -155,9 +150,7 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca
char num_buf[NUM_BUF_SIZE];
char char_buf[2]; /* for printing %% and %<unknown> */
-#ifdef HAVE_LOCALE_H
struct lconv *lconv = NULL;
-#endif
/*
* Flag variables
@@ -621,11 +614,10 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca
s = "INF";
s_len = 3;
} else {
-#ifdef HAVE_LOCALE_H
if (!lconv) {
lconv = localeconv();
}
-#endif
+
s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form,
(adjust_precision == NO) ? FLOAT_DIGITS : precision,
(*fmt == 'f')?LCONV_DECIMAL_POINT:'.',
@@ -678,11 +670,10 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
-#ifdef HAVE_LOCALE_H
if (!lconv) {
lconv = localeconv();
}
-#endif
+
s = php_gcvt(fp_num, precision, (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]);
if (*s == '-') {
prefix_char = *s++;
diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in
index 938af691a2..06632b0e20 100644
--- a/win32/build/config.w32.h.in
+++ b/win32/build/config.w32.h.in
@@ -76,8 +76,6 @@
#define HAVE_MEMMOVE 1
#define HAVE_PUTENV 1
#define HAVE_REGCOMP 1
-#define HAVE_SETLOCALE 1
-#define HAVE_LOCALECONV 1
#define HAVE_LOCALE_H 1
#ifndef HAVE_LIBBIND
# define HAVE_SETVBUF 1