mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;
- if (strncasecmp(mimetype, "text/", 5) == 0 && strcasecmp(charset, "none") != 0) {
+ if (strncasecmp(mimetype, "text/", 5) == 0 && *charset) {
int len = strlen(mimetype) + sizeof("; charset=") + strlen(charset);
content_type = emalloc(len);
snprintf(content_type, len, "%s; charset=%s", mimetype, charset);
memcpy(default_header->header, "Content-type: ", sizeof("Content-type: "));
memcpy(default_header->header+sizeof("Content-type: ")-1, default_content_type, default_content_type_len);
default_header->header[default_header->header_len] = 0;
-
efree(default_content_type);
}
/*
* Add charset on content-type header if the MIME type starts with
- * "text/", the default_charset directive is not set to "none" and
+ * "text/", the default_charset directive is not empty and
* there is not already a charset option in there.
*
* If "mimetype" is non-NULL, it should point to a pointer allocated
int newlen;
charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;
- if (strcasecmp(charset, "none") != 0 && strncmp(*mimetype, "text/", 5) == 0 && strstr(*mimetype, "charset=") == NULL) {
+ if (*charset && strncmp(*mimetype, "text/", 5) == 0 && strstr(*mimetype, "charset=") == NULL) {
newlen = len + (sizeof(";charset=")-1) + strlen(charset);
newtype = emalloc(newlen + 1);
strlcpy(newtype, *mimetype, len);
}
-<INITIAL>[ ]*("false"|"off"|"no")[ ]* {
+<INITIAL>[ ]*("false"|"off"|"no"|"none")[ ]* {
cfglval->value.str.val = zend_strndup("",0);
cfglval->value.str.len = 0;
cfglval->type = IS_STRING;
return CFG_FALSE;
}
-
<INITIAL>[[][^[]+[\]]([\n]?|"\r\n"?) {
/* SECTION */
STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, auto_append_file, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, auto_prepend_file, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("default_charset", SAPI_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateStringUnempty, default_charset, sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("default_mimetype",SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateStringUnempty, default_mimetype, sapi_globals_struct,sapi_globals)
+ STD_PHP_INI_ENTRY("default_charset", SAPI_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct,sapi_globals)
+ STD_PHP_INI_ENTRY("default_mimetype",SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct,sapi_globals)
STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateString, error_log, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, gpc_order, php_core_globals, core_globals)
UpdateIniFromRegistry(primary_file->filename);
#endif
- if (PG(auto_prepend_file) && PG(auto_prepend_file)[0] &&
- strncmp(PG(auto_prepend_file), "none", 4) != 0) {
+ if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) {
prepend_file.filename = PG(auto_prepend_file);
prepend_file.free_filename = 0;
prepend_file.type = ZEND_HANDLE_FILENAME;
} else {
prepend_file_p = NULL;
}
- if (PG(auto_append_file) && PG(auto_append_file)[0] &&
- strncmp(PG(auto_append_file), "none", 4) != 0) {
+ if (PG(auto_append_file) && PG(auto_append_file)[0]) {
append_file.filename = PG(auto_append_file);
append_file.free_filename = 0;
append_file.type = ZEND_HANDLE_FILENAME;
; Directive names are *case sensitive* - foo=bar is different from FOO=bar.
;
; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one
-; of the INI constants (On, Off, True, False, Yes and No) or an expression
+; of the INI constants (On, Off, True, False, Yes, No and None) or an expression
; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo").
;
; Expressions in the INI file are limited to bitwise operators and parentheses:
; Boolean flags can be turned on using the values 1, On, True or Yes.
; They can be turned off using the values 0, Off, False or No.
;
+; An empty string can be denoted by simply not writing anything after the equal
+; sign, or by using the None keyword:
+;
+; foo = ; sets foo to an empty string
+; foo = none ; sets foo to an empty string
+; foo = "none" ; sets foo to the string 'none'
+;
; If you use constants in your value, and these constants belong to a dynamically
; loaded extension (either a PHP extension or a Zend extension), you may only
; use these constants *after* the line that loads the extension.
auto_append_file =
; As of 4.0b4, PHP always outputs a character encoding by default in
-; the Content-type: header. Set default_charset to "none" to disable
-; this. PHP's built-in default is text/html with the iso-8859-1
-; charset.
-;default_mimetype = "text/html"
-;default_charset = "iso-8859-1"
+; the Content-type: header. To disable sending of the charset, simply
+; set it to be empty.
+; PHP's built-in default is text/html with the iso-8859-1 charset.
+default_mimetype = "text/html"
+default_charset = "iso-8859-1"
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;