]> granicus.if.org Git - php/commitdiff
Fix bug 61713 check also that mbstring's found any internal_encoding
authorAnatoliy Belsky <ab@php.net>
Tue, 8 May 2012 16:31:11 +0000 (18:31 +0200)
committerAnatoliy Belsky <ab@php.net>
Tue, 8 May 2012 16:31:11 +0000 (18:31 +0200)
ext/standard/html.c

index c813af523cd203996ea3dafcb7ae4a700c59edc4..058708e28b9a21adc6bd93ea3b2e8be6e884cb8d 100644 (file)
@@ -785,18 +785,20 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
                        charset_hint = Z_STRVAL_P(uf_result);
                        len = Z_STRLEN_P(uf_result);
                        
-                       if (len == 4) { /* sizeof(none|auto|pass)-1 */
-                               if (!memcmp("pass", charset_hint, sizeof("pass") - 1) || 
-                                   !memcmp("auto", charset_hint, sizeof("auto") - 1) || 
-                                   !memcmp("none", charset_hint, sizeof("none") - 1)) {
-                                       
-                                       charset_hint = NULL;
-                                       len = 0;
+                       if (charset_hint != NULL && len != 0) {
+                               if (len == 4) { /* sizeof(none|auto|pass)-1 */
+                                       if (!memcmp("pass", charset_hint, sizeof("pass") - 1) ||
+                                               !memcmp("auto", charset_hint, sizeof("auto") - 1) ||
+                                               !memcmp("none", charset_hint, sizeof("none") - 1)) {
+
+                                               charset_hint = NULL;
+                                               len = 0;
+                                       }
+                               } else {
+                                       /* Jump to det_charset only if mbstring isn't one of above eq pass, auto, none.
+                                          Otherwise try default_charset next */
+                                       goto det_charset;
                                }
-                       } else {
-                               /* Jump to det_charset only if mbstring isn't one of above eq pass, auto, none.
-                                  Otherwise try default_charset next */
-                               goto det_charset;
                        }
                }
        }