Skip to content

Commit d776a93

Browse files
committed
Fix bug 61713 check also that mbstring's found any internal_encoding
1 parent 3a4a253 commit d776a93

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

ext/standard/html.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -785,18 +785,20 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
785785
charset_hint = Z_STRVAL_P(uf_result);
786786
len = Z_STRLEN_P(uf_result);
787787

788-
if (len == 4) { /* sizeof(none|auto|pass)-1 */
789-
if (!memcmp("pass", charset_hint, sizeof("pass") - 1) ||
790-
!memcmp("auto", charset_hint, sizeof("auto") - 1) ||
791-
!memcmp("none", charset_hint, sizeof("none") - 1)) {
792-
793-
charset_hint = NULL;
794-
len = 0;
788+
if (charset_hint != NULL && len != 0) {
789+
if (len == 4) { /* sizeof(none|auto|pass)-1 */
790+
if (!memcmp("pass", charset_hint, sizeof("pass") - 1) ||
791+
!memcmp("auto", charset_hint, sizeof("auto") - 1) ||
792+
!memcmp("none", charset_hint, sizeof("none") - 1)) {
793+
794+
charset_hint = NULL;
795+
len = 0;
796+
}
797+
} else {
798+
/* Jump to det_charset only if mbstring isn't one of above eq pass, auto, none.
799+
Otherwise try default_charset next */
800+
goto det_charset;
795801
}
796-
} else {
797-
/* Jump to det_charset only if mbstring isn't one of above eq pass, auto, none.
798-
Otherwise try default_charset next */
799-
goto det_charset;
800802
}
801803
}
802804
}

0 commit comments

Comments
 (0)