summaryrefslogtreecommitdiff
path: root/main/main.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-12-17 16:26:42 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-12-17 16:27:56 +0100
commitfcdc0a6db0ae63fbed9e3828137b899b844623ce (patch)
tree401e91c49eb198e9ea3ef21beb4a4990ff2a5b3b /main/main.c
parentdd997a40d0be9b03973b1317041f92ad9582237f (diff)
downloadphp-git-fcdc0a6db0ae63fbed9e3828137b899b844623ce.tar.gz
Fix resetting of internal_encoding and friends
We need to update the value even if new_value is NULL. In particular, it should be reset back to NULL after each request if the setting was not specified on startup. Otherwise we leave dangling pointers.
Diffstat (limited to 'main/main.c')
-rw-r--r--main/main.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/main/main.c b/main/main.c
index 5c81ea046d..7890b2ebeb 100644
--- a/main/main.c
+++ b/main/main.c
@@ -594,11 +594,11 @@ PHPAPI void (*php_internal_encoding_changed)(void) = NULL;
*/
static PHP_INI_MH(OnUpdateDefaultCharset)
{
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+ if (php_internal_encoding_changed) {
+ php_internal_encoding_changed();
+ }
if (new_value) {
- OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
- if (php_internal_encoding_changed) {
- php_internal_encoding_changed();
- }
#ifdef PHP_WIN32
php_win32_cp_do_update(ZSTR_VAL(new_value));
#endif
@@ -611,11 +611,11 @@ static PHP_INI_MH(OnUpdateDefaultCharset)
*/
static PHP_INI_MH(OnUpdateInternalEncoding)
{
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+ if (php_internal_encoding_changed) {
+ php_internal_encoding_changed();
+ }
if (new_value) {
- OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
- if (php_internal_encoding_changed) {
- php_internal_encoding_changed();
- }
#ifdef PHP_WIN32
php_win32_cp_do_update(ZSTR_VAL(new_value));
#endif
@@ -628,11 +628,11 @@ static PHP_INI_MH(OnUpdateInternalEncoding)
*/
static PHP_INI_MH(OnUpdateInputEncoding)
{
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+ if (php_internal_encoding_changed) {
+ php_internal_encoding_changed();
+ }
if (new_value) {
- OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
- if (php_internal_encoding_changed) {
- php_internal_encoding_changed();
- }
#ifdef PHP_WIN32
php_win32_cp_do_update(NULL);
#endif
@@ -645,11 +645,11 @@ static PHP_INI_MH(OnUpdateInputEncoding)
*/
static PHP_INI_MH(OnUpdateOutputEncoding)
{
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+ if (php_internal_encoding_changed) {
+ php_internal_encoding_changed();
+ }
if (new_value) {
- OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
- if (php_internal_encoding_changed) {
- php_internal_encoding_changed();
- }
#ifdef PHP_WIN32
php_win32_cp_do_update(NULL);
#endif