cvs: php4 /ext/session session.c /ext/standard basic_functions.c info.c /main configuration-parser.y main.c php_ini.c php_ini.h /sapi/aolserver
aolserver.c /sapi/apache mod_php4.c /sapi/apache2 mod_php4.c /sapi/apache2filter apache_config.c /sapi/cgi cgi_main.c /win32 registry.c
| From: | Zeev Suraski | Date: | Sun, 29 Oct 2000 11:38:27 +0000 |
| Subject: | cvs: php4 /ext/session session.c /ext/standard basic_functions.c info.c /main configuration-parser.y main.c php_ini.c php_ini.h /sapi/aolserver aolserver.c /sapi/apache mod_php4.c /sapi/apache2 mod_php4.c /sapi/apache2filter apache_config.c /sapi/cgi cgi_main.c /win32 registry.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2335@lists.php.net to get a copy of this message | ||
zeev Sun Oct 29 03:38:27 2000 EDT
Modified files:
/php4/ext/session session.c
/php4/ext/standard basic_functions.c info.c
/php4/main configuration-parser.y main.c php_ini.c php_ini.h
/php4/sapi/aolserver aolserver.c
/php4/sapi/apache mod_php4.c
/php4/sapi/apache2 mod_php4.c
/php4/sapi/apache2filter apache_config.c
/php4/sapi/cgi cgi_main.c
/php4/win32 registry.c
Log:
Initial steps to move the INI mechanism to the Zend engine
Index: php4/ext/session/session.c diff -u php4/ext/session/session.c:1.181 php4/ext/session/session.c:1.182 --- php4/ext/session/session.c:1.181 Sat Oct 28 10:13:28 2000 +++ php4/ext/session/session.c Sun Oct 29 03:38:24 2000 @@ -987,14 +987,14 @@ if (ZEND_NUM_ARGS() > 1) { convert_to_string_ex(path); - php_alter_ini_entry("session.cookie_path", sizeof("session.cookie_path"), Z_STRVAL_PP(path), Z_STRLEN_PP(path), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.cookie_path", sizeof("session.cookie_path"), Z_STRVAL_PP(path), Z_STRLEN_PP(path), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); if (ZEND_NUM_ARGS() > 2) { convert_to_string_ex(domain); - php_alter_ini_entry("session.cookie_domain", sizeof("session.cookie_domain"), Z_STRVAL_PP(domain), Z_STRLEN_PP(domain), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.cookie_domain", sizeof("session.cookie_domain"), Z_STRVAL_PP(domain), Z_STRLEN_PP(domain), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); if (ZEND_NUM_ARGS() > 3) { convert_to_long_ex(secure); - php_alter_ini_entry("session.cookie_secure", sizeof("session.cookie_secure"), Z_BVAL_PP(secure)?"1":"0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.cookie_secure", sizeof("session.cookie_secure"), Z_BVAL_PP(secure)?"1":"0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } } } @@ -1039,7 +1039,7 @@ if (ac == 1) { convert_to_string_ex(p_name); - php_alter_ini_entry("session.name", sizeof("session.name"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.name", sizeof("session.name"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } RETVAL_STRING(old, 0); @@ -1097,7 +1097,7 @@ if (PS(nr_open_sessions) > 0) RETURN_FALSE; - php_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); mdata = emalloc(sizeof(*mdata)); @@ -1128,7 +1128,7 @@ if (ac == 1) { convert_to_string_ex(p_name); - php_alter_ini_entry("session.save_path", sizeof("session.save_path"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.save_path", sizeof("session.save_path"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } RETVAL_STRING(old, 0); @@ -1176,7 +1176,7 @@ if (ac == 1) { convert_to_string_ex(p_cache_limiter); - php_alter_ini_entry("session.cache_limiter", sizeof("session.cache_limiter"), Z_STRVAL_PP(p_cache_limiter), Z_STRLEN_PP(p_cache_limiter), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.cache_limiter", sizeof("session.cache_limiter"), Z_STRVAL_PP(p_cache_limiter), Z_STRLEN_PP(p_cache_limiter), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } RETVAL_STRING(old, 0); Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.270 php4/ext/standard/basic_functions.c:1.271 --- php4/ext/standard/basic_functions.c:1.270 Fri Oct 27 18:31:56 2000 +++ php4/ext/standard/basic_functions.c Sun Oct 29 03:38:24 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.270 2000/10/28 01:31:56 zeev Exp $ */ +/* $Id: basic_functions.c,v 1.271 2000/10/29 11:38:24 zeev Exp $ */ #include "php.h" #include "php_main.h" @@ -1919,7 +1919,8 @@ RETVAL_FALSE; } - if (php_alter_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, (*new_value)->value.str.val, (*new_value)->value.str.len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)==FAILURE) { + if (zend_alter_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, (*new_value)->value.str.val, (*new_value)->value.str.len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)==FAILURE) { + zval_dtor(return_value); RETURN_FALSE; } } @@ -1937,7 +1938,7 @@ convert_to_string_ex(varname); - php_restore_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, PHP_INI_STAGE_RUNTIME); + zend_restore_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, PHP_INI_STAGE_RUNTIME); } /* }}} */ Index: php4/ext/standard/info.c diff -u php4/ext/standard/info.c:1.116 php4/ext/standard/info.c:1.117 --- php4/ext/standard/info.c:1.116 Wed Oct 11 06:51:32 2000 +++ php4/ext/standard/info.c Sun Oct 29 03:38:24 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.116 2000/10/11 13:51:32 hholzgra Exp $ */ +/* $Id: info.c,v 1.117 2000/10/29 11:38:24 zeev Exp $ */ #include "php.h" #include "php_ini.h" @@ -240,7 +240,7 @@ PUTS("</a></h1>\n"); } - php_ini_sort_entries(); + zend_ini_sort_entries(); if (flag & PHP_INFO_CONFIGURATION) { php_info_print_hr(); Index: php4/main/configuration-parser.y diff -u php4/main/configuration-parser.y:1.54 php4/main/configuration-parser.y:1.55 --- php4/main/configuration-parser.y:1.54 Thu Aug 31 15:23:53 2000 +++ php4/main/configuration-parser.y Sun Oct 29 03:38:24 2000 @@ -19,7 +19,7 @@ -/* $Id: configuration-parser.y,v 1.54 2000/08/31 22:23:53 andi Exp $ */ +/* $Id: configuration-parser.y,v 1.55 2000/10/29 11:38:24 zeev Exp $ */ #define DEBUG_CFG_PARSER 0 #include "php.h" @@ -453,7 +453,7 @@ case PARSING_MODE_CFG: zend_hash_update(active_hash_table, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(zval), NULL); if (active_hash_table == &configuration_hash) { - php_alter_ini_entry($1.value.str.val, $1.value.str.len+1, $3.value.str.val, $3.value.str.len+1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP); + zend_alter_ini_entry($1.value.str.val, $1.value.str.len+1, $3.value.str.val, $3.value.str.len+1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP); } break; case PARSING_MODE_BROWSCAP: Index: php4/main/main.c diff -u php4/main/main.c:1.330 php4/main/main.c:1.331 --- php4/main/main.c:1.330 Fri Oct 27 03:28:57 2000 +++ php4/main/main.c Sun Oct 29 03:38:24 2000 @@ -19,7 +19,7 @@ */ -/* $Id: main.c,v 1.330 2000/10/27 10:28:57 sas Exp $ */ +/* $Id: main.c,v 1.331 2000/10/29 11:38:24 zeev Exp $ */ #include <stdio.h> @@ -672,7 +672,7 @@ } if (setjmp(EG(bailout))==0) { - php_ini_rshutdown(); + zend_ini_rshutdown(); } zend_deactivate(CLS_C ELS_CC); @@ -862,7 +862,7 @@ le_index_ptr = zend_register_list_destructors_ex(NULL, NULL, "index pointer", 0); FREE_MUTEX(gLock); - php_ini_mstartup(); + zend_ini_mstartup(); if (php_config_ini_startup() == FAILURE) { return FAILURE; @@ -937,7 +937,7 @@ zend_shutdown(); php_shutdown_fopen_wrappers(); UNREGISTER_INI_ENTRIES(); - php_ini_mshutdown(); + zend_ini_mshutdown(); shutdown_memory_manager(0, 1); module_initialized = 0; } Index: php4/main/php_ini.c diff -u php4/main/php_ini.c:1.40 php4/main/php_ini.c:1.41 --- php4/main/php_ini.c:1.40 Sat Sep 9 08:02:15 2000 +++ php4/main/php_ini.c Sun Oct 29 03:38:24 2000 @@ -1,301 +1,36 @@ /* +----------------------------------------------------------------------+ - | PHP version 4.0 | + | PHP version 4.0 | +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group | + | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group | +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | + | This source file is subject to version 2.02 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.php.net/license/2_02.txt. | | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Zeev Suraski <zeev@zend.com> | + | Author: Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -#include <stdlib.h> - #include "php.h" -#include "php_ini.h" -#include "zend_alloc.h" -#include "php_globals.h" #include "ext/standard/info.h" +#include "zend_ini.h" -static HashTable known_directives; - - -/* - * hash_apply functions - */ -static int php_remove_ini_entries(php_ini_entry *ini_entry, int *module_number) -{ - if (ini_entry->module_number == *module_number) { - return 1; - } else { - return 0; - } -} - - -static int php_restore_ini_entry_cb(php_ini_entry *ini_entry, int stage) -{ - if (ini_entry->modified) { - if (ini_entry->on_modify) { - ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage); - } - efree(ini_entry->value); - ini_entry->value = ini_entry->orig_value; - ini_entry->value_length = ini_entry->orig_value_length; - ini_entry->modified = 0; - ini_entry->orig_value = NULL; - ini_entry->orig_value_length = 0; - } - return 0; -} - -/* - * Startup / shutdown - */ -int php_ini_mstartup() -{ - if (zend_hash_init_ex(&known_directives, 100, NULL, NULL, 1, 0)==FAILURE) { - return FAILURE; - } - return SUCCESS; -} - - -int php_ini_mshutdown() -{ - zend_hash_destroy(&known_directives); - return SUCCESS; -} - - -int php_ini_rshutdown() -{ - zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_restore_ini_entry_cb, (void *) PHP_INI_STAGE_DEACTIVATE); - return SUCCESS; -} - - -static int ini_key_compare(const void *a, const void *b) -{ - Bucket *f; - Bucket *s; - - f = *((Bucket **) a); - s = *((Bucket **) b); - - if (f->nKeyLength==0 && s->nKeyLength==0) { /* both numeric */ - return ZEND_NORMALIZE_BOOL(f->nKeyLength - s->nKeyLength); - } else if (f->nKeyLength==0) { /* f is numeric, s is not */ - return -1; - } else if (s->nKeyLength==0) { /* s is numeric, f is not */ - return 1; - } else { /* both strings */ - return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength); - } -} - - -void php_ini_sort_entries(void) -{ - zend_hash_sort(&known_directives, qsort, ini_key_compare, 0); -} - -/* - * Registration / unregistration - */ - -PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number) -{ - php_ini_entry *p = ini_entry; - php_ini_entry *hashed_ini_entry; - pval *default_value; - - while (p->name) { - p->module_number = module_number; - if (zend_hash_add(&known_directives, p->name, p->name_length, p, sizeof(php_ini_entry), (void **) &hashed_ini_entry)==FAILURE) { - php_unregister_ini_entries(module_number); - return FAILURE; - } - if ((default_value=cfg_get_entry(p->name, p->name_length))) { - if (!hashed_ini_entry->on_modify - || hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, PHP_INI_STAGE_STARTUP)==SUCCESS) { - hashed_ini_entry->value = default_value->value.str.val; - hashed_ini_entry->value_length = default_value->value.str.len; - } - } else { - if (hashed_ini_entry->on_modify) { - hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, PHP_INI_STAGE_STARTUP); - } - } - p++; - } - return SUCCESS; -} - - -PHPAPI void php_unregister_ini_entries(int module_number) -{ - zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_remove_ini_entries, (void *) &module_number); -} - - -static int php_ini_refresh_cache(php_ini_entry *p, int stage) -{ - if (p->on_modify) { - p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage); - } - return 0; -} - - -PHPAPI void php_ini_refresh_caches(int stage) -{ - zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_ini_refresh_cache, (void *) stage); -} - - -PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) -{ - php_ini_entry *ini_entry; - char *duplicate; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - if (!(ini_entry->modifyable & modify_type)) { - return FAILURE; - } - - duplicate = estrndup(new_value, new_value_length); - - if (!ini_entry->on_modify - || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage)==SUCCESS) { - if (!ini_entry->modified) { - ini_entry->orig_value = ini_entry->value; - ini_entry->orig_value_length = ini_entry->value_length; - } else { /* we already changed the value, free the changed value */ - efree(ini_entry->value); - } - ini_entry->value = duplicate; - ini_entry->value_length = new_value_length; - ini_entry->modified = 1; - } else { - efree(duplicate); - } - - return SUCCESS; -} - - -PHPAPI int php_restore_ini_entry(char *name, uint name_length, int stage) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - php_restore_ini_entry_cb(ini_entry, stage); - return SUCCESS; -} - - -PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type)) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - ini_entry->displayer = displayer; - return SUCCESS; -} - - - -/* - * Data retrieval - */ - -PHPAPI long php_ini_long(char *name, uint name_length, int orig) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0); - } else if (ini_entry->value) { - return strtol(ini_entry->value, NULL, 0); - } - } - - return 0; -} - - -PHPAPI double php_ini_double(char *name, uint name_length, int orig) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0); - } else if (ini_entry->value) { - return (double) strtod(ini_entry->value, NULL); - } - } - - return 0.0; -} - - -PHPAPI char *php_ini_string(char *name, uint name_length, int orig) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return ini_entry->orig_value; - } else { - return ini_entry->value; - } - } - - return ""; -} - -php_ini_entry *get_ini_entry(char *name, uint name_length) +static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type) { - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - return ini_entry; - } else { - return NULL; - } -} - - -static void php_ini_displayer_cb(php_ini_entry *ini_entry, int type) -{ if (ini_entry->displayer) { ini_entry->displayer(ini_entry, type); } else { char *display_string; uint display_string_length; - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { + if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { if (ini_entry->orig_value) { display_string = ini_entry->orig_value; display_string_length = ini_entry->orig_value_length; @@ -314,68 +49,8 @@ } } - -PHP_INI_DISP(php_ini_boolean_displayer_cb) -{ - int value; - - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = (ini_entry->orig_value ? atoi(ini_entry->orig_value) : 0); - } else if (ini_entry->value) { - value = atoi(ini_entry->value); - } else { - value = 0; - } - if (value) { - PUTS("On"); - } else { - PUTS("Off"); - } -} - - -PHP_INI_DISP(php_ini_color_displayer_cb) -{ - char *value; - - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value; - } else if (ini_entry->value) { - value = ini_entry->value; - } else { - value = NULL; - } - if (value) { - php_printf("<font color=\"%s\">%s</font>", value, value); - } else { - PUTS("<i>no value</i>;"); - } -} - - -PHP_INI_DISP(display_link_numbers) -{ - char *value; - - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value; - } else if (ini_entry->value) { - value = ini_entry->value; - } else { - value = NULL; - } - - if (value) { - if (atoi(value)==-1) { - PUTS("Unlimited"); - } else { - php_printf("%s", value); - } - } -} - -static int php_ini_displayer(php_ini_entry *ini_entry, int module_number) +static int php_ini_displayer(zend_ini_entry *ini_entry, int module_number) { if (ini_entry->module_number != module_number) { return 0; @@ -385,9 +60,9 @@ PUTS("<TD BGCOLOR=\"" PHP_ENTRY_NAME_COLOR "\"><B>"); PHPWRITE(ini_entry->name, ini_entry->name_length-1); PUTS("</B><BR></TD><TD ALIGN=\"center\">"); - php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ACTIVE); + php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE); PUTS("</TD><TD ALIGN=\"center\">"); - php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ORIG); + php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG); PUTS("</TD></TR>\n"); return 0; } @@ -399,138 +74,12 @@ if (module) { module_number = module->module_number; - } else { + } else { module_number = 0; } php_info_print_table_start(); php_info_print_table_header(3, "Directive", "Local Value", "Master Value"); - zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_ini_displayer, (void *) (long) module_number); + /*zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) zend_ini_displayer, (void *) (long) module_number); */ php_info_print_table_end(); } - -PHPAPI int php_atoi(const char *str, int str_len) -{ - int retval; - - if (!str_len) { - str_len = strlen(str); - } - retval = atoi(str); - if (str_len>0) { - switch (str[str_len-1]) { - case 'k': - case 'K': - retval *= 1024; - break; - case 'm': - case 'M': - retval *= 1048576; - break; - } - } - return retval; -} - - -/* Standard message handlers */ - -PHPAPI PHP_INI_MH(OnUpdateBool) -{ - zend_bool *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (zend_bool *) (base+(size_t) mh_arg1); - - *p = (zend_bool) atoi(new_value); - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateInt) -{ - long *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (long *) (base+(size_t) mh_arg1); - - *p = php_atoi(new_value, new_value_length); - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateReal) -{ - double *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (double *) (base+(size_t) mh_arg1); - - *p = strtod(new_value, NULL); - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateString) -{ - char **p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (char **) (base+(size_t) mh_arg1); - - *p = new_value; - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateStringUnempty) -{ - char **p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - if (new_value && !new_value[0]) { - return FAILURE; - } - - p = (char **) (base+(size_t) mh_arg1); - - *p = new_value; - return SUCCESS; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ Index: php4/main/php_ini.h diff -u php4/main/php_ini.h:1.26 php4/main/php_ini.h:1.27 --- php4/main/php_ini.h:1.26 Sat Sep 9 08:02:15 2000 +++ php4/main/php_ini.h Sun Oct 29 03:38:24 2000 @@ -19,141 +19,51 @@ #ifndef PHP_INI_H #define PHP_INI_H -#define PHP_INI_USER (1<<0) -#define PHP_INI_PERDIR (1<<1) -#define PHP_INI_SYSTEM (1<<2) - -#define PHP_INI_ALL (PHP_INI_USER|PHP_INI_PERDIR|PHP_INI_SYSTEM) - -typedef struct _php_ini_entry php_ini_entry; - -#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage) -#define PHP_INI_DISP(name) void name(php_ini_entry *ini_entry, int type) - -struct _php_ini_entry { - int module_number; - int modifyable; - char *name; - uint name_length; - PHP_INI_MH((*on_modify)); - void *mh_arg1; - void *mh_arg2; - void *mh_arg3; - - char *value; - uint value_length; - - char *orig_value; - uint orig_value_length; - int modified; - - void (*displayer)(php_ini_entry *ini_entry, int type); -}; - - -int php_ini_mstartup(void); -int php_ini_mshutdown(void); -int php_ini_rshutdown(void); - -void php_ini_sort_entries(void); - -PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number); -PHPAPI void php_unregister_ini_entries(int module_number); -PHPAPI void php_ini_refresh_caches(int stage); -PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage); -PHPAPI int php_restore_ini_entry(char *name, uint name_length, int stage); -PHPAPI void display_ini_entries(zend_module_entry *module); - -PHPAPI long php_ini_long(char *name, uint name_length, int orig); -PHPAPI double php_ini_double(char *name, uint name_length, int orig); -PHPAPI char *php_ini_string(char *name, uint name_length, int orig); -php_ini_entry *get_ini_entry(char *name, uint name_length); - -PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type)); -PHPAPI PHP_INI_DISP(php_ini_boolean_displayer_cb); -PHPAPI PHP_INI_DISP(php_ini_color_displayer_cb); -PHPAPI PHP_INI_DISP(display_link_numbers); - -#define PHP_INI_BEGIN() static php_ini_entry ini_entries[] = { -#define PHP_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } }; - -#define PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, displayer) \ - { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer }, - -#define PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, NULL) - -#define PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, displayer) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL, displayer) - -#define PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \ - PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL) - -#define PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, displayer) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, NULL, NULL, displayer) - -#define PHP_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \ - PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, NULL) - -#define PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, displayer) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, NULL, NULL, NULL, displayer) - -#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify) \ - PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, NULL) - -#ifdef ZTS -#define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id) -#define STD_PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \ - PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer) -#define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, php_ini_boolean_displayer_cb) -#else -#define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr) -#define STD_PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \ - PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer) -#define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, php_ini_boolean_displayer_cb) -#endif - -#define INI_INT(name) php_ini_long((name), sizeof(name), 0) -#define INI_FLT(name) php_ini_double((name), sizeof(name), 0) -#define INI_STR(name) php_ini_string((name), sizeof(name), 0) -#define INI_BOOL(name) ((zend_bool) INI_INT(name)) - -#define INI_ORIG_INT(name) php_ini_long((name), sizeof(name), 1) -#define INI_ORIG_FLT(name) php_ini_double((name), sizeof(name), 1) -#define INI_ORIG_STR(name) php_ini_string((name), sizeof(name), 1) -#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name)) - - -#define REGISTER_INI_ENTRIES() php_register_ini_entries(ini_entries, module_number) -#define UNREGISTER_INI_ENTRIES() php_unregister_ini_entries(module_number) -#define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module) - -#define REGISTER_INI_DISPLAYER(name, displayer) php_ini_register_displayer((name), sizeof(name), displayer) -#define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, php_ini_boolean_displayer_cb) - -pval *cfg_get_entry(char *name, uint name_length); - -PHPAPI int php_atoi(const char *str, int str_len); - -/* Standard message handlers */ -PHPAPI PHP_INI_MH(OnUpdateBool); -PHPAPI PHP_INI_MH(OnUpdateInt); -PHPAPI PHP_INI_MH(OnUpdateReal); -PHPAPI PHP_INI_MH(OnUpdateString); -PHPAPI PHP_INI_MH(OnUpdateStringUnempty); - - -#define PHP_INI_DISPLAY_ORIG 1 -#define PHP_INI_DISPLAY_ACTIVE 2 - -#define PHP_INI_STAGE_STARTUP (1<<0) -#define PHP_INI_STAGE_SHUTDOWN (1<<1) -#define PHP_INI_STAGE_ACTIVATE (1<<2) -#define PHP_INI_STAGE_DEACTIVATE (1<<3) -#define PHP_INI_STAGE_RUNTIME (1<<4) +#include "zend_ini.h" + +#define PHP_INI_USER ZEND_INI_USER +#define PHP_INI_PERDIR ZEND_INI_PERDIR +#define PHP_INI_SYSTEM ZEND_INI_SYSTEM + +#define PHP_INI_ALL ZEND_INI_ALL + +#define php_ini_entry zend_ini_entry + +#define PHP_INI_MH ZEND_INI_MH +#define PHP_INI_DISP ZEND_INI_DISP + +#define PHP_INI_BEGIN ZEND_INI_BEGIN +#define PHP_INI_END ZEND_INI_END + +#define PHP_INI_ENTRY3_EX ZEND_INI_ENTRY3_EX +#define PHP_INI_ENTRY3 ZEND_INI_ENTRY3 +#define PHP_INI_ENTRY2_EX ZEND_INI_ENTRY2_EX +#define PHP_INI_ENTRY2 ZEND_INI_ENTRY2 +#define PHP_INI_ENTRY1_EX ZEND_INI_ENTRY1_EX +#define PHP_INI_ENTRY1 ZEND_INI_ENTRY1 +#define PHP_INI_ENTRY_EX ZEND_INI_ENTRY_EX +#define PHP_INI_ENTRY ZEND_INI_ENTRY + +#define STD_PHP_INI_ENTRY STD_ZEND_INI_ENTRY +#define STD_PHP_INI_ENTRY_EX STD_ZEND_INI_ENTRY_EX +#define STD_PHP_INI_BOOLEAN STD_ZEND_INI_BOOLEAN + +#define PHP_INI_DISPLAY_ORIG ZEND_INI_DISPLAY_ORIG +#define PHP_INI_DISPLAY_ACTIVE ZEND_INI_DISPLAY_ACTIVE + +#define PHP_INI_STAGE_STARTUP ZEND_INI_STAGE_STARTUP +#define PHP_INI_STAGE_SHUTDOWN ZEND_INI_STAGE_SHUTDOWN +#define PHP_INI_STAGE_ACTIVATE ZEND_INI_STAGE_ACTIVATE +#define PHP_INI_STAGE_DEACTIVATE ZEND_INI_STAGE_DEACTIVATE +#define PHP_INI_STAGE_RUNTIME ZEND_INI_STAGE_RUNTIME + +#define php_ini_boolean_displayer_cb zend_ini_boolean_displayer_cb +#define php_ini_color_displayer_cb zend_ini_color_displayer_cb + +#define php_alter_ini_entry zend_alter_ini_entry + +#define php_ini_long zend_ini_long +#define php_ini_double zend_ini_double +#define php_ini_string zend_ini_string #endif /* PHP_INI_H */ Index: php4/sapi/aolserver/aolserver.c diff -u php4/sapi/aolserver/aolserver.c:1.49 php4/sapi/aolserver/aolserver.c:1.50 --- php4/sapi/aolserver/aolserver.c:1.49 Fri Sep 8 07:43:54 2000 +++ php4/sapi/aolserver/aolserver.c Sun Oct 29 03:38:25 2000 @@ -22,7 +22,7 @@ * - CGI/1.1 conformance */ -/* $Id: aolserver.c,v 1.49 2000/09/08 14:43:54 zeev Exp $ */ +/* $Id: aolserver.c,v 1.50 2000/10/29 11:38:25 zeev Exp $ */ /* conflict between PHP and AOLserver headers */ #define Debug php_Debug @@ -208,7 +208,7 @@ NSLS_FETCH(); php_info_print_table_start(); - php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.49 2000/09/08 14:43:54 zeev Exp $"); + php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.50 2000/10/29 11:38:25 zeev Exp $"); php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); @@ -559,7 +559,7 @@ } while(*val == ' '); Ns_Log(Debug, "PHP configuration option '%s=%s'", new_key, val); - php_alter_ini_entry(new_key, strlen(new_key) + 1, val, + zend_alter_ini_entry(new_key, strlen(new_key) + 1, val, strlen(val) + 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); efree(new_key); Index: php4/sapi/apache/mod_php4.c diff -u php4/sapi/apache/mod_php4.c:1.72 php4/sapi/apache/mod_php4.c:1.73 --- php4/sapi/apache/mod_php4.c:1.72 Fri Oct 13 10:07:09 2000 +++ php4/sapi/apache/mod_php4.c Sun Oct 29 03:38:25 2000 @@ -17,7 +17,7 @@ | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.c,v 1.72 2000/10/13 17:07:09 zeev Exp $ */ +/* $Id: mod_php4.c,v 1.73 2000/10/29 11:38:25 zeev Exp $ */ #define NO_REGEX_EXTRA_H #ifdef WIN32 @@ -415,7 +415,7 @@ static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry) { - php_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length+1, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length+1, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); return 0; } Index: php4/sapi/apache2/mod_php4.c diff -u php4/sapi/apache2/mod_php4.c:1.4 php4/sapi/apache2/mod_php4.c:1.5 --- php4/sapi/apache2/mod_php4.c:1.4 Sun Oct 22 17:52:11 2000 +++ php4/sapi/apache2/mod_php4.c Sun Oct 29 03:38:25 2000 @@ -15,7 +15,7 @@ | Authors: | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.c,v 1.4 2000/10/23 00:52:11 rasmus Exp $ */ +/* $Id: mod_php4.c,v 1.5 2000/10/29 11:38:25 zeev Exp $ */ #define NO_REGEX_EXTRA_H #ifdef WIN32 @@ -409,7 +409,7 @@ static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry) { - php_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length+1, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length+1, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); return 0; } Index: php4/sapi/apache2filter/apache_config.c diff -u php4/sapi/apache2filter/apache_config.c:1.2 php4/sapi/apache2filter/apache_config.c:1.3 --- php4/sapi/apache2filter/apache_config.c:1.2 Thu Oct 26 14:23:20 2000 +++ php4/sapi/apache2filter/apache_config.c Sun Oct 29 03:38:25 2000 @@ -94,7 +94,7 @@ zend_hash_move_forward(&d->config)) { zend_hash_get_current_data(&d->config, &data); fprintf(stderr, "APPLYING (%s)(%s)\n", str, data->value); - if (php_alter_ini_entry(str, str_len, data->value, data->value_len + 1, + if (zend_alter_ini_entry(str, str_len, data->value, data->value_len + 1, data->status, PHP_INI_STAGE_RUNTIME) == FAILURE) fprintf(stderr, "..FAILED\n"); } Index: php4/sapi/cgi/cgi_main.c diff -u php4/sapi/cgi/cgi_main.c:1.78 php4/sapi/cgi/cgi_main.c:1.79 --- php4/sapi/cgi/cgi_main.c:1.78 Sun Oct 29 01:14:54 2000 +++ php4/sapi/cgi/cgi_main.c Sun Oct 29 03:38:26 2000 @@ -346,7 +346,7 @@ } else { value = "1"; } - php_alter_ini_entry(name, strlen(name), value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(name, strlen(name), value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } Index: php4/win32/registry.c diff -u php4/win32/registry.c:1.7 php4/win32/registry.c:1.8 --- php4/win32/registry.c:1.7 Thu May 4 03:38:14 2000 +++ php4/win32/registry.c Sun Oct 29 03:38:26 2000 @@ -69,7 +69,7 @@ continue; } /*printf("%s -> %s\n", namebuf, valuebuf);*/ - php_alter_ini_entry(namebuf, namebuf_length+1, valuebuf, valuebuf_length+1, PHP_INI_PERDIR, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(namebuf, namebuf_length+1, valuebuf, valuebuf_length+1, PHP_INI_PERDIR, PHP_INI_STAGE_ACTIVATE); } RegCloseKey(hKey);
Index: php4/ext/session/session.c diff -u php4/ext/session/session.c:1.181 php4/ext/session/session.c:1.182 --- php4/ext/session/session.c:1.181 Sat Oct 28 10:13:28 2000 +++ php4/ext/session/session.c Sun Oct 29 03:38:24 2000 @@ -987,14 +987,14 @@ if (ZEND_NUM_ARGS() > 1) { convert_to_string_ex(path); - php_alter_ini_entry("session.cookie_path", sizeof("session.cookie_path"), Z_STRVAL_PP(path), Z_STRLEN_PP(path), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.cookie_path", sizeof("session.cookie_path"), Z_STRVAL_PP(path), Z_STRLEN_PP(path), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); if (ZEND_NUM_ARGS() > 2) { convert_to_string_ex(domain); - php_alter_ini_entry("session.cookie_domain", sizeof("session.cookie_domain"), Z_STRVAL_PP(domain), Z_STRLEN_PP(domain), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.cookie_domain", sizeof("session.cookie_domain"), Z_STRVAL_PP(domain), Z_STRLEN_PP(domain), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); if (ZEND_NUM_ARGS() > 3) { convert_to_long_ex(secure); - php_alter_ini_entry("session.cookie_secure", sizeof("session.cookie_secure"), Z_BVAL_PP(secure)?"1":"0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.cookie_secure", sizeof("session.cookie_secure"), Z_BVAL_PP(secure)?"1":"0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } } } @@ -1039,7 +1039,7 @@ if (ac == 1) { convert_to_string_ex(p_name); - php_alter_ini_entry("session.name", sizeof("session.name"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.name", sizeof("session.name"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } RETVAL_STRING(old, 0); @@ -1097,7 +1097,7 @@ if (PS(nr_open_sessions) > 0) RETURN_FALSE; - php_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); mdata = emalloc(sizeof(*mdata)); @@ -1128,7 +1128,7 @@ if (ac == 1) { convert_to_string_ex(p_name); - php_alter_ini_entry("session.save_path", sizeof("session.save_path"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.save_path", sizeof("session.save_path"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } RETVAL_STRING(old, 0); @@ -1176,7 +1176,7 @@ if (ac == 1) { convert_to_string_ex(p_cache_limiter); - php_alter_ini_entry("session.cache_limiter", sizeof("session.cache_limiter"), Z_STRVAL_PP(p_cache_limiter), Z_STRLEN_PP(p_cache_limiter), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry("session.cache_limiter", sizeof("session.cache_limiter"), Z_STRVAL_PP(p_cache_limiter), Z_STRLEN_PP(p_cache_limiter), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } RETVAL_STRING(old, 0); Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.270 php4/ext/standard/basic_functions.c:1.271 --- php4/ext/standard/basic_functions.c:1.270 Fri Oct 27 18:31:56 2000 +++ php4/ext/standard/basic_functions.c Sun Oct 29 03:38:24 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.270 2000/10/28 01:31:56 zeev Exp $ */ +/* $Id: basic_functions.c,v 1.271 2000/10/29 11:38:24 zeev Exp $ */ #include "php.h" #include "php_main.h" @@ -1919,7 +1919,8 @@ RETVAL_FALSE; } - if (php_alter_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, (*new_value)->value.str.val, (*new_value)->value.str.len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)==FAILURE) { + if (zend_alter_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, (*new_value)->value.str.val, (*new_value)->value.str.len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)==FAILURE) { + zval_dtor(return_value); RETURN_FALSE; } } @@ -1937,7 +1938,7 @@ convert_to_string_ex(varname); - php_restore_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, PHP_INI_STAGE_RUNTIME); + zend_restore_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, PHP_INI_STAGE_RUNTIME); } /* }}} */ Index: php4/ext/standard/info.c diff -u php4/ext/standard/info.c:1.116 php4/ext/standard/info.c:1.117 --- php4/ext/standard/info.c:1.116 Wed Oct 11 06:51:32 2000 +++ php4/ext/standard/info.c Sun Oct 29 03:38:24 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.116 2000/10/11 13:51:32 hholzgra Exp $ */ +/* $Id: info.c,v 1.117 2000/10/29 11:38:24 zeev Exp $ */ #include "php.h" #include "php_ini.h" @@ -240,7 +240,7 @@ PUTS("</a></h1>\n"); } - php_ini_sort_entries(); + zend_ini_sort_entries(); if (flag & PHP_INFO_CONFIGURATION) { php_info_print_hr(); Index: php4/main/configuration-parser.y diff -u php4/main/configuration-parser.y:1.54 php4/main/configuration-parser.y:1.55 --- php4/main/configuration-parser.y:1.54 Thu Aug 31 15:23:53 2000 +++ php4/main/configuration-parser.y Sun Oct 29 03:38:24 2000 @@ -19,7 +19,7 @@ -/* $Id: configuration-parser.y,v 1.54 2000/08/31 22:23:53 andi Exp $ */ +/* $Id: configuration-parser.y,v 1.55 2000/10/29 11:38:24 zeev Exp $ */ #define DEBUG_CFG_PARSER 0 #include "php.h" @@ -453,7 +453,7 @@ case PARSING_MODE_CFG: zend_hash_update(active_hash_table, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(zval), NULL); if (active_hash_table == &configuration_hash) { - php_alter_ini_entry($1.value.str.val, $1.value.str.len+1, $3.value.str.val, $3.value.str.len+1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP); + zend_alter_ini_entry($1.value.str.val, $1.value.str.len+1, $3.value.str.val, $3.value.str.len+1, PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP); } break; case PARSING_MODE_BROWSCAP: Index: php4/main/main.c diff -u php4/main/main.c:1.330 php4/main/main.c:1.331 --- php4/main/main.c:1.330 Fri Oct 27 03:28:57 2000 +++ php4/main/main.c Sun Oct 29 03:38:24 2000 @@ -19,7 +19,7 @@ */ -/* $Id: main.c,v 1.330 2000/10/27 10:28:57 sas Exp $ */ +/* $Id: main.c,v 1.331 2000/10/29 11:38:24 zeev Exp $ */ #include <stdio.h> @@ -672,7 +672,7 @@ } if (setjmp(EG(bailout))==0) { - php_ini_rshutdown(); + zend_ini_rshutdown(); } zend_deactivate(CLS_C ELS_CC); @@ -862,7 +862,7 @@ le_index_ptr = zend_register_list_destructors_ex(NULL, NULL, "index pointer", 0); FREE_MUTEX(gLock); - php_ini_mstartup(); + zend_ini_mstartup(); if (php_config_ini_startup() == FAILURE) { return FAILURE; @@ -937,7 +937,7 @@ zend_shutdown(); php_shutdown_fopen_wrappers(); UNREGISTER_INI_ENTRIES(); - php_ini_mshutdown(); + zend_ini_mshutdown(); shutdown_memory_manager(0, 1); module_initialized = 0; } Index: php4/main/php_ini.c diff -u php4/main/php_ini.c:1.40 php4/main/php_ini.c:1.41 --- php4/main/php_ini.c:1.40 Sat Sep 9 08:02:15 2000 +++ php4/main/php_ini.c Sun Oct 29 03:38:24 2000 @@ -1,301 +1,36 @@ /* +----------------------------------------------------------------------+ - | PHP version 4.0 | + | PHP version 4.0 | +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group | + | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group | +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | + | This source file is subject to version 2.02 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.php.net/license/2_02.txt. | | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Author: Zeev Suraski <zeev@zend.com> | + | Author: Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -#include <stdlib.h> - #include "php.h" -#include "php_ini.h" -#include "zend_alloc.h" -#include "php_globals.h" #include "ext/standard/info.h" +#include "zend_ini.h" -static HashTable known_directives; - - -/* - * hash_apply functions - */ -static int php_remove_ini_entries(php_ini_entry *ini_entry, int *module_number) -{ - if (ini_entry->module_number == *module_number) { - return 1; - } else { - return 0; - } -} - - -static int php_restore_ini_entry_cb(php_ini_entry *ini_entry, int stage) -{ - if (ini_entry->modified) { - if (ini_entry->on_modify) { - ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage); - } - efree(ini_entry->value); - ini_entry->value = ini_entry->orig_value; - ini_entry->value_length = ini_entry->orig_value_length; - ini_entry->modified = 0; - ini_entry->orig_value = NULL; - ini_entry->orig_value_length = 0; - } - return 0; -} - -/* - * Startup / shutdown - */ -int php_ini_mstartup() -{ - if (zend_hash_init_ex(&known_directives, 100, NULL, NULL, 1, 0)==FAILURE) { - return FAILURE; - } - return SUCCESS; -} - - -int php_ini_mshutdown() -{ - zend_hash_destroy(&known_directives); - return SUCCESS; -} - - -int php_ini_rshutdown() -{ - zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_restore_ini_entry_cb, (void *) PHP_INI_STAGE_DEACTIVATE); - return SUCCESS; -} - - -static int ini_key_compare(const void *a, const void *b) -{ - Bucket *f; - Bucket *s; - - f = *((Bucket **) a); - s = *((Bucket **) b); - - if (f->nKeyLength==0 && s->nKeyLength==0) { /* both numeric */ - return ZEND_NORMALIZE_BOOL(f->nKeyLength - s->nKeyLength); - } else if (f->nKeyLength==0) { /* f is numeric, s is not */ - return -1; - } else if (s->nKeyLength==0) { /* s is numeric, f is not */ - return 1; - } else { /* both strings */ - return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength); - } -} - - -void php_ini_sort_entries(void) -{ - zend_hash_sort(&known_directives, qsort, ini_key_compare, 0); -} - -/* - * Registration / unregistration - */ - -PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number) -{ - php_ini_entry *p = ini_entry; - php_ini_entry *hashed_ini_entry; - pval *default_value; - - while (p->name) { - p->module_number = module_number; - if (zend_hash_add(&known_directives, p->name, p->name_length, p, sizeof(php_ini_entry), (void **) &hashed_ini_entry)==FAILURE) { - php_unregister_ini_entries(module_number); - return FAILURE; - } - if ((default_value=cfg_get_entry(p->name, p->name_length))) { - if (!hashed_ini_entry->on_modify - || hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, PHP_INI_STAGE_STARTUP)==SUCCESS) { - hashed_ini_entry->value = default_value->value.str.val; - hashed_ini_entry->value_length = default_value->value.str.len; - } - } else { - if (hashed_ini_entry->on_modify) { - hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, PHP_INI_STAGE_STARTUP); - } - } - p++; - } - return SUCCESS; -} - - -PHPAPI void php_unregister_ini_entries(int module_number) -{ - zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_remove_ini_entries, (void *) &module_number); -} - - -static int php_ini_refresh_cache(php_ini_entry *p, int stage) -{ - if (p->on_modify) { - p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage); - } - return 0; -} - - -PHPAPI void php_ini_refresh_caches(int stage) -{ - zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_ini_refresh_cache, (void *) stage); -} - - -PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) -{ - php_ini_entry *ini_entry; - char *duplicate; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - if (!(ini_entry->modifyable & modify_type)) { - return FAILURE; - } - - duplicate = estrndup(new_value, new_value_length); - - if (!ini_entry->on_modify - || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage)==SUCCESS) { - if (!ini_entry->modified) { - ini_entry->orig_value = ini_entry->value; - ini_entry->orig_value_length = ini_entry->value_length; - } else { /* we already changed the value, free the changed value */ - efree(ini_entry->value); - } - ini_entry->value = duplicate; - ini_entry->value_length = new_value_length; - ini_entry->modified = 1; - } else { - efree(duplicate); - } - - return SUCCESS; -} - - -PHPAPI int php_restore_ini_entry(char *name, uint name_length, int stage) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - php_restore_ini_entry_cb(ini_entry, stage); - return SUCCESS; -} - - -PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type)) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) { - return FAILURE; - } - - ini_entry->displayer = displayer; - return SUCCESS; -} - - - -/* - * Data retrieval - */ - -PHPAPI long php_ini_long(char *name, uint name_length, int orig) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0); - } else if (ini_entry->value) { - return strtol(ini_entry->value, NULL, 0); - } - } - - return 0; -} - - -PHPAPI double php_ini_double(char *name, uint name_length, int orig) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0); - } else if (ini_entry->value) { - return (double) strtod(ini_entry->value, NULL); - } - } - - return 0.0; -} - - -PHPAPI char *php_ini_string(char *name, uint name_length, int orig) -{ - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - if (orig && ini_entry->modified) { - return ini_entry->orig_value; - } else { - return ini_entry->value; - } - } - - return ""; -} - -php_ini_entry *get_ini_entry(char *name, uint name_length) +static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type) { - php_ini_entry *ini_entry; - - if (zend_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) { - return ini_entry; - } else { - return NULL; - } -} - - -static void php_ini_displayer_cb(php_ini_entry *ini_entry, int type) -{ if (ini_entry->displayer) { ini_entry->displayer(ini_entry, type); } else { char *display_string; uint display_string_length; - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { + if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { if (ini_entry->orig_value) { display_string = ini_entry->orig_value; display_string_length = ini_entry->orig_value_length; @@ -314,68 +49,8 @@ } } - -PHP_INI_DISP(php_ini_boolean_displayer_cb) -{ - int value; - - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = (ini_entry->orig_value ? atoi(ini_entry->orig_value) : 0); - } else if (ini_entry->value) { - value = atoi(ini_entry->value); - } else { - value = 0; - } - if (value) { - PUTS("On"); - } else { - PUTS("Off"); - } -} - - -PHP_INI_DISP(php_ini_color_displayer_cb) -{ - char *value; - - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value; - } else if (ini_entry->value) { - value = ini_entry->value; - } else { - value = NULL; - } - if (value) { - php_printf("<font color=\"%s\">%s</font>", value, value); - } else { - PUTS("<i>no value</i>;"); - } -} - - -PHP_INI_DISP(display_link_numbers) -{ - char *value; - - if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value; - } else if (ini_entry->value) { - value = ini_entry->value; - } else { - value = NULL; - } - - if (value) { - if (atoi(value)==-1) { - PUTS("Unlimited"); - } else { - php_printf("%s", value); - } - } -} - -static int php_ini_displayer(php_ini_entry *ini_entry, int module_number) +static int php_ini_displayer(zend_ini_entry *ini_entry, int module_number) { if (ini_entry->module_number != module_number) { return 0; @@ -385,9 +60,9 @@ PUTS("<TD BGCOLOR=\"" PHP_ENTRY_NAME_COLOR "\"><B>"); PHPWRITE(ini_entry->name, ini_entry->name_length-1); PUTS("</B><BR></TD><TD ALIGN=\"center\">"); - php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ACTIVE); + php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE); PUTS("</TD><TD ALIGN=\"center\">"); - php_ini_displayer_cb(ini_entry, PHP_INI_DISPLAY_ORIG); + php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG); PUTS("</TD></TR>\n"); return 0; } @@ -399,138 +74,12 @@ if (module) { module_number = module->module_number; - } else { + } else { module_number = 0; } php_info_print_table_start(); php_info_print_table_header(3, "Directive", "Local Value", "Master Value"); - zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_ini_displayer, (void *) (long) module_number); + /*zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) zend_ini_displayer, (void *) (long) module_number); */ php_info_print_table_end(); } - -PHPAPI int php_atoi(const char *str, int str_len) -{ - int retval; - - if (!str_len) { - str_len = strlen(str); - } - retval = atoi(str); - if (str_len>0) { - switch (str[str_len-1]) { - case 'k': - case 'K': - retval *= 1024; - break; - case 'm': - case 'M': - retval *= 1048576; - break; - } - } - return retval; -} - - -/* Standard message handlers */ - -PHPAPI PHP_INI_MH(OnUpdateBool) -{ - zend_bool *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (zend_bool *) (base+(size_t) mh_arg1); - - *p = (zend_bool) atoi(new_value); - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateInt) -{ - long *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (long *) (base+(size_t) mh_arg1); - - *p = php_atoi(new_value, new_value_length); - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateReal) -{ - double *p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (double *) (base+(size_t) mh_arg1); - - *p = strtod(new_value, NULL); - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateString) -{ - char **p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - p = (char **) (base+(size_t) mh_arg1); - - *p = new_value; - return SUCCESS; -} - - -PHPAPI PHP_INI_MH(OnUpdateStringUnempty) -{ - char **p; -#ifndef ZTS - char *base = (char *) mh_arg2; -#else - char *base; - - base = (char *) ts_resource(*((int *) mh_arg2)); -#endif - - if (new_value && !new_value[0]) { - return FAILURE; - } - - p = (char **) (base+(size_t) mh_arg1); - - *p = new_value; - return SUCCESS; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ Index: php4/main/php_ini.h diff -u php4/main/php_ini.h:1.26 php4/main/php_ini.h:1.27 --- php4/main/php_ini.h:1.26 Sat Sep 9 08:02:15 2000 +++ php4/main/php_ini.h Sun Oct 29 03:38:24 2000 @@ -19,141 +19,51 @@ #ifndef PHP_INI_H #define PHP_INI_H -#define PHP_INI_USER (1<<0) -#define PHP_INI_PERDIR (1<<1) -#define PHP_INI_SYSTEM (1<<2) - -#define PHP_INI_ALL (PHP_INI_USER|PHP_INI_PERDIR|PHP_INI_SYSTEM) - -typedef struct _php_ini_entry php_ini_entry; - -#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage) -#define PHP_INI_DISP(name) void name(php_ini_entry *ini_entry, int type) - -struct _php_ini_entry { - int module_number; - int modifyable; - char *name; - uint name_length; - PHP_INI_MH((*on_modify)); - void *mh_arg1; - void *mh_arg2; - void *mh_arg3; - - char *value; - uint value_length; - - char *orig_value; - uint orig_value_length; - int modified; - - void (*displayer)(php_ini_entry *ini_entry, int type); -}; - - -int php_ini_mstartup(void); -int php_ini_mshutdown(void); -int php_ini_rshutdown(void); - -void php_ini_sort_entries(void); - -PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number); -PHPAPI void php_unregister_ini_entries(int module_number); -PHPAPI void php_ini_refresh_caches(int stage); -PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage); -PHPAPI int php_restore_ini_entry(char *name, uint name_length, int stage); -PHPAPI void display_ini_entries(zend_module_entry *module); - -PHPAPI long php_ini_long(char *name, uint name_length, int orig); -PHPAPI double php_ini_double(char *name, uint name_length, int orig); -PHPAPI char *php_ini_string(char *name, uint name_length, int orig); -php_ini_entry *get_ini_entry(char *name, uint name_length); - -PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type)); -PHPAPI PHP_INI_DISP(php_ini_boolean_displayer_cb); -PHPAPI PHP_INI_DISP(php_ini_color_displayer_cb); -PHPAPI PHP_INI_DISP(display_link_numbers); - -#define PHP_INI_BEGIN() static php_ini_entry ini_entries[] = { -#define PHP_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } }; - -#define PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, displayer) \ - { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer }, - -#define PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, NULL) - -#define PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, displayer) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL, displayer) - -#define PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \ - PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL) - -#define PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, displayer) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, NULL, NULL, displayer) - -#define PHP_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \ - PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, NULL) - -#define PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, displayer) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, NULL, NULL, NULL, displayer) - -#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify) \ - PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, NULL) - -#ifdef ZTS -#define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id) -#define STD_PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \ - PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer) -#define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, php_ini_boolean_displayer_cb) -#else -#define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr) -#define STD_PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \ - PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer) -#define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \ - PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, php_ini_boolean_displayer_cb) -#endif - -#define INI_INT(name) php_ini_long((name), sizeof(name), 0) -#define INI_FLT(name) php_ini_double((name), sizeof(name), 0) -#define INI_STR(name) php_ini_string((name), sizeof(name), 0) -#define INI_BOOL(name) ((zend_bool) INI_INT(name)) - -#define INI_ORIG_INT(name) php_ini_long((name), sizeof(name), 1) -#define INI_ORIG_FLT(name) php_ini_double((name), sizeof(name), 1) -#define INI_ORIG_STR(name) php_ini_string((name), sizeof(name), 1) -#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name)) - - -#define REGISTER_INI_ENTRIES() php_register_ini_entries(ini_entries, module_number) -#define UNREGISTER_INI_ENTRIES() php_unregister_ini_entries(module_number) -#define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module) - -#define REGISTER_INI_DISPLAYER(name, displayer) php_ini_register_displayer((name), sizeof(name), displayer) -#define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, php_ini_boolean_displayer_cb) - -pval *cfg_get_entry(char *name, uint name_length); - -PHPAPI int php_atoi(const char *str, int str_len); - -/* Standard message handlers */ -PHPAPI PHP_INI_MH(OnUpdateBool); -PHPAPI PHP_INI_MH(OnUpdateInt); -PHPAPI PHP_INI_MH(OnUpdateReal); -PHPAPI PHP_INI_MH(OnUpdateString); -PHPAPI PHP_INI_MH(OnUpdateStringUnempty); - - -#define PHP_INI_DISPLAY_ORIG 1 -#define PHP_INI_DISPLAY_ACTIVE 2 - -#define PHP_INI_STAGE_STARTUP (1<<0) -#define PHP_INI_STAGE_SHUTDOWN (1<<1) -#define PHP_INI_STAGE_ACTIVATE (1<<2) -#define PHP_INI_STAGE_DEACTIVATE (1<<3) -#define PHP_INI_STAGE_RUNTIME (1<<4) +#include "zend_ini.h" + +#define PHP_INI_USER ZEND_INI_USER +#define PHP_INI_PERDIR ZEND_INI_PERDIR +#define PHP_INI_SYSTEM ZEND_INI_SYSTEM + +#define PHP_INI_ALL ZEND_INI_ALL + +#define php_ini_entry zend_ini_entry + +#define PHP_INI_MH ZEND_INI_MH +#define PHP_INI_DISP ZEND_INI_DISP + +#define PHP_INI_BEGIN ZEND_INI_BEGIN +#define PHP_INI_END ZEND_INI_END + +#define PHP_INI_ENTRY3_EX ZEND_INI_ENTRY3_EX +#define PHP_INI_ENTRY3 ZEND_INI_ENTRY3 +#define PHP_INI_ENTRY2_EX ZEND_INI_ENTRY2_EX +#define PHP_INI_ENTRY2 ZEND_INI_ENTRY2 +#define PHP_INI_ENTRY1_EX ZEND_INI_ENTRY1_EX +#define PHP_INI_ENTRY1 ZEND_INI_ENTRY1 +#define PHP_INI_ENTRY_EX ZEND_INI_ENTRY_EX +#define PHP_INI_ENTRY ZEND_INI_ENTRY + +#define STD_PHP_INI_ENTRY STD_ZEND_INI_ENTRY +#define STD_PHP_INI_ENTRY_EX STD_ZEND_INI_ENTRY_EX +#define STD_PHP_INI_BOOLEAN STD_ZEND_INI_BOOLEAN + +#define PHP_INI_DISPLAY_ORIG ZEND_INI_DISPLAY_ORIG +#define PHP_INI_DISPLAY_ACTIVE ZEND_INI_DISPLAY_ACTIVE + +#define PHP_INI_STAGE_STARTUP ZEND_INI_STAGE_STARTUP +#define PHP_INI_STAGE_SHUTDOWN ZEND_INI_STAGE_SHUTDOWN +#define PHP_INI_STAGE_ACTIVATE ZEND_INI_STAGE_ACTIVATE +#define PHP_INI_STAGE_DEACTIVATE ZEND_INI_STAGE_DEACTIVATE +#define PHP_INI_STAGE_RUNTIME ZEND_INI_STAGE_RUNTIME + +#define php_ini_boolean_displayer_cb zend_ini_boolean_displayer_cb +#define php_ini_color_displayer_cb zend_ini_color_displayer_cb + +#define php_alter_ini_entry zend_alter_ini_entry + +#define php_ini_long zend_ini_long +#define php_ini_double zend_ini_double +#define php_ini_string zend_ini_string #endif /* PHP_INI_H */ Index: php4/sapi/aolserver/aolserver.c diff -u php4/sapi/aolserver/aolserver.c:1.49 php4/sapi/aolserver/aolserver.c:1.50 --- php4/sapi/aolserver/aolserver.c:1.49 Fri Sep 8 07:43:54 2000 +++ php4/sapi/aolserver/aolserver.c Sun Oct 29 03:38:25 2000 @@ -22,7 +22,7 @@ * - CGI/1.1 conformance */ -/* $Id: aolserver.c,v 1.49 2000/09/08 14:43:54 zeev Exp $ */ +/* $Id: aolserver.c,v 1.50 2000/10/29 11:38:25 zeev Exp $ */ /* conflict between PHP and AOLserver headers */ #define Debug php_Debug @@ -208,7 +208,7 @@ NSLS_FETCH(); php_info_print_table_start(); - php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.49 2000/09/08 14:43:54 zeev Exp $"); + php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.50 2000/10/29 11:38:25 zeev Exp $"); php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); @@ -559,7 +559,7 @@ } while(*val == ' '); Ns_Log(Debug, "PHP configuration option '%s=%s'", new_key, val); - php_alter_ini_entry(new_key, strlen(new_key) + 1, val, + zend_alter_ini_entry(new_key, strlen(new_key) + 1, val, strlen(val) + 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); efree(new_key); Index: php4/sapi/apache/mod_php4.c diff -u php4/sapi/apache/mod_php4.c:1.72 php4/sapi/apache/mod_php4.c:1.73 --- php4/sapi/apache/mod_php4.c:1.72 Fri Oct 13 10:07:09 2000 +++ php4/sapi/apache/mod_php4.c Sun Oct 29 03:38:25 2000 @@ -17,7 +17,7 @@ | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.c,v 1.72 2000/10/13 17:07:09 zeev Exp $ */ +/* $Id: mod_php4.c,v 1.73 2000/10/29 11:38:25 zeev Exp $ */ #define NO_REGEX_EXTRA_H #ifdef WIN32 @@ -415,7 +415,7 @@ static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry) { - php_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length+1, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length+1, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); return 0; } Index: php4/sapi/apache2/mod_php4.c diff -u php4/sapi/apache2/mod_php4.c:1.4 php4/sapi/apache2/mod_php4.c:1.5 --- php4/sapi/apache2/mod_php4.c:1.4 Sun Oct 22 17:52:11 2000 +++ php4/sapi/apache2/mod_php4.c Sun Oct 29 03:38:25 2000 @@ -15,7 +15,7 @@ | Authors: | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.c,v 1.4 2000/10/23 00:52:11 rasmus Exp $ */ +/* $Id: mod_php4.c,v 1.5 2000/10/29 11:38:25 zeev Exp $ */ #define NO_REGEX_EXTRA_H #ifdef WIN32 @@ -409,7 +409,7 @@ static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry) { - php_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length+1, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length+1, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); return 0; } Index: php4/sapi/apache2filter/apache_config.c diff -u php4/sapi/apache2filter/apache_config.c:1.2 php4/sapi/apache2filter/apache_config.c:1.3 --- php4/sapi/apache2filter/apache_config.c:1.2 Thu Oct 26 14:23:20 2000 +++ php4/sapi/apache2filter/apache_config.c Sun Oct 29 03:38:25 2000 @@ -94,7 +94,7 @@ zend_hash_move_forward(&d->config)) { zend_hash_get_current_data(&d->config, &data); fprintf(stderr, "APPLYING (%s)(%s)\n", str, data->value); - if (php_alter_ini_entry(str, str_len, data->value, data->value_len + 1, + if (zend_alter_ini_entry(str, str_len, data->value, data->value_len + 1, data->status, PHP_INI_STAGE_RUNTIME) == FAILURE) fprintf(stderr, "..FAILED\n"); } Index: php4/sapi/cgi/cgi_main.c diff -u php4/sapi/cgi/cgi_main.c:1.78 php4/sapi/cgi/cgi_main.c:1.79 --- php4/sapi/cgi/cgi_main.c:1.78 Sun Oct 29 01:14:54 2000 +++ php4/sapi/cgi/cgi_main.c Sun Oct 29 03:38:26 2000 @@ -346,7 +346,7 @@ } else { value = "1"; } - php_alter_ini_entry(name, strlen(name), value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(name, strlen(name), value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } Index: php4/win32/registry.c diff -u php4/win32/registry.c:1.7 php4/win32/registry.c:1.8 --- php4/win32/registry.c:1.7 Thu May 4 03:38:14 2000 +++ php4/win32/registry.c Sun Oct 29 03:38:26 2000 @@ -69,7 +69,7 @@ continue; } /*printf("%s -> %s\n", namebuf, valuebuf);*/ - php_alter_ini_entry(namebuf, namebuf_length+1, valuebuf, valuebuf_length+1, PHP_INI_PERDIR, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(namebuf, namebuf_length+1, valuebuf, valuebuf_length+1, PHP_INI_PERDIR, PHP_INI_STAGE_ACTIVATE); } RegCloseKey(hKey);