wez             Thu Sep 26 12:07:14 2002 EDT

  Modified files:              
    /php4/ext/standard  html.c 
  Log:
  Emit a warning when an unsupported charset is requested in htmlentities.
  Fixed #18521.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.51 php4/ext/standard/html.c:1.52
--- php4/ext/standard/html.c:1.51       Tue Sep 24 06:05:45 2002
+++ php4/ext/standard/html.c    Thu Sep 26 12:07:14 2002
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: html.c,v 1.51 2002/09/24 10:05:45 wez Exp $ */
+/* $Id: html.c,v 1.52 2002/09/26 16:07:14 wez Exp $ */
 
 #include "php.h"
 #include "reg.h"
@@ -521,7 +521,7 @@
 /* {{{ entity_charset determine_charset
  * returns the charset identifier based on current locale or a hint.
  * defaults to iso-8859-1 */
-static enum entity_charset determine_charset(char *charset_hint)
+static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
 {
        int i;
        enum entity_charset charset = cs_8859_1;
@@ -572,13 +572,21 @@
 #endif
        }
        if (charset_hint)       {
-               if(!len) len = strlen(charset_hint);
+               int found = 0;
+               if (!len)
+                       len = strlen(charset_hint);
+               
                /* now walk the charset map and look for the codeset */
                for (i = 0; charset_map[i].codeset; i++)        {
                        if (strncasecmp(charset_hint, charset_map[i].codeset, len) == 
0)        {
                                charset = charset_map[i].charset;
+                               found = 1;
                                break;
                        }
+               }
+               if (!found) {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "charset `%s' not 
+supported, assuming iso-8859-1",
+                                       charset_hint);
                }
        }
        return charset;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to