From e6f90ecc27f5d305a0e755da67db75da786f4568 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 2 Jul 2013 09:46:30 -0400 Subject: It compiles. Sort-of. In a way. Yeah. But nothing works. Sigh --- main/php_ini.c | 55 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'main/php_ini.c') diff --git a/main/php_ini.c b/main/php_ini.c index e9529a2d29..ad3dc8fd86 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -80,7 +80,8 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC) ini_entry->displayer(ini_entry, type); } else { char *display_string; - uint display_string_length, esc_html=0; + zend_str_size display_string_length; + int esc_html=0; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { if (ini_entry->orig_value && ini_entry->orig_value[0]) { @@ -228,17 +229,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_STRLEN_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_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_STRLEN_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_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 */ - zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, arg2, sizeof(zval), (void **) &entry); - Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)); + zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, arg2, sizeof(zval), (void **) &entry); + Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRSIZE_P(entry)); } } break; @@ -255,23 +256,23 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* fprintf(stdout, "ZEND_INI_PARSER_POP_ENTRY: %s[%s] = %s\n",Z_STRVAL_P(arg1), Z_STRVAL_P(arg3), Z_STRVAL_P(arg2)); */ /* If option not found in hash or is not an array -> create array, otherwise add to existing array */ - if (zend_hash_find(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void **) &find_arr) == FAILURE || Z_TYPE_P(find_arr) != IS_ARRAY) { + if (zend_hash_find(active_hash, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, (void **) &find_arr) == FAILURE || Z_TYPE_P(find_arr) != IS_ARRAY) { option_arr = (zval *) pemalloc(sizeof(zval), 1); INIT_PZVAL(option_arr); Z_TYPE_P(option_arr) = IS_ARRAY; Z_ARRVAL_P(option_arr) = (HashTable *) pemalloc(sizeof(HashTable), 1); zend_hash_init(Z_ARRVAL_P(option_arr), 0, NULL, (dtor_func_t) config_zval_dtor, 1); - zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, option_arr, sizeof(zval), (void **) &find_arr); + zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, option_arr, sizeof(zval), (void **) &find_arr); free(option_arr); } /* arg3 is possible option offset name */ - if (arg3 && Z_STRLEN_P(arg3) > 0) { - zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STRVAL_P(arg3), Z_STRLEN_P(arg3) + 1, arg2, sizeof(zval), (void **) &entry); + if (arg3 && Z_STRSIZE_P(arg3) > 0) { + zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STRVAL_P(arg3), Z_STRSIZE_P(arg3) + 1, arg2, sizeof(zval), (void **) &entry); } else { zend_hash_next_index_insert(Z_ARRVAL_P(find_arr), arg2, sizeof(zval), (void **) &entry); } - Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)); + Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRSIZE_P(entry)); } break; @@ -280,13 +281,13 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* fprintf(stdout, "ZEND_INI_PARSER_SECTION: %s\n",Z_STRVAL_P(arg1)); */ char *key = NULL; - uint key_len; + zend_str_size key_len; /* PATH sections */ if (!strncasecmp(Z_STRVAL_P(arg1), "PATH", sizeof("PATH") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("PATH") - 1; - key_len = Z_STRLEN_P(arg1) - sizeof("PATH") + 1; + key_len = Z_STRSIZE_P(arg1) - sizeof("PATH") + 1; is_special_section = 1; has_per_dir_config = 1; @@ -297,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_STRLEN_P(arg1) - sizeof("HOST") + 1; + key_len = Z_STRSIZE_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. */ @@ -358,14 +359,14 @@ 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); - int length = strlen(filename); + zend_str_size length = strlen(filename); if (IS_ABSOLUTE_PATH(filename, length)) { zend_load_extension(filename); } else { char *libpath; char *extension_dir = INI_STR("extension_dir"); - int extension_dir_len = strlen(extension_dir); + zend_str_size extension_dir_len = strlen(extension_dir); if (IS_SLASH(extension_dir[extension_dir_len-1])) { spprintf(&libpath, 0, "%s%s", extension_dir, filename); @@ -384,7 +385,7 @@ int php_init_config(TSRMLS_D) { char *php_ini_file_name = NULL; char *php_ini_search_path = NULL; - int php_ini_scanned_path_len; + zend_str_size php_ini_scanned_path_len; char *open_basedir; int free_ini_search_path = 0; zend_file_handle fh; @@ -407,7 +408,7 @@ int php_init_config(TSRMLS_D) php_ini_search_path = sapi_module.php_ini_path_override; free_ini_search_path = 0; } else if (!sapi_module.php_ini_ignore) { - int search_path_size; + zend_str_size search_path_size; char *default_location; char *env_location; static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 }; @@ -421,7 +422,7 @@ int php_init_config(TSRMLS_D) #ifdef PHP_WIN32 if (!env_location) { char dummybuf; - int size; + zend_str_size size; SetLastError(0); @@ -598,8 +599,8 @@ int php_init_config(TSRMLS_D) { zval tmp; - Z_STRLEN(tmp) = strlen(fh.filename); - Z_STRVAL(tmp) = zend_strndup(fh.filename, Z_STRLEN(tmp)); + Z_STRSIZE(tmp) = strlen(fh.filename); + Z_STRVAL(tmp) = zend_strndup(fh.filename, Z_STRSIZE(tmp)); Z_TYPE(tmp) = IS_STRING; Z_SET_REFCOUNT(tmp, 0); @@ -607,7 +608,7 @@ int php_init_config(TSRMLS_D) if (php_ini_opened_path) { efree(php_ini_opened_path); } - php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); + php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); } } @@ -671,7 +672,7 @@ int php_init_config(TSRMLS_D) free(namelist); if (total_l) { - int php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0; + zend_str_size php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0; php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + total_l + 1); if (!php_ini_scanned_files_len) { *php_ini_scanned_files = '\0'; @@ -769,7 +770,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int { char *str; zval *data; - uint str_len; + zend_str_size str_len; ulong num_index; /* Walk through config hash and alter matching ini entries using the values found in the hash */ @@ -778,7 +779,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int zend_hash_move_forward(source_hash) ) { zend_hash_get_current_data(source_hash, (void **) &data); - zend_alter_ini_entry_ex(str, str_len, Z_STRVAL_P(data), Z_STRLEN_P(data), modify_type, stage, 0 TSRMLS_CC); + zend_alter_ini_entry_ex(str, str_len, Z_STRVAL_P(data), Z_STRSIZE_P(data), modify_type, stage, 0 TSRMLS_CC); } } /* }}} */ @@ -793,7 +794,7 @@ PHPAPI int php_ini_has_per_dir_config(void) /* {{{ php_ini_activate_per_dir_config */ -PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC) +PHPAPI void php_ini_activate_per_dir_config(char *path, zend_str_size_uint path_len TSRMLS_DC) { zval *tmp2; char *ptr; @@ -844,7 +845,7 @@ PHPAPI int php_ini_has_per_host_config(void) /* {{{ php_ini_activate_per_host_config */ -PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSRMLS_DC) +PHPAPI void php_ini_activate_per_host_config(const char *host, zend_str_size_uint host_len TSRMLS_DC) { zval *tmp; @@ -859,7 +860,7 @@ PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSR /* {{{ cfg_get_entry */ -PHPAPI zval *cfg_get_entry(const char *name, uint name_length) +PHPAPI zval *cfg_get_entry(const char *name, zend_str_size_uint name_length) { zval *tmp; -- cgit v1.2.1 From de99f93aa5a7791c8ad46945cd9c96a3280f2e78 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 7 Nov 2013 17:47:48 +0100 Subject: fix datatype for hash vars --- 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 ad3dc8fd86..eeaddce238 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -771,7 +771,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int char *str; zval *data; zend_str_size str_len; - ulong num_index; + zend_uint_t 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); -- cgit v1.2.1 From 15bb12b269ddb0751c2e9b232dd0b5dd5999bdad Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 13 Nov 2013 12:39:12 +0100 Subject: fixed "struct stat" usage in main, cli and ext/standard --- 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 eeaddce238..4207980306 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -551,7 +551,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]) { - struct stat statbuf; + php_stat_t statbuf; if (!VCWD_STAT(php_ini_file_name, &statbuf)) { if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) { @@ -624,7 +624,7 @@ int php_init_config(TSRMLS_D) if (!sapi_module.php_ini_ignore && php_ini_scanned_path_len) { struct dirent **namelist; int ndir, i; - struct stat sb; + php_stat_t sb; char ini_file[MAXPATHLEN]; char *p; zend_file_handle fh2; @@ -736,7 +736,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) { - struct stat sb; + php_stat_t sb; char ini_file[MAXPATHLEN]; zend_file_handle fh; -- cgit v1.2.1 From 9cc9a10efddd0c547c616b9790752bdb143025b8 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 24 Nov 2013 18:55:26 +0100 Subject: one more walk through in Zend, fixed (or broken) things being overseen --- 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 4207980306..0ae4b376d7 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -874,7 +874,7 @@ PHPAPI zval *cfg_get_entry(const char *name, zend_str_size_uint name_length) /* {{{ cfg_get_long */ -PHPAPI int cfg_get_long(const char *varname, long *result) +PHPAPI int cfg_get_long(const char *varname, zend_int_t *result) { zval *tmp, var; -- cgit v1.2.1 From b1abe4ca21e10b04a8bae2d00e8113f4b2b02567 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 18 Dec 2013 14:46:44 -0800 Subject: mass replacement for zend_size_t/php_size_t --- main/php_ini.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'main/php_ini.c') diff --git a/main/php_ini.c b/main/php_ini.c index e60311b9fd..44a768d990 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -80,7 +80,7 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC) ini_entry->displayer(ini_entry, type); } else { char *display_string; - zend_str_size display_string_length; + php_size_t display_string_length; int esc_html=0; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { @@ -281,7 +281,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* fprintf(stdout, "ZEND_INI_PARSER_SECTION: %s\n",Z_STRVAL_P(arg1)); */ char *key = NULL; - zend_str_size key_len; + php_size_t key_len; /* PATH sections */ if (!strncasecmp(Z_STRVAL_P(arg1), "PATH", sizeof("PATH") - 1)) { @@ -359,14 +359,14 @@ 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); - zend_str_size length = strlen(filename); + php_size_t length = strlen(filename); if (IS_ABSOLUTE_PATH(filename, length)) { zend_load_extension(filename TSRMLS_CC); } else { char *libpath; char *extension_dir = INI_STR("extension_dir"); - zend_str_size extension_dir_len = strlen(extension_dir); + php_size_t extension_dir_len = strlen(extension_dir); if (IS_SLASH(extension_dir[extension_dir_len-1])) { spprintf(&libpath, 0, "%s%s", extension_dir, filename); @@ -385,7 +385,7 @@ int php_init_config(TSRMLS_D) { char *php_ini_file_name = NULL; char *php_ini_search_path = NULL; - zend_str_size php_ini_scanned_path_len; + php_size_t php_ini_scanned_path_len; char *open_basedir; int free_ini_search_path = 0; zend_file_handle fh; @@ -408,7 +408,7 @@ int php_init_config(TSRMLS_D) php_ini_search_path = sapi_module.php_ini_path_override; free_ini_search_path = 0; } else if (!sapi_module.php_ini_ignore) { - zend_str_size search_path_size; + php_size_t search_path_size; char *default_location; char *env_location; static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 }; @@ -422,7 +422,7 @@ int php_init_config(TSRMLS_D) #ifdef PHP_WIN32 if (!env_location) { char dummybuf; - zend_str_size size; + php_size_t size; SetLastError(0); @@ -672,7 +672,7 @@ int php_init_config(TSRMLS_D) free(namelist); if (total_l) { - zend_str_size php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0; + php_size_t php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0; php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + total_l + 1); if (!php_ini_scanned_files_len) { *php_ini_scanned_files = '\0'; @@ -770,7 +770,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int { char *str; zval *data; - zend_str_size str_len; + php_size_t str_len; zend_uint_t num_index; /* Walk through config hash and alter matching ini entries using the values found in the hash */ @@ -794,7 +794,7 @@ PHPAPI int php_ini_has_per_dir_config(void) /* {{{ php_ini_activate_per_dir_config */ -PHPAPI void php_ini_activate_per_dir_config(char *path, zend_str_size_uint path_len TSRMLS_DC) +PHPAPI void php_ini_activate_per_dir_config(char *path, php_size_t path_len TSRMLS_DC) { zval *tmp2; char *ptr; @@ -845,7 +845,7 @@ PHPAPI int php_ini_has_per_host_config(void) /* {{{ php_ini_activate_per_host_config */ -PHPAPI void php_ini_activate_per_host_config(const char *host, zend_str_size_uint host_len TSRMLS_DC) +PHPAPI void php_ini_activate_per_host_config(const char *host, php_size_t host_len TSRMLS_DC) { zval *tmp; @@ -860,7 +860,7 @@ PHPAPI void php_ini_activate_per_host_config(const char *host, zend_str_size_uin /* {{{ cfg_get_entry */ -PHPAPI zval *cfg_get_entry(const char *name, zend_str_size_uint name_length) +PHPAPI zval *cfg_get_entry(const char *name, php_size_t name_length) { zval *tmp; -- cgit v1.2.1 From f58d0b35edf25a8f39fad6bd5e0e4eeb5cdfe9a7 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 19 Dec 2013 05:07:37 -0800 Subject: massive update semantical LONG vs INT replacements --- main/php_ini.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main/php_ini.c') diff --git a/main/php_ini.c b/main/php_ini.c index 44a768d990..938814ca24 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -884,8 +884,8 @@ PHPAPI int cfg_get_long(const char *varname, zend_int_t *result) } var = *tmp; zval_copy_ctor(&var); - convert_to_long(&var); - *result = Z_LVAL(var); + convert_to_int(&var); + *result = Z_IVAL(var); return SUCCESS; } /* }}} */ -- cgit v1.2.1 From f2fc935502b110b7a706d1641c000a9e9500315b Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 19 Dec 2013 23:28:52 -0800 Subject: next wave on semantical replacements long vs. int --- main/php_ini.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main/php_ini.c') diff --git a/main/php_ini.c b/main/php_ini.c index 938814ca24..08e0ca20ef 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -872,9 +872,9 @@ PHPAPI zval *cfg_get_entry(const char *name, php_size_t name_length) } /* }}} */ -/* {{{ cfg_get_long +/* {{{ cfg_get_int */ -PHPAPI int cfg_get_long(const char *varname, zend_int_t *result) +PHPAPI int cfg_get_int(const char *varname, zend_int_t *result) { zval *tmp, var; -- cgit v1.2.1 From 8ee2a4a9b5de682c0b37670e1f4f86242b1650ce Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 16 Aug 2014 11:16:11 +0200 Subject: first shot on merging the core fro the int64 branch --- 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 cdd4a61fb5..54944483d2 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -233,10 +233,10 @@ 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_STRLEN_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_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_STRLEN_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_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 */ @@ -267,7 +267,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t } /* arg3 is possible option offset name */ - if (arg3 && Z_STRLEN_P(arg3) > 0) { + if (arg3 && Z_STRSIZE_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); @@ -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_STRLEN_P(arg1) - sizeof("PATH") + 1; + key_len = Z_STRSIZE_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_STRLEN_P(arg1) - sizeof("HOST") + 1; + key_len = Z_STRSIZE_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. */ @@ -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]) { - struct stat statbuf; + php_stat_t statbuf; if (!VCWD_STAT(php_ini_file_name, &statbuf)) { if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) { @@ -598,7 +598,7 @@ int php_init_config(TSRMLS_D) if (php_ini_opened_path) { efree(php_ini_opened_path); } - php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); + php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); } } @@ -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; - struct stat sb; + php_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) { - struct stat sb; + php_stat_t sb; char ini_file[MAXPATHLEN]; zend_file_handle fh; @@ -778,7 +778,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int { zend_string *str; zval *data; - ulong num_index; + zend_uint_t 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_STRLEN_P(data), modify_type, stage, 0 TSRMLS_CC); + zend_alter_ini_entry_ex(str, Z_STRVAL_P(data), Z_STRSIZE_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_long +/* {{{ cfg_get_int */ -PHPAPI int cfg_get_long(const char *varname, long *result) +PHPAPI int cfg_get_int(const char *varname, zend_int_t *result) { zval *tmp, var; @@ -884,8 +884,8 @@ PHPAPI int cfg_get_long(const char *varname, long *result) return FAILURE; } ZVAL_DUP(&var, tmp); - convert_to_long(&var); - *result = Z_LVAL(var); + convert_to_int(&var); + *result = Z_IVAL(var); return SUCCESS; } /* }}} */ -- cgit v1.2.1 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