cvs: /php4 SAPI.c configuration-scanner.l main.c php.ini-dist

From: Date: Sat, 26 Feb 2000 14:29:58 +0000
Subject: cvs: /php4 SAPI.c configuration-scanner.l main.c php.ini-dist
Groups: php.version4 
Request: Send a blank email to php-version4+get-11037@lists.php.net to get a copy of this message
zeev Sat Feb 26 06:29:58 2000 EDT Modified files: /php4 SAPI.c configuration-scanner.l main.c php.ini-dist Log: @- The string None is now recognized as a keyword by the php.ini processor, and @ can be used to denote an empty string (Zeev) - Added None keyword support to the INI parser - Removed specialized "none" code Index: php4/SAPI.c diff -u php4/SAPI.c:1.64 php4/SAPI.c:1.65 --- php4/SAPI.c:1.64 Sat Feb 26 06:21:10 2000 +++ php4/SAPI.c Sat Feb 26 06:29:27 2000 @@ -184,7 +184,7 @@ 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); @@ -205,13 +205,12 @@ 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 @@ -226,7 +225,7 @@ 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); Index: php4/configuration-scanner.l diff -u php4/configuration-scanner.l:1.10 php4/configuration-scanner.l:1.11 --- php4/configuration-scanner.l:1.10 Sat Feb 19 15:21:25 2000 +++ php4/configuration-scanner.l Sat Feb 26 06:29:27 2000 @@ -77,13 +77,12 @@ } -<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 */ Index: php4/main.c diff -u php4/main.c:1.217 php4/main.c:1.218 --- php4/main.c:1.217 Fri Feb 25 15:31:42 2000 +++ php4/main.c Sat Feb 26 06:29:27 2000 @@ -19,7 +19,7 @@ */ -/* $Id: main.c,v 1.217 2000/02/25 23:31:42 rubys Exp $ */ +/* $Id: main.c,v 1.218 2000/02/26 14:29:27 zeev Exp $ */ #include <stdio.h> @@ -203,8 +203,8 @@ 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) @@ -1103,8 +1103,7 @@ 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; @@ -1112,8 +1111,7 @@ } 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; Index: php4/php.ini-dist diff -u php4/php.ini-dist:1.27 php4/php.ini-dist:1.28 --- php4/php.ini-dist:1.27 Fri Feb 25 13:27:02 2000 +++ php4/php.ini-dist Sat Feb 26 06:29:27 2000 @@ -21,7 +21,7 @@ ; 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: @@ -32,6 +32,13 @@ ; 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. @@ -184,11 +191,11 @@ 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 ;

« previous php.version4 (#11037) next »