From c3e3c98ec666812daaaca896cf5ef758a8a6df14 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 25 Aug 2014 19:24:55 +0200 Subject: master renames phase 1 --- main/php_ini.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'main/php_ini.c') diff --git a/main/php_ini.c b/main/php_ini.c index 54944483d2..8621af24d7 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -200,7 +200,7 @@ PHPAPI void config_zval_dtor(zval *zvalue) zend_hash_destroy(Z_ARRVAL_P(zvalue)); free(Z_ARR_P(zvalue)); } else if (Z_TYPE_P(zvalue) == IS_STRING) { - STR_RELEASE(Z_STR_P(zvalue)); + zend_string_release(Z_STR_P(zvalue)); } } /* Reset / free active_ini_sectin global */ @@ -233,17 +233,17 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* PHP and Zend extensions are not added into configuration hash! */ if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), PHP_EXTENSION_TOKEN)) { /* load PHP extension */ - extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)); zend_llist_add_element(&extension_lists.functions, &extension_name); } else if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */ - extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)); zend_llist_add_element(&extension_lists.engine, &extension_name); /* All other entries are added into either configuration_hash or active ini section array */ } else { /* Store in active hash */ entry = zend_hash_update(active_hash, Z_STR_P(arg1), arg2); - Z_STR_P(entry) = STR_DUP(Z_STR_P(entry), 1); + Z_STR_P(entry) = zend_string_dup(Z_STR_P(entry), 1); } } break; @@ -267,12 +267,12 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t } /* arg3 is possible option offset name */ - if (arg3 && Z_STRSIZE_P(arg3) > 0) { + if (arg3 && Z_STRLEN_P(arg3) > 0) { entry = zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STR_P(arg3), arg2); } else { entry = zend_hash_next_index_insert(Z_ARRVAL_P(find_arr), arg2); } - Z_STR_P(entry) = STR_DUP(Z_STR_P(entry), 1); + Z_STR_P(entry) = zend_string_dup(Z_STR_P(entry), 1); } break; @@ -287,7 +287,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t if (!strncasecmp(Z_STRVAL_P(arg1), "PATH", sizeof("PATH") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("PATH") - 1; - key_len = Z_STRSIZE_P(arg1) - sizeof("PATH") + 1; + key_len = Z_STRLEN_P(arg1) - sizeof("PATH") + 1; is_special_section = 1; has_per_dir_config = 1; @@ -298,7 +298,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t } else if (!strncasecmp(Z_STRVAL_P(arg1), "HOST", sizeof("HOST") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("HOST") - 1; - key_len = Z_STRSIZE_P(arg1) - sizeof("HOST") + 1; + key_len = Z_STRLEN_P(arg1) - sizeof("HOST") + 1; is_special_section = 1; has_per_host_config = 1; zend_str_tolower(key, key_len); /* host names are case-insensitive. */ @@ -593,12 +593,12 @@ int php_init_config(TSRMLS_D) { zval tmp; - ZVAL_NEW_STR(&tmp, STR_INIT(fh.filename, strlen(fh.filename), 1)); + ZVAL_NEW_STR(&tmp, zend_string_init(fh.filename, strlen(fh.filename), 1)); zend_hash_str_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path")-1, &tmp); if (php_ini_opened_path) { efree(php_ini_opened_path); } - php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); + php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); } } @@ -778,7 +778,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int { zend_string *str; zval *data; - zend_uint_t num_index; + zend_ulong num_index; /* Walk through config hash and alter matching ini entries using the values found in the hash */ for (zend_hash_internal_pointer_reset(source_hash); @@ -786,7 +786,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int zend_hash_move_forward(source_hash) ) { data = zend_hash_get_current_data(source_hash); - zend_alter_ini_entry_ex(str, Z_STRVAL_P(data), Z_STRSIZE_P(data), modify_type, stage, 0 TSRMLS_CC); + zend_alter_ini_entry_ex(str, Z_STRVAL_P(data), Z_STRLEN_P(data), modify_type, stage, 0 TSRMLS_CC); } } /* }}} */ @@ -873,9 +873,9 @@ PHPAPI zval *cfg_get_entry(const char *name, uint name_length) } /* }}} */ -/* {{{ cfg_get_int +/* {{{ cfg_get_long */ -PHPAPI int cfg_get_int(const char *varname, zend_int_t *result) +PHPAPI int cfg_get_long(const char *varname, zend_long *result) { zval *tmp, var; @@ -885,7 +885,7 @@ PHPAPI int cfg_get_int(const char *varname, zend_int_t *result) } ZVAL_DUP(&var, tmp); convert_to_int(&var); - *result = Z_IVAL(var); + *result = Z_LVAL(var); return SUCCESS; } /* }}} */ -- cgit v1.2.1 From 4d997f63d98c663b2d9acccd3655572652f61c7d Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 25 Aug 2014 20:22:49 +0200 Subject: master renames phase 3 --- main/php_ini.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main/php_ini.c') diff --git a/main/php_ini.c b/main/php_ini.c index 8621af24d7..c94e412094 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -545,7 +545,7 @@ int php_init_config(TSRMLS_D) /* Check if php_ini_file_name is a file and can be opened */ if (php_ini_file_name && php_ini_file_name[0]) { - php_stat_t statbuf; + zend_stat_t statbuf; if (!VCWD_STAT(php_ini_file_name, &statbuf)) { if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) { @@ -614,7 +614,7 @@ int php_init_config(TSRMLS_D) if (!sapi_module.php_ini_ignore && php_ini_scanned_path_len) { struct dirent **namelist; int ndir, i; - php_stat_t sb; + zend_stat_t sb; char ini_file[MAXPATHLEN]; char *p; zend_file_handle fh2; @@ -744,7 +744,7 @@ void php_ini_register_extensions(TSRMLS_D) */ PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, HashTable *target_hash TSRMLS_DC) { - php_stat_t sb; + zend_stat_t sb; char ini_file[MAXPATHLEN]; zend_file_handle fh; -- cgit v1.2.1 From af59e92b24c8f624672720d47ef65bd8457728b9 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 25 Aug 2014 21:51:49 +0200 Subject: master renames phase 7 --- main/php_ini.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main/php_ini.c') diff --git a/main/php_ini.c b/main/php_ini.c index c94e412094..783802c806 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -884,7 +884,7 @@ PHPAPI int cfg_get_long(const char *varname, zend_long *result) return FAILURE; } ZVAL_DUP(&var, tmp); - convert_to_int(&var); + convert_to_long(&var); *result = Z_LVAL(var); return SUCCESS; } -- cgit v1.2.1 From 88d7ca44f645c6e1bbdb17affd7a34113911093d Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 1 Sep 2014 20:57:33 +0400 Subject: Refactored INI subsystem to use zend_string* instead of char* --- main/php_ini.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'main/php_ini.c') diff --git a/main/php_ini.c b/main/php_ini.c index 783802c806..38dcf72747 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -83,9 +83,9 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC) uint display_string_length, esc_html=0; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { - if (ini_entry->orig_value && ini_entry->orig_value[0]) { - display_string = ini_entry->orig_value; - display_string_length = ini_entry->orig_value_length; + if (ini_entry->orig_value && ini_entry->orig_value->val[0]) { + display_string = ini_entry->orig_value->val; + display_string_length = ini_entry->orig_value->len; esc_html = !sapi_module.phpinfo_as_text; } else { if (!sapi_module.phpinfo_as_text) { @@ -96,9 +96,9 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC) display_string_length = sizeof("no value") - 1; } } - } else if (ini_entry->value && ini_entry->value[0]) { - display_string = ini_entry->value; - display_string_length = ini_entry->value_length; + } else if (ini_entry->value && ini_entry->value->val[0]) { + display_string = ini_entry->value->val; + display_string_length = ini_entry->value->len; esc_html = !sapi_module.phpinfo_as_text; } else { if (!sapi_module.phpinfo_as_text) { @@ -132,14 +132,14 @@ static int php_ini_displayer(zval *el, void *arg TSRMLS_DC) if (!sapi_module.phpinfo_as_text) { PUTS(""); PUTS(""); - PHPWRITE(ini_entry->name, ini_entry->name_length); + PHPWRITE(ini_entry->name->val, ini_entry->name->len); PUTS(""); php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE TSRMLS_CC); PUTS(""); php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG TSRMLS_CC); PUTS("\n"); } else { - PHPWRITE(ini_entry->name, ini_entry->name_length); + PHPWRITE(ini_entry->name->val, ini_entry->name->len); PUTS(" => "); php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE TSRMLS_CC); PUTS(" => "); @@ -355,7 +355,6 @@ static void php_load_php_extension_cb(void *arg TSRMLS_DC) static void php_load_zend_extension_cb(void *arg TSRMLS_DC) { char *filename = *((char **) arg); - const int length = strlen(filename); if (IS_ABSOLUTE_PATH(filename, length)) { zend_load_extension(filename TSRMLS_CC); @@ -786,7 +785,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int zend_hash_move_forward(source_hash) ) { data = zend_hash_get_current_data(source_hash); - zend_alter_ini_entry_ex(str, Z_STRVAL_P(data), Z_STRLEN_P(data), modify_type, stage, 0 TSRMLS_CC); + zend_alter_ini_entry_ex(str, Z_STR_P(data), modify_type, stage, 0 TSRMLS_CC); } } /* }}} */ @@ -865,6 +864,14 @@ PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSR } /* }}} */ +/* {{{ cfg_get_entry + */ +PHPAPI zval *cfg_get_entry_ex(zend_string *name) +{ + return zend_hash_find(&configuration_hash, name); +} +/* }}} */ + /* {{{ cfg_get_entry */ PHPAPI zval *cfg_get_entry(const char *name, uint name_length) -- cgit v1.2.1 From 481bf25b6ad70fcdc9c10f02b49c86a0bd4a3d0d Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 1 Sep 2014 20:34:33 +0200 Subject: restore the length var and fix the com_dotnet ini --- main/php_ini.c | 1 + 1 file changed, 1 insertion(+) (limited to 'main/php_ini.c') diff --git a/main/php_ini.c b/main/php_ini.c index 38dcf72747..b3dcd3e546 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -355,6 +355,7 @@ static void php_load_php_extension_cb(void *arg TSRMLS_DC) static void php_load_zend_extension_cb(void *arg TSRMLS_DC) { char *filename = *((char **) arg); + const int length = strlen(filename); if (IS_ABSOLUTE_PATH(filename, length)) { zend_load_extension(filename TSRMLS_CC); -- cgit v1.2.1 From d0cb715373c3fbe9dc095378ec5ed8c71f799f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Fri, 19 Sep 2014 18:33:14 +0200 Subject: s/PHP 5/PHP 7/ --- main/php_ini.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main/php_ini.c') diff --git a/main/php_ini.c b/main/php_ini.c index b3dcd3e546..c90dc9f29f 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -1,6 +1,6 @@ /* +----------------------------------------------------------------------+ - | PHP Version 5 | + | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ -- cgit v1.2.1