]> granicus.if.org Git - php/commitdiff
Fixed bug #71876
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 3 Jan 2020 10:14:45 +0000 (11:14 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 3 Jan 2020 10:14:45 +0000 (11:14 +0100)
This is a backport of fcdc0a6db0ae63fbed9e3828137b899b844623ce
to the PHP-7.3 branch. We need to make sure that OnUpdateString
is also called for a NULL value, otherwise the reset of the encoding
at the end of the request will not work.

NEWS
main/main.c

diff --git a/NEWS b/NEWS
index eb1d2c4edd0931831c8a6e4eb1736cbd945516cd..bfa7ae5e5548e248c7a2085e0cfbd89d50613bd6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP                                                                        NEWS
 - Core
   . Fixed bug #78999 (Cycle leak when using function result as temporary).
     (Dmitry)
+  . Fixed bug #71876 (Memory corruption htmlspecialchars(): charset `*' not
+    supported). (Nikita)
 
 - CURL:
   . Implemented FR #77711 (CURLFile should support UNICODE filenames). (cmb)
index 6917fe32309537d7471b2fb66285cece8a9de4ad..30629117d91a65f7622df3176f05c261ee34623a 100644 (file)
@@ -588,8 +588,8 @@ static PHP_INI_DISP(display_errors_mode)
  */
 static PHP_INI_MH(OnUpdateDefaultCharset)
 {
+       OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
        if (new_value) {
-               OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
 #ifdef PHP_WIN32
                php_win32_cp_do_update(ZSTR_VAL(new_value));
 #endif
@@ -602,8 +602,8 @@ static PHP_INI_MH(OnUpdateDefaultCharset)
  */
 static PHP_INI_MH(OnUpdateInternalEncoding)
 {
+       OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
        if (new_value) {
-               OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
 #ifdef PHP_WIN32
                php_win32_cp_do_update(ZSTR_VAL(new_value));
 #endif
@@ -616,8 +616,8 @@ static PHP_INI_MH(OnUpdateInternalEncoding)
  */
 static PHP_INI_MH(OnUpdateInputEncoding)
 {
+       OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
        if (new_value) {
-               OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
 #ifdef PHP_WIN32
                php_win32_cp_do_update(NULL);
 #endif
@@ -630,8 +630,8 @@ static PHP_INI_MH(OnUpdateInputEncoding)
  */
 static PHP_INI_MH(OnUpdateOutputEncoding)
 {
+       OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
        if (new_value) {
-               OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
 #ifdef PHP_WIN32
                php_win32_cp_do_update(NULL);
 #endif