Skip to content

Commit 1f9e936

Browse files
committed
Fixed bug #71876
This is a backport of fcdc0a6 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.
1 parent 0cecf83 commit 1f9e936

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ PHP NEWS
55
- Core
66
. Fixed bug #78999 (Cycle leak when using function result as temporary).
77
(Dmitry)
8+
. Fixed bug #71876 (Memory corruption htmlspecialchars(): charset `*' not
9+
supported). (Nikita)
810

911
- CURL:
1012
. Implemented FR #77711 (CURLFile should support UNICODE filenames). (cmb)

main/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,8 @@ static PHP_INI_DISP(display_errors_mode)
588588
*/
589589
static PHP_INI_MH(OnUpdateDefaultCharset)
590590
{
591+
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
591592
if (new_value) {
592-
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
593593
#ifdef PHP_WIN32
594594
php_win32_cp_do_update(ZSTR_VAL(new_value));
595595
#endif
@@ -602,8 +602,8 @@ static PHP_INI_MH(OnUpdateDefaultCharset)
602602
*/
603603
static PHP_INI_MH(OnUpdateInternalEncoding)
604604
{
605+
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
605606
if (new_value) {
606-
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
607607
#ifdef PHP_WIN32
608608
php_win32_cp_do_update(ZSTR_VAL(new_value));
609609
#endif
@@ -616,8 +616,8 @@ static PHP_INI_MH(OnUpdateInternalEncoding)
616616
*/
617617
static PHP_INI_MH(OnUpdateInputEncoding)
618618
{
619+
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
619620
if (new_value) {
620-
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
621621
#ifdef PHP_WIN32
622622
php_win32_cp_do_update(NULL);
623623
#endif
@@ -630,8 +630,8 @@ static PHP_INI_MH(OnUpdateInputEncoding)
630630
*/
631631
static PHP_INI_MH(OnUpdateOutputEncoding)
632632
{
633+
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
633634
if (new_value) {
634-
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
635635
#ifdef PHP_WIN32
636636
php_win32_cp_do_update(NULL);
637637
#endif

0 commit comments

Comments
 (0)