mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Refactored INI subsystem to use zend_string* instead of char*
This commit is contained in:
parent
b9f3247267
commit
88d7ca44f6
38 changed files with 2515 additions and 2461 deletions
14
Zend/zend.c
14
Zend/zend.c
|
@ -62,14 +62,14 @@ ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRML
|
|||
void (*zend_on_timeout)(int seconds TSRMLS_DC);
|
||||
|
||||
static void (*zend_message_dispatcher_p)(zend_long message, const void *data TSRMLS_DC);
|
||||
static int (*zend_get_configuration_directive_p)(const char *name, uint name_length, zval *contents);
|
||||
static zval *(*zend_get_configuration_directive_p)(zend_string *name);
|
||||
|
||||
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
|
||||
{
|
||||
if (!new_value) {
|
||||
EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED;
|
||||
} else {
|
||||
EG(error_reporting) = atoi(new_value);
|
||||
EG(error_reporting) = atoi(new_value->val);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
|
|||
|
||||
static ZEND_INI_MH(OnUpdateGCEnabled) /* {{{ */
|
||||
{
|
||||
OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
|
||||
if (GC_G(gc_enabled)) {
|
||||
gc_init(TSRMLS_C);
|
||||
|
@ -95,7 +95,7 @@ static ZEND_INI_MH(OnUpdateScriptEncoding) /* {{{ */
|
|||
if (!zend_multibyte_get_functions(TSRMLS_C)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
return zend_multibyte_set_script_encoding_by_string(new_value, new_value_length TSRMLS_CC);
|
||||
return zend_multibyte_set_script_encoding_by_string(new_value->val, new_value->len TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -979,12 +979,12 @@ ZEND_API void zend_message_dispatcher(zend_long message, const void *data TSRMLS
|
|||
/* }}} */
|
||||
END_EXTERN_C()
|
||||
|
||||
ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents) /* {{{ */
|
||||
ZEND_API zval *zend_get_configuration_directive(zend_string *name) /* {{{ */
|
||||
{
|
||||
if (zend_get_configuration_directive_p) {
|
||||
return zend_get_configuration_directive_p(name, name_length, contents);
|
||||
return zend_get_configuration_directive_p(name);
|
||||
} else {
|
||||
return FAILURE;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
|
|
@ -542,7 +542,7 @@ typedef struct _zend_utility_functions {
|
|||
void (*message_handler)(zend_long message, const void *data TSRMLS_DC);
|
||||
void (*block_interruptions)(void);
|
||||
void (*unblock_interruptions)(void);
|
||||
int (*get_configuration_directive)(const char *name, uint name_length, zval *contents);
|
||||
zval *(*get_configuration_directive)(zend_string *name);
|
||||
void (*ticks_function)(int ticks TSRMLS_DC);
|
||||
void (*on_timeout)(int seconds TSRMLS_DC);
|
||||
int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
|
||||
|
@ -689,7 +689,7 @@ END_EXTERN_C()
|
|||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_message_dispatcher(zend_long message, const void *data TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents);
|
||||
ZEND_API zval *zend_get_configuration_directive(zend_string *name);
|
||||
END_EXTERN_C()
|
||||
|
||||
/* Messages for applications of Zend */
|
||||
|
|
|
@ -381,7 +381,7 @@ ZEND_FUNCTION(gc_enabled)
|
|||
ZEND_FUNCTION(gc_enable)
|
||||
{
|
||||
zend_string *key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
|
||||
zend_alter_ini_entry(key, "1", sizeof("1")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry_chars(key, "1", sizeof("1")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_string_release(key);
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -391,7 +391,7 @@ ZEND_FUNCTION(gc_enable)
|
|||
ZEND_FUNCTION(gc_disable)
|
||||
{
|
||||
zend_string *key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
|
||||
zend_alter_ini_entry(key, "0", sizeof("0")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry_chars(key, "0", sizeof("0")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_string_release(key);
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -676,18 +676,17 @@ ZEND_FUNCTION(each)
|
|||
Return the current error_reporting level, and if an argument was passed - change to the new level */
|
||||
ZEND_FUNCTION(error_reporting)
|
||||
{
|
||||
char *err;
|
||||
size_t err_len;
|
||||
zend_string *err;
|
||||
int old_error_reporting;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &err, &err_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &err) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
old_error_reporting = EG(error_reporting);
|
||||
if(ZEND_NUM_ARGS() != 0) {
|
||||
zend_string *key = zend_string_init("error_reporting", sizeof("error_reporting")-1, 0);
|
||||
zend_alter_ini_entry(key, err, err_len, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(key, err, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_string_release(key);
|
||||
}
|
||||
|
||||
|
|
150
Zend/zend_ini.c
150
Zend/zend_ini.c
|
@ -56,7 +56,7 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
|
|||
/* even if on_modify bails out, we have to continue on with restoring,
|
||||
since there can be allocated variables that would be freed on MM shutdown
|
||||
and would lead to memory corruption later ini entry is modified again */
|
||||
result = 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 TSRMLS_CC);
|
||||
result = ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
|
||||
} zend_end_try();
|
||||
}
|
||||
if (stage == ZEND_INI_STAGE_RUNTIME && result == FAILURE) {
|
||||
|
@ -64,14 +64,12 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
|
|||
return 1;
|
||||
}
|
||||
if (ini_entry->value != ini_entry->orig_value) {
|
||||
efree(ini_entry->value);
|
||||
zend_string_release(ini_entry->value);
|
||||
}
|
||||
ini_entry->value = ini_entry->orig_value;
|
||||
ini_entry->value_length = ini_entry->orig_value_length;
|
||||
ini_entry->modifiable = ini_entry->orig_modifiable;
|
||||
ini_entry->modified = 0;
|
||||
ini_entry->orig_value = NULL;
|
||||
ini_entry->orig_value_length = 0;
|
||||
ini_entry->orig_modifiable = 0;
|
||||
}
|
||||
return 0;
|
||||
|
@ -177,11 +175,10 @@ ZEND_API void zend_ini_sort_entries(TSRMLS_D) /* {{{ */
|
|||
/*
|
||||
* Registration / unregistration
|
||||
*/
|
||||
ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
const zend_ini_entry *p = ini_entry;
|
||||
zend_ini_entry *hashed_ini_entry;
|
||||
zval default_value;
|
||||
zend_ini_entry *p;
|
||||
zval *default_value;
|
||||
HashTable *directives = registered_zend_ini_directives;
|
||||
zend_bool config_directive_success = 0;
|
||||
|
||||
|
@ -199,26 +196,43 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int modu
|
|||
}
|
||||
#endif
|
||||
|
||||
while (p->name) {
|
||||
while (ini_entry->name) {
|
||||
p = pemalloc(sizeof(zend_ini_entry), 1);
|
||||
p->name = zend_string_init(ini_entry->name, ini_entry->name_length, 1);
|
||||
p->on_modify = ini_entry->on_modify;
|
||||
p->mh_arg1 = ini_entry->mh_arg1;
|
||||
p->mh_arg2 = ini_entry->mh_arg2;
|
||||
p->mh_arg3 = ini_entry->mh_arg3;
|
||||
p->value = ini_entry->value ?
|
||||
zend_string_init(ini_entry->value, ini_entry->value_length, 1) : NULL;
|
||||
p->orig_value = NULL;
|
||||
p->displayer = ini_entry->displayer;
|
||||
p->modifiable = ini_entry->modifiable;
|
||||
|
||||
p->orig_modifiable = 0;
|
||||
p->modified = 0;
|
||||
p->module_number = module_number;
|
||||
|
||||
config_directive_success = 0;
|
||||
if ((hashed_ini_entry = zend_hash_str_add_mem(directives, p->name, p->name_length, (void*)p, sizeof(zend_ini_entry))) == NULL) {
|
||||
if (zend_hash_add_ptr(directives, p->name, (void*)p) == NULL) {
|
||||
if (p->orig_value) {
|
||||
zend_string_release(p->orig_value);
|
||||
}
|
||||
zend_unregister_ini_entries(module_number TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
hashed_ini_entry->module_number = module_number;
|
||||
if ((zend_get_configuration_directive(p->name, p->name_length, &default_value)) == SUCCESS) {
|
||||
if (!hashed_ini_entry->on_modify
|
||||
|| hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRLEN(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) {
|
||||
hashed_ini_entry->value = Z_STRVAL(default_value);
|
||||
hashed_ini_entry->value_length = Z_STRLEN(default_value);
|
||||
if ((default_value = zend_get_configuration_directive(p->name)) != NULL) {
|
||||
if (!p->on_modify
|
||||
|| p->on_modify(p, Z_STR_P(default_value), p->mh_arg1, p->mh_arg2, p->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) {
|
||||
p->value = Z_STR_P(default_value);
|
||||
config_directive_success = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!config_directive_success && 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, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
|
||||
if (!config_directive_success && p->on_modify) {
|
||||
p->on_modify(p, p->value, p->mh_arg1, p->mh_arg2, p->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
|
||||
}
|
||||
p++;
|
||||
ini_entry++;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -250,18 +264,43 @@ ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */
|
|||
/* }}} */
|
||||
#endif
|
||||
|
||||
ZEND_API int zend_alter_ini_entry(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage) /* {{{ */
|
||||
ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
return zend_alter_ini_entry_ex(name, new_value, new_value_length, modify_type, stage, 0 TSRMLS_CC);
|
||||
return zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0 TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_alter_ini_entry_ex(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage) /* {{{ */
|
||||
{
|
||||
int ret;
|
||||
zend_string *new_value;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
new_value = zend_string_init(value, value_length, stage != ZEND_INI_STAGE_RUNTIME);
|
||||
ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0 TSRMLS_CC);
|
||||
zend_string_release(new_value);
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
int ret;
|
||||
zend_string *new_value;
|
||||
|
||||
new_value = zend_string_init(value, value_length, stage != ZEND_INI_STAGE_RUNTIME);
|
||||
ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, force_change TSRMLS_CC);
|
||||
zend_string_release(new_value);
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
char *duplicate;
|
||||
zend_string *duplicate;
|
||||
zend_bool modifiable;
|
||||
zend_bool modified;
|
||||
|
||||
|
@ -288,23 +327,21 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, char *new_value, uint ne
|
|||
}
|
||||
if (!modified) {
|
||||
ini_entry->orig_value = ini_entry->value;
|
||||
ini_entry->orig_value_length = ini_entry->value_length;
|
||||
ini_entry->orig_modifiable = modifiable;
|
||||
ini_entry->modified = 1;
|
||||
zend_hash_add_ptr(EG(modified_ini_directives), name, ini_entry);
|
||||
}
|
||||
|
||||
duplicate = estrndup(new_value, new_value_length);
|
||||
duplicate = zend_string_copy(new_value);
|
||||
|
||||
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 TSRMLS_CC) == SUCCESS) {
|
||||
|| ini_entry->on_modify(ini_entry, duplicate, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC) == SUCCESS) {
|
||||
if (modified && ini_entry->orig_value != ini_entry->value) { /* we already changed the value, free the changed value */
|
||||
efree(ini_entry->value);
|
||||
zend_string_release(ini_entry->value);
|
||||
}
|
||||
ini_entry->value = duplicate;
|
||||
ini_entry->value_length = new_value_length;
|
||||
} else {
|
||||
efree(duplicate);
|
||||
zend_string_release(duplicate);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
@ -360,9 +397,9 @@ ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig) /* {{{
|
|||
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
|
||||
if (ini_entry) {
|
||||
if (orig && ini_entry->modified) {
|
||||
return (ini_entry->orig_value ? ZEND_STRTOL(ini_entry->orig_value, NULL, 0) : 0);
|
||||
return (ini_entry->orig_value ? ZEND_STRTOL(ini_entry->orig_value->val, NULL, 0) : 0);
|
||||
} else {
|
||||
return (ini_entry->value ? ZEND_STRTOL(ini_entry->value, NULL, 0) : 0);
|
||||
return (ini_entry->value ? ZEND_STRTOL(ini_entry->value->val, NULL, 0) : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -378,9 +415,9 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ *
|
|||
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
|
||||
if (ini_entry) {
|
||||
if (orig && ini_entry->modified) {
|
||||
return (double) (ini_entry->orig_value ? zend_strtod(ini_entry->orig_value, NULL) : 0.0);
|
||||
return (double) (ini_entry->orig_value ? zend_strtod(ini_entry->orig_value->val, NULL) : 0.0);
|
||||
} else {
|
||||
return (double) (ini_entry->value ? zend_strtod(ini_entry->value, NULL) : 0.0);
|
||||
return (double) (ini_entry->value ? zend_strtod(ini_entry->value->val, NULL) : 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -400,9 +437,9 @@ ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_b
|
|||
}
|
||||
|
||||
if (orig && ini_entry->modified) {
|
||||
return ini_entry->orig_value;
|
||||
return ini_entry->orig_value ? ini_entry->orig_value->val : NULL;
|
||||
} else {
|
||||
return ini_entry->value;
|
||||
return ini_entry->value ? ini_entry->value->val : NULL;
|
||||
}
|
||||
} else {
|
||||
if (exists) {
|
||||
|
@ -470,29 +507,26 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */
|
|||
|
||||
ZEND_INI_DISP(zend_ini_boolean_displayer_cb) /* {{{ */
|
||||
{
|
||||
int value, tmp_value_len;
|
||||
char *tmp_value;
|
||||
int value;
|
||||
zend_string *tmp_value;
|
||||
|
||||
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );
|
||||
tmp_value_len = ini_entry->orig_value_length;
|
||||
} else if (ini_entry->value) {
|
||||
tmp_value = ini_entry->value;
|
||||
tmp_value_len = ini_entry->value_length;
|
||||
} else {
|
||||
tmp_value = NULL;
|
||||
tmp_value_len = 0;
|
||||
}
|
||||
|
||||
if (tmp_value) {
|
||||
if (tmp_value_len == 4 && strcasecmp(tmp_value, "true") == 0) {
|
||||
if (tmp_value->len == 4 && strcasecmp(tmp_value->val, "true") == 0) {
|
||||
value = 1;
|
||||
} else if (tmp_value_len == 3 && strcasecmp(tmp_value, "yes") == 0) {
|
||||
} else if (tmp_value->len == 3 && strcasecmp(tmp_value->val, "yes") == 0) {
|
||||
value = 1;
|
||||
} else if (tmp_value_len == 2 && strcasecmp(tmp_value, "on") == 0) {
|
||||
} else if (tmp_value->len == 2 && strcasecmp(tmp_value->val, "on") == 0) {
|
||||
value = 1;
|
||||
} else {
|
||||
value = atoi(tmp_value);
|
||||
value = atoi(tmp_value->val);
|
||||
}
|
||||
} else {
|
||||
value = 0;
|
||||
|
@ -511,9 +545,9 @@ ZEND_INI_DISP(zend_ini_color_displayer_cb) /* {{{ */
|
|||
char *value;
|
||||
|
||||
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
value = ini_entry->orig_value;
|
||||
value = ini_entry->orig_value->val;
|
||||
} else if (ini_entry->value) {
|
||||
value = ini_entry->value;
|
||||
value = ini_entry->value->val;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
|
@ -538,9 +572,9 @@ ZEND_INI_DISP(display_link_numbers) /* {{{ */
|
|||
char *value;
|
||||
|
||||
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
value = ini_entry->orig_value;
|
||||
value = ini_entry->orig_value->val;
|
||||
} else if (ini_entry->value) {
|
||||
value = ini_entry->value;
|
||||
value = ini_entry->value->val;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
|
@ -569,17 +603,17 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */
|
|||
|
||||
p = (zend_bool *) (base+(size_t) mh_arg1);
|
||||
|
||||
if (new_value_length == 2 && strcasecmp("on", new_value) == 0) {
|
||||
if (new_value->len == 2 && strcasecmp("on", new_value->val) == 0) {
|
||||
*p = (zend_bool) 1;
|
||||
}
|
||||
else if (new_value_length == 3 && strcasecmp("yes", new_value) == 0) {
|
||||
else if (new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) {
|
||||
*p = (zend_bool) 1;
|
||||
}
|
||||
else if (new_value_length == 4 && strcasecmp("true", new_value) == 0) {
|
||||
else if (new_value->len == 4 && strcasecmp("true", new_value->val) == 0) {
|
||||
*p = (zend_bool) 1;
|
||||
}
|
||||
else {
|
||||
*p = (zend_bool) atoi(new_value);
|
||||
*p = (zend_bool) atoi(new_value->val);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -598,7 +632,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
|
|||
|
||||
p = (zend_long *) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = zend_atol(new_value, new_value_length);
|
||||
*p = zend_atol(new_value->val, new_value->len);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -614,7 +648,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */
|
|||
base = (char *) ts_resource(*((int *) mh_arg2));
|
||||
#endif
|
||||
|
||||
tmp = zend_atol(new_value, new_value_length);
|
||||
tmp = zend_atol(new_value->val, new_value->len);
|
||||
if (tmp < 0) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
@ -639,7 +673,7 @@ ZEND_API ZEND_INI_MH(OnUpdateReal) /* {{{ */
|
|||
|
||||
p = (double *) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = zend_strtod(new_value, NULL);
|
||||
*p = zend_strtod(new_value->val, NULL);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -657,7 +691,7 @@ ZEND_API ZEND_INI_MH(OnUpdateString) /* {{{ */
|
|||
|
||||
p = (char **) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = new_value;
|
||||
*p = new_value ? new_value->val : NULL;
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -673,13 +707,13 @@ ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) /* {{{ */
|
|||
base = (char *) ts_resource(*((int *) mh_arg2));
|
||||
#endif
|
||||
|
||||
if (new_value && !new_value[0]) {
|
||||
if (new_value && !new_value->val[0]) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
p = (char **) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = new_value;
|
||||
*p = new_value ? new_value->val : NULL;
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
|
|
@ -27,28 +27,37 @@
|
|||
|
||||
#define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM)
|
||||
|
||||
#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
|
||||
#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, zend_string *new_value, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
|
||||
#define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type)
|
||||
|
||||
struct _zend_ini_entry {
|
||||
int module_number;
|
||||
int modifiable;
|
||||
char *name; // TODO: convert into zend_string ???
|
||||
uint name_length;
|
||||
typedef struct _zend_ini_entry_def {
|
||||
const char *name;
|
||||
ZEND_INI_MH((*on_modify));
|
||||
void *mh_arg1;
|
||||
void *mh_arg2;
|
||||
void *mh_arg3;
|
||||
const char *value;
|
||||
void (*displayer)(zend_ini_entry *ini_entry, int type);
|
||||
int modifiable;
|
||||
|
||||
char *value; // TODO: convert into zend_string ???
|
||||
uint name_length;
|
||||
uint value_length;
|
||||
} zend_ini_entry_def;
|
||||
|
||||
struct _zend_ini_entry {
|
||||
zend_string *name;
|
||||
ZEND_INI_MH((*on_modify));
|
||||
void *mh_arg1;
|
||||
void *mh_arg2;
|
||||
void *mh_arg3;
|
||||
zend_string *value;
|
||||
zend_string *orig_value;
|
||||
void (*displayer)(zend_ini_entry *ini_entry, int type);
|
||||
int modifiable;
|
||||
|
||||
char *orig_value; // TODO: convert into zend_string ???
|
||||
uint orig_value_length;
|
||||
int orig_modifiable;
|
||||
int modified;
|
||||
|
||||
void (*displayer)(zend_ini_entry *ini_entry, int type);
|
||||
int module_number;
|
||||
};
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
@ -61,11 +70,13 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D);
|
|||
|
||||
ZEND_API void zend_ini_sort_entries(TSRMLS_D);
|
||||
|
||||
ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC);
|
||||
ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC);
|
||||
ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC);
|
||||
ZEND_API int zend_alter_ini_entry(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage);
|
||||
ZEND_API int zend_alter_ini_entry_ex(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC);
|
||||
ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage);
|
||||
ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change TSRMLS_DC);
|
||||
ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage);
|
||||
ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change TSRMLS_DC);
|
||||
ZEND_API int zend_restore_ini_entry(zend_string *name, int stage);
|
||||
ZEND_API void display_ini_entries(zend_module_entry *module);
|
||||
|
||||
|
@ -81,11 +92,11 @@ ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb);
|
|||
ZEND_API ZEND_INI_DISP(display_link_numbers);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_INI_BEGIN() static const zend_ini_entry ini_entries[] = {
|
||||
#define ZEND_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 0, NULL } };
|
||||
#define ZEND_INI_BEGIN() static const zend_ini_entry_def ini_entries[] = {
|
||||
#define ZEND_INI_END() { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0} };
|
||||
|
||||
#define ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, displayer) \
|
||||
{ 0, modifiable, name, sizeof(name)-1, on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, 0, displayer },
|
||||
{ name, on_modify, arg1, arg2, arg3, default_value, displayer, modifiable, sizeof(name)-1, sizeof(default_value)-1 },
|
||||
|
||||
#define ZEND_INI_ENTRY3(name, default_value, modifiable, on_modify, arg1, arg2, arg3) \
|
||||
ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, NULL)
|
||||
|
|
|
@ -141,12 +141,12 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC)
|
|||
*/
|
||||
static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC)
|
||||
{
|
||||
zval curval;
|
||||
zval *curval;
|
||||
char *envvar;
|
||||
|
||||
/* Fetch configuration option value */
|
||||
if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name), &curval) == SUCCESS) {
|
||||
ZVAL_PSTRINGL(result, Z_STRVAL(curval), Z_STRLEN(curval));
|
||||
if ((curval = zend_get_configuration_directive(Z_STR_P(name))) != NULL) {
|
||||
ZVAL_PSTRINGL(result, Z_STRVAL_P(curval), Z_STRLEN_P(curval));
|
||||
/* ..or if not found, try ENV */
|
||||
} else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL ||
|
||||
(envvar = getenv(Z_STRVAL_P(name))) != NULL) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5071,15 +5071,17 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
|
|||
}
|
||||
if (EXPECTED(zend_hash_str_add_ptr(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting")-1, EG(error_reporting_ini_entry)) != NULL)) {
|
||||
EG(error_reporting_ini_entry)->orig_value = EG(error_reporting_ini_entry)->value;
|
||||
EG(error_reporting_ini_entry)->orig_value_length = EG(error_reporting_ini_entry)->value_length;
|
||||
EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable;
|
||||
EG(error_reporting_ini_entry)->modified = 1;
|
||||
}
|
||||
} else if (EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value) {
|
||||
efree(EG(error_reporting_ini_entry)->value);
|
||||
zend_string_release(EG(error_reporting_ini_entry)->value);
|
||||
}
|
||||
if (CG(one_char_string)['0']) {
|
||||
EG(error_reporting_ini_entry)->value = CG(one_char_string)['0'];
|
||||
} else {
|
||||
EG(error_reporting_ini_entry)->value = zend_string_init("0", sizeof("0")-1, 0);
|
||||
}
|
||||
EG(error_reporting_ini_entry)->value = estrndup("0", sizeof("0")-1);
|
||||
EG(error_reporting_ini_entry)->value_length = sizeof("0")-1;
|
||||
} while (0);
|
||||
}
|
||||
CHECK_EXCEPTION();
|
||||
|
@ -5106,10 +5108,9 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
|
|||
if (EXPECTED(EG(error_reporting_ini_entry) != NULL)) {
|
||||
if (EXPECTED(EG(error_reporting_ini_entry)->modified &&
|
||||
EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) {
|
||||
efree(EG(error_reporting_ini_entry)->value);
|
||||
zend_string_release(EG(error_reporting_ini_entry)->value);
|
||||
}
|
||||
EG(error_reporting_ini_entry)->value_length = buf + sizeof(buf) - 1 - res;
|
||||
EG(error_reporting_ini_entry)->value = estrndup(res, EG(error_reporting_ini_entry)->value_length);
|
||||
EG(error_reporting_ini_entry)->value = zend_string_init(res, buf + sizeof(buf) - 1 - res, 0);
|
||||
}
|
||||
}
|
||||
//??? if (EX(old_error_reporting) == EX_VAR(opline->op1.var)) {
|
||||
|
@ -5478,7 +5479,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
|||
ZVAL_LONG(&restored_error_reporting, Z_LVAL(EX(old_error_reporting)));
|
||||
convert_to_string(&restored_error_reporting);
|
||||
key = zend_string_init("error_reporting", sizeof("error_reporting")-1, 0);
|
||||
zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
|
||||
zend_alter_ini_entry_ex(key, Z_STR(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
|
||||
zend_string_free(key);
|
||||
zval_dtor(&restored_error_reporting);
|
||||
}
|
||||
|
|
|
@ -1131,15 +1131,17 @@ static int ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
|
|||
}
|
||||
if (EXPECTED(zend_hash_str_add_ptr(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting")-1, EG(error_reporting_ini_entry)) != NULL)) {
|
||||
EG(error_reporting_ini_entry)->orig_value = EG(error_reporting_ini_entry)->value;
|
||||
EG(error_reporting_ini_entry)->orig_value_length = EG(error_reporting_ini_entry)->value_length;
|
||||
EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable;
|
||||
EG(error_reporting_ini_entry)->modified = 1;
|
||||
}
|
||||
} else if (EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value) {
|
||||
efree(EG(error_reporting_ini_entry)->value);
|
||||
zend_string_release(EG(error_reporting_ini_entry)->value);
|
||||
}
|
||||
if (CG(one_char_string)['0']) {
|
||||
EG(error_reporting_ini_entry)->value = CG(one_char_string)['0'];
|
||||
} else {
|
||||
EG(error_reporting_ini_entry)->value = zend_string_init("0", sizeof("0")-1, 0);
|
||||
}
|
||||
EG(error_reporting_ini_entry)->value = estrndup("0", sizeof("0")-1);
|
||||
EG(error_reporting_ini_entry)->value_length = sizeof("0")-1;
|
||||
} while (0);
|
||||
}
|
||||
CHECK_EXCEPTION();
|
||||
|
@ -1372,7 +1374,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
|
|||
ZVAL_LONG(&restored_error_reporting, Z_LVAL(EX(old_error_reporting)));
|
||||
convert_to_string(&restored_error_reporting);
|
||||
key = zend_string_init("error_reporting", sizeof("error_reporting")-1, 0);
|
||||
zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
|
||||
zend_alter_ini_entry_ex(key, Z_STR(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
|
||||
zend_string_free(key);
|
||||
zval_dtor(&restored_error_reporting);
|
||||
}
|
||||
|
@ -10040,10 +10042,9 @@ static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
|
|||
if (EXPECTED(EG(error_reporting_ini_entry) != NULL)) {
|
||||
if (EXPECTED(EG(error_reporting_ini_entry)->modified &&
|
||||
EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) {
|
||||
efree(EG(error_reporting_ini_entry)->value);
|
||||
zend_string_release(EG(error_reporting_ini_entry)->value);
|
||||
}
|
||||
EG(error_reporting_ini_entry)->value_length = buf + sizeof(buf) - 1 - res;
|
||||
EG(error_reporting_ini_entry)->value = estrndup(res, EG(error_reporting_ini_entry)->value_length);
|
||||
EG(error_reporting_ini_entry)->value = zend_string_init(res, buf + sizeof(buf) - 1 - res, 0);
|
||||
}
|
||||
}
|
||||
//??? if (EX(old_error_reporting) == EX_VAR(opline->op1.var)) {
|
||||
|
|
|
@ -932,7 +932,7 @@ timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib
|
|||
/* {{{ static PHP_INI_MH(OnUpdate_date_timezone) */
|
||||
static PHP_INI_MH(OnUpdate_date_timezone)
|
||||
{
|
||||
if (OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
|
||||
if (OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
@ -959,11 +959,11 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
|
|||
/* Check config setting for default timezone */
|
||||
if (!DATEG(default_timezone)) {
|
||||
/* Special case: ext/date wasn't initialized yet */
|
||||
zval ztz;
|
||||
zval *ztz;
|
||||
|
||||
if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz)
|
||||
&& Z_TYPE(ztz) == IS_STRING && Z_STRLEN(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
|
||||
return Z_STRVAL(ztz);
|
||||
if (NULL != (ztz = cfg_get_entry("date.timezone", sizeof("date.timezone")))
|
||||
&& Z_TYPE_P(ztz) == IS_STRING && Z_STRLEN_P(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL_P(ztz), tzdb)) {
|
||||
return Z_STRVAL_P(ztz);
|
||||
}
|
||||
} else if (*DATEG(default_timezone)) {
|
||||
if (DATEG(timezone_valid) == 1) {
|
||||
|
|
|
@ -166,17 +166,17 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
|
|||
|
||||
ZEND_INI_MH(OnUpdateEncode)
|
||||
{
|
||||
if (new_value && new_value_length) {
|
||||
if (new_value && new_value->len) {
|
||||
const zend_encoding **return_list;
|
||||
size_t return_size;
|
||||
if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length,
|
||||
if (FAILURE == zend_multibyte_parse_encoding_list(new_value->val, new_value->len,
|
||||
&return_list, &return_size, 0 TSRMLS_CC)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value->val);
|
||||
return FAILURE;
|
||||
}
|
||||
efree(return_list);
|
||||
}
|
||||
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_INI_MH(OnUpdateDecode)
|
||||
|
@ -184,14 +184,14 @@ ZEND_INI_MH(OnUpdateDecode)
|
|||
if (new_value) {
|
||||
const zend_encoding **return_list;
|
||||
size_t return_size;
|
||||
if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length,
|
||||
if (FAILURE == zend_multibyte_parse_encoding_list(new_value->val, new_value->len,
|
||||
&return_list, &return_size, 0 TSRMLS_CC)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value->val);
|
||||
return FAILURE;
|
||||
}
|
||||
efree(return_list);
|
||||
}
|
||||
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
}
|
||||
|
||||
PHP_INI_BEGIN()
|
||||
|
|
|
@ -160,7 +160,7 @@ static PHP_INI_MH(UpdateDefaultFilter) /* {{{ */
|
|||
int i, size = sizeof(filter_list) / sizeof(filter_list_entry);
|
||||
|
||||
for (i = 0; i < size; ++i) {
|
||||
if ((strcasecmp(new_value, filter_list[i].name) == 0)) {
|
||||
if ((strcasecmp(new_value->val, filter_list[i].name) == 0)) {
|
||||
IF_G(default_filter) = filter_list[i].id;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ static PHP_INI_MH(OnUpdateFlags)
|
|||
if (!new_value) {
|
||||
IF_G(default_filter_flags) = FILTER_FLAG_NO_ENCODE_QUOTES;
|
||||
} else {
|
||||
IF_G(default_filter_flags) = atoi(new_value);
|
||||
IF_G(default_filter_flags) = atoi(new_value->val);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
|
|
@ -223,39 +223,39 @@ static char _generic_superset_name[] = ICONV_UCS4_ENCODING;
|
|||
|
||||
static PHP_INI_MH(OnUpdateInputEncoding)
|
||||
{
|
||||
if (new_value_length >= ICONV_CSNMAXLEN) {
|
||||
if (new_value->len >= ICONV_CSNMAXLEN) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
|
||||
php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.input_encoding is deprecated");
|
||||
}
|
||||
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static PHP_INI_MH(OnUpdateOutputEncoding)
|
||||
{
|
||||
if(new_value_length >= ICONV_CSNMAXLEN) {
|
||||
if(new_value->len >= ICONV_CSNMAXLEN) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
|
||||
php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.output_encoding is deprecated");
|
||||
}
|
||||
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static PHP_INI_MH(OnUpdateInternalEncoding)
|
||||
{
|
||||
if(new_value_length >= ICONV_CSNMAXLEN) {
|
||||
if(new_value->len >= ICONV_CSNMAXLEN) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
|
||||
php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.internal_encoding is deprecated");
|
||||
}
|
||||
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2456,14 +2456,15 @@ PHP_NAMED_FUNCTION(php_if_iconv)
|
|||
Sets internal encoding and output encoding for ob_iconv_handler() */
|
||||
PHP_FUNCTION(iconv_set_encoding)
|
||||
{
|
||||
char *type, *charset;
|
||||
size_t type_len, charset_len = 0, retval;
|
||||
char *type;
|
||||
zend_string *charset;
|
||||
size_t type_len, retval;
|
||||
zend_string *name;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &type, &type_len, &charset, &charset_len) == FAILURE)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sS", &type, &type_len, &charset) == FAILURE)
|
||||
return;
|
||||
|
||||
if (charset_len >= ICONV_CSNMAXLEN) {
|
||||
if (charset->len >= ICONV_CSNMAXLEN) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
@ -2478,7 +2479,7 @@ PHP_FUNCTION(iconv_set_encoding)
|
|||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
retval = zend_alter_ini_entry(name, charset, charset_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
retval = zend_alter_ini_entry(name, charset, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(name);
|
||||
|
||||
if (retval == SUCCESS) {
|
||||
|
|
|
@ -223,12 +223,11 @@ PHP_NAMED_FUNCTION(zif_locale_get_default)
|
|||
Set default locale */
|
||||
PHP_NAMED_FUNCTION(zif_locale_set_default)
|
||||
{
|
||||
char* locale_name = NULL;
|
||||
size_t len = 0;
|
||||
zend_string* locale_name;
|
||||
zend_string *ini_name;
|
||||
char *default_locale = NULL;
|
||||
|
||||
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
|
||||
&locale_name ,&len ) == FAILURE)
|
||||
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "S", &locale_name) == FAILURE)
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"locale_set_default: unable to parse input params", 0 TSRMLS_CC );
|
||||
|
@ -236,13 +235,13 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
|
|||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if(len == 0) {
|
||||
locale_name = (char *)uloc_getDefault() ;
|
||||
len = strlen(locale_name);
|
||||
if (locale_name->len == 0) {
|
||||
default_locale = (char *)uloc_getDefault();
|
||||
locale_name = zend_string_init(default_locale, strlen(default_locale), 0);
|
||||
}
|
||||
|
||||
ini_name = zend_string_init(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, locale_name, len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(ini_name, locale_name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
|
||||
RETURN_TRUE;
|
||||
|
|
|
@ -1209,7 +1209,7 @@ static PHP_INI_MH(OnUpdate_mbstring_language)
|
|||
{
|
||||
enum mbfl_no_language no_language;
|
||||
|
||||
no_language = mbfl_name2no_language(new_value);
|
||||
no_language = mbfl_name2no_language(new_value->val);
|
||||
if (no_language == mbfl_no_language_invalid) {
|
||||
MBSTRG(language) = mbfl_no_language_neutral;
|
||||
return FAILURE;
|
||||
|
@ -1235,7 +1235,7 @@ static PHP_INI_MH(OnUpdate_mbstring_detect_order)
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (FAILURE == php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1 TSRMLS_CC)) {
|
||||
if (FAILURE == php_mb_parse_encoding_list(new_value->val, new_value->len, &list, &size, 1 TSRMLS_CC)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1268,7 +1268,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (FAILURE == php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1 TSRMLS_CC)) {
|
||||
if (FAILURE == php_mb_parse_encoding_list(new_value->val, new_value->len, &list, &size, 1 TSRMLS_CC)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1291,7 +1291,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output)
|
|||
{
|
||||
const mbfl_encoding *encoding;
|
||||
|
||||
if (new_value == NULL || new_value_length == 0) {
|
||||
if (new_value == NULL || new_value->len == 0) {
|
||||
encoding = mbfl_name2encoding(get_output_encoding(TSRMLS_C));
|
||||
if (!encoding) {
|
||||
MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
|
||||
|
@ -1299,7 +1299,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output)
|
|||
return SUCCESS;
|
||||
}
|
||||
} else {
|
||||
encoding = mbfl_name2encoding(new_value);
|
||||
encoding = mbfl_name2encoding(new_value->val);
|
||||
if (!encoding) {
|
||||
MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
|
||||
MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass;
|
||||
|
@ -1350,13 +1350,13 @@ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
|
|||
php_error_docref("ref.mbstring" TSRMLS_CC, E_DEPRECATED, "Use of mbstring.internal_encoding is deprecated");
|
||||
}
|
||||
|
||||
if (OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
|
||||
if (OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (stage & (PHP_INI_STAGE_STARTUP | PHP_INI_STAGE_SHUTDOWN | PHP_INI_STAGE_RUNTIME)) {
|
||||
if (new_value_length) {
|
||||
return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC);
|
||||
if (new_value && new_value->len) {
|
||||
return _php_mb_ini_mbstring_internal_encoding_set(new_value->val, new_value->len TSRMLS_CC);
|
||||
} else {
|
||||
return _php_mb_ini_mbstring_internal_encoding_set(get_internal_encoding(TSRMLS_C), strlen(get_internal_encoding(TSRMLS_C))+1 TSRMLS_CC);
|
||||
}
|
||||
|
@ -1379,20 +1379,20 @@ static PHP_INI_MH(OnUpdate_mbstring_substitute_character)
|
|||
char *endptr = NULL;
|
||||
|
||||
if (new_value != NULL) {
|
||||
if (strcasecmp("none", new_value) == 0) {
|
||||
if (strcasecmp("none", new_value->val) == 0) {
|
||||
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
|
||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
|
||||
} else if (strcasecmp("long", new_value) == 0) {
|
||||
} else if (strcasecmp("long", new_value->val) == 0) {
|
||||
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
|
||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
|
||||
} else if (strcasecmp("entity", new_value) == 0) {
|
||||
} else if (strcasecmp("entity", new_value->val) == 0) {
|
||||
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
|
||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
|
||||
} else {
|
||||
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
|
||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
|
||||
if (new_value_length >0) {
|
||||
c = strtol(new_value, &endptr, 0);
|
||||
if (new_value->len >0) {
|
||||
c = strtol(new_value->val, &endptr, 0);
|
||||
if (*endptr == '\0') {
|
||||
MBSTRG(filter_illegal_substchar) = c;
|
||||
MBSTRG(current_filter_illegal_substchar) = c;
|
||||
|
@ -1417,7 +1417,7 @@ static PHP_INI_MH(OnUpdate_mbstring_encoding_translation)
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
|
||||
if (MBSTRG(encoding_translation)) {
|
||||
sapi_unregister_post_entry(php_post_entries TSRMLS_CC);
|
||||
|
@ -1439,9 +1439,8 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes)
|
|||
|
||||
if (!new_value) {
|
||||
new_value = entry->orig_value;
|
||||
new_value_length = entry->orig_value_length;
|
||||
}
|
||||
php_trim(new_value, new_value_length, NULL, 0, &tmp, 3 TSRMLS_CC);
|
||||
php_trim(new_value->val, new_value->len, NULL, 0, &tmp, 3 TSRMLS_CC);
|
||||
|
||||
if (Z_STRLEN(tmp) > 0) {
|
||||
if (!(re = _php_mb_compile_regex(Z_STRVAL(tmp) TSRMLS_CC))) {
|
||||
|
@ -1732,18 +1731,17 @@ PHP_MINFO_FUNCTION(mbstring)
|
|||
Sets the current language or Returns the current language as a string */
|
||||
PHP_FUNCTION(mb_language)
|
||||
{
|
||||
char *name = NULL;
|
||||
size_t name_len = 0;
|
||||
zend_string *name = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (name == NULL) {
|
||||
RETVAL_STRING((char *)mbfl_no_language2name(MBSTRG(language)));
|
||||
} else {
|
||||
zend_string *ini_name = zend_string_init("mbstring.language", sizeof("mbstring.language") - 1, 0);
|
||||
if (FAILURE == zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown language \"%s\"", name);
|
||||
if (FAILURE == zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown language \"%s\"", name->val);
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
RETVAL_TRUE;
|
||||
|
|
|
@ -485,7 +485,7 @@ static void _close_mysql_plink(zend_resource *rsrc TSRMLS_DC)
|
|||
static PHP_INI_MH(OnMySQLPort)
|
||||
{
|
||||
if (new_value != NULL) { /* default port */
|
||||
MySG(default_port) = atoi(new_value);
|
||||
MySG(default_port) = atoi(new_value->val);
|
||||
} else {
|
||||
MySG(default_port) = -1;
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ static PHP_INI_MH(OnUpdateNetCmdBufferSize)
|
|||
{
|
||||
zend_long long_value;
|
||||
|
||||
ZEND_ATOL(long_value, new_value);
|
||||
ZEND_ATOL(long_value, new_value->val);
|
||||
if (long_value < MYSQLND_NET_CMD_BUFFER_MIN_SIZE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
|
|
@ -524,9 +524,9 @@ static PHP_INI_DISP(display_link_nums)
|
|||
TSRMLS_FETCH();
|
||||
|
||||
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
value = ini_entry->orig_value;
|
||||
value = ini_entry->orig_value->val;
|
||||
} else if (ini_entry->value) {
|
||||
value = ini_entry->value;
|
||||
value = ini_entry->value->val;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
|
@ -549,9 +549,9 @@ static PHP_INI_DISP(display_defPW)
|
|||
TSRMLS_FETCH();
|
||||
|
||||
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
value = ini_entry->orig_value;
|
||||
value = ini_entry->orig_value->val;
|
||||
} else if (ini_entry->value) {
|
||||
value = ini_entry->value;
|
||||
value = ini_entry->value->val;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
|
@ -580,9 +580,9 @@ static PHP_INI_DISP(display_binmode)
|
|||
TSRMLS_FETCH();
|
||||
|
||||
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
value = ini_entry->orig_value;
|
||||
value = ini_entry->orig_value->val;
|
||||
} else if (ini_entry->value) {
|
||||
value = ini_entry->value;
|
||||
value = ini_entry->value->val;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
|
@ -611,9 +611,9 @@ static PHP_INI_DISP(display_lrl)
|
|||
TSRMLS_FETCH();
|
||||
|
||||
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
value = ini_entry->orig_value;
|
||||
value = ini_entry->orig_value->val;
|
||||
} else if (ini_entry->value) {
|
||||
value = ini_entry->value;
|
||||
value = ini_entry->value->val;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
|
@ -637,9 +637,9 @@ static PHP_INI_DISP(display_cursortype)
|
|||
TSRMLS_FETCH();
|
||||
|
||||
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
value = ini_entry->orig_value;
|
||||
value = ini_entry->orig_value->val;
|
||||
} else if (ini_entry->value) {
|
||||
value = ini_entry->value;
|
||||
value = ini_entry->value->val;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
|
|
|
@ -192,13 +192,13 @@ void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason T
|
|||
*/
|
||||
static ZEND_INI_MH(accel_include_path_on_modify)
|
||||
{
|
||||
int ret = orig_include_path_on_modify(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
int ret = orig_include_path_on_modify(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
|
||||
ZCG(include_path_key) = NULL;
|
||||
if (ret == SUCCESS) {
|
||||
ZCG(include_path) = new_value;
|
||||
ZCG(include_path) = new_value->val;
|
||||
if (ZCG(include_path) && *ZCG(include_path)) {
|
||||
ZCG(include_path_len) = new_value_length;
|
||||
ZCG(include_path_len) = new_value->len;
|
||||
|
||||
if (ZCG(enabled) && accel_startup_ok &&
|
||||
(ZCG(counted) || ZCSG(accelerator_enabled))) {
|
||||
|
|
|
@ -109,10 +109,10 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
|
|||
#endif
|
||||
|
||||
/* keep the compiler happy */
|
||||
(void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage;
|
||||
(void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
|
||||
|
||||
p = (zend_long *) (base + (size_t)mh_arg1);
|
||||
memsize = atoi(new_value);
|
||||
memsize = atoi(new_value->val);
|
||||
/* sanity check we must use at least 8 MB */
|
||||
if (memsize < 8) {
|
||||
const char *new_new_value = "8";
|
||||
|
@ -128,8 +128,7 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
ini_entry->value = strdup(new_new_value);
|
||||
ini_entry->value_length = strlen(new_new_value);
|
||||
ini_entry->value = zend_string_init(new_new_value, 1, 1);
|
||||
}
|
||||
*p = memsize * (1024 * 1024);
|
||||
return SUCCESS;
|
||||
|
@ -146,10 +145,10 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles)
|
|||
#endif
|
||||
|
||||
/* keep the compiler happy */
|
||||
(void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage;
|
||||
(void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
|
||||
|
||||
p = (zend_long *) (base + (size_t)mh_arg1);
|
||||
size = atoi(new_value);
|
||||
size = atoi(new_value->val);
|
||||
/* sanity check we must use a value between MIN_ACCEL_FILES and MAX_ACCEL_FILES */
|
||||
|
||||
if (size < MIN_ACCEL_FILES || size > MAX_ACCEL_FILES) {
|
||||
|
@ -173,8 +172,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles)
|
|||
sizeof("opcache.max_accelerated_files")-1)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
ini_entry->value = strdup(new_new_value);
|
||||
ini_entry->value_length = strlen(new_new_value);
|
||||
ini_entry->value = zend_string_init(new_new_value, strlen(new_new_value), 1);
|
||||
}
|
||||
*p = size;
|
||||
return SUCCESS;
|
||||
|
@ -191,10 +189,10 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
|
|||
#endif
|
||||
|
||||
/* keep the compiler happy */
|
||||
(void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage;
|
||||
(void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
|
||||
|
||||
p = (double *) (base + (size_t)mh_arg1);
|
||||
percentage = atoi(new_value);
|
||||
percentage = atoi(new_value->val);
|
||||
|
||||
if (percentage <= 0 || percentage > 50) {
|
||||
const char *new_new_value = "5";
|
||||
|
@ -208,8 +206,7 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
|
|||
sizeof("opcache.max_wasted_percentage")-1)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
ini_entry->value = strdup(new_new_value);
|
||||
ini_entry->value_length = strlen(new_new_value);
|
||||
ini_entry->value = zend_string_init(new_new_value, strlen(new_new_value), 1);
|
||||
}
|
||||
*p = (double)percentage / 100.0;
|
||||
return SUCCESS;
|
||||
|
@ -220,7 +217,7 @@ static ZEND_INI_MH(OnEnable)
|
|||
if (stage == ZEND_INI_STAGE_STARTUP ||
|
||||
stage == ZEND_INI_STAGE_SHUTDOWN ||
|
||||
stage == ZEND_INI_STAGE_DEACTIVATE) {
|
||||
return OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
} else {
|
||||
/* It may be only temporary disabled */
|
||||
zend_bool *p;
|
||||
|
@ -231,10 +228,10 @@ static ZEND_INI_MH(OnEnable)
|
|||
#endif
|
||||
|
||||
p = (zend_bool *) (base+(size_t) mh_arg1);
|
||||
if ((new_value_length == 2 && strcasecmp("on", new_value) == 0) ||
|
||||
(new_value_length == 3 && strcasecmp("yes", new_value) == 0) ||
|
||||
(new_value_length == 4 && strcasecmp("true", new_value) == 0) ||
|
||||
atoi(new_value) != 0) {
|
||||
if ((new_value->len == 2 && strcasecmp("on", new_value->val) == 0) ||
|
||||
(new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) ||
|
||||
(new_value->len == 4 && strcasecmp("true", new_value->val) == 0) ||
|
||||
atoi(new_value->val) != 0) {
|
||||
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporary enabled (it may be only disabled till the end of request)");
|
||||
return FAILURE;
|
||||
} else {
|
||||
|
|
|
@ -50,28 +50,28 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
|
|||
{
|
||||
zend_bool old, ini;
|
||||
|
||||
if (entry->name_length == sizeof("phar.readonly")-1) {
|
||||
if (entry->name->len == sizeof("phar.readonly")-1) {
|
||||
old = PHAR_G(readonly_orig);
|
||||
} else {
|
||||
old = PHAR_G(require_hash_orig);
|
||||
}
|
||||
|
||||
if (new_value_length == 2 && !strcasecmp("on", new_value)) {
|
||||
if (new_value->len == 2 && !strcasecmp("on", new_value->val)) {
|
||||
ini = (zend_bool) 1;
|
||||
}
|
||||
else if (new_value_length == 3 && !strcasecmp("yes", new_value)) {
|
||||
else if (new_value->len == 3 && !strcasecmp("yes", new_value->val)) {
|
||||
ini = (zend_bool) 1;
|
||||
}
|
||||
else if (new_value_length == 4 && !strcasecmp("true", new_value)) {
|
||||
else if (new_value->len == 4 && !strcasecmp("true", new_value->val)) {
|
||||
ini = (zend_bool) 1;
|
||||
}
|
||||
else {
|
||||
ini = (zend_bool) atoi(new_value);
|
||||
ini = (zend_bool) atoi(new_value->val);
|
||||
}
|
||||
|
||||
/* do not allow unsetting in runtime */
|
||||
if (stage == ZEND_INI_STAGE_STARTUP) {
|
||||
if (entry->name_length == sizeof("phar.readonly")-1) {
|
||||
if (entry->name->len == sizeof("phar.readonly")-1) {
|
||||
PHAR_G(readonly_orig) = ini;
|
||||
} else {
|
||||
PHAR_G(require_hash_orig) = ini;
|
||||
|
@ -80,7 +80,7 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
if (entry->name_length == sizeof("phar.readonly")-1) {
|
||||
if (entry->name->len == sizeof("phar.readonly")-1) {
|
||||
PHAR_G(readonly) = ini;
|
||||
if (PHAR_GLOBALS->request_init && PHAR_GLOBALS->phar_fname_map.arHash) {
|
||||
zend_hash_apply_with_argument(&(PHAR_GLOBALS->phar_fname_map), phar_set_writeable_bit, (void *)&ini TSRMLS_CC);
|
||||
|
@ -183,7 +183,7 @@ finish_error:
|
|||
|
||||
ZEND_INI_MH(phar_ini_cache_list) /* {{{ */
|
||||
{
|
||||
PHAR_G(cache_list) = new_value;
|
||||
PHAR_G(cache_list) = new_value->val;
|
||||
|
||||
if (stage == ZEND_INI_STAGE_STARTUP) {
|
||||
phar_split_cache_list(TSRMLS_C);
|
||||
|
|
|
@ -409,7 +409,7 @@ static int cli_is_valid_code(char *code, int len, zend_string **prompt TSRMLS_DC
|
|||
static char *cli_completion_generator_ht(const char *text, int textlen, int *state, HashTable *ht, void **pData TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_string *name;
|
||||
ulong number;
|
||||
zend_ulong number;
|
||||
|
||||
if (!(*state % 2)) {
|
||||
zend_hash_internal_pointer_reset(ht);
|
||||
|
@ -633,7 +633,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
|
|||
param++;
|
||||
cmd = zend_string_init(&line[1], param - &line[1] - 1, 0);
|
||||
|
||||
zend_alter_ini_entry_ex(cmd, param, strlen(param), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_alter_ini_entry_chars_ex(cmd, param, strlen(param), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_string_release(cmd);
|
||||
add_history(line);
|
||||
|
||||
|
|
|
@ -958,7 +958,7 @@ static int _extension_ini_string(zval *el TSRMLS_DC, int num_args, va_list args,
|
|||
char *comma = "";
|
||||
|
||||
if (number == ini_entry->module_number) {
|
||||
string_printf(str, " %sEntry [ %s <", indent, ini_entry->name);
|
||||
string_printf(str, " %sEntry [ %s <", indent, ini_entry->name->val);
|
||||
if (ini_entry->modifiable == ZEND_INI_ALL) {
|
||||
string_printf(str, "ALL");
|
||||
} else {
|
||||
|
@ -976,9 +976,9 @@ static int _extension_ini_string(zval *el TSRMLS_DC, int num_args, va_list args,
|
|||
}
|
||||
|
||||
string_printf(str, "> ]\n");
|
||||
string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value : "");
|
||||
string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value->val : "");
|
||||
if (ini_entry->modified) {
|
||||
string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value : "");
|
||||
string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value->val : "");
|
||||
}
|
||||
string_printf(str, " %s}\n", indent);
|
||||
}
|
||||
|
@ -5278,9 +5278,12 @@ static int _addinientry(zval *el TSRMLS_DC, int num_args, va_list args, zend_has
|
|||
|
||||
if (number == ini_entry->module_number) {
|
||||
if (ini_entry->value) {
|
||||
add_assoc_stringl(retval, ini_entry->name, ini_entry->value, ini_entry->value_length);
|
||||
zval zv;
|
||||
|
||||
ZVAL_STR(&zv, ini_entry->value);
|
||||
zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &zv);
|
||||
} else {
|
||||
add_assoc_null(retval, ini_entry->name);
|
||||
zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &EG(uninitialized_zval));
|
||||
}
|
||||
}
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
|
|
|
@ -581,7 +581,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
|
|||
ps_module *tmp;
|
||||
SESSION_CHECK_ACTIVE_STATE;
|
||||
|
||||
tmp = _php_find_ps_module(new_value TSRMLS_CC);
|
||||
tmp = _php_find_ps_module(new_value->val TSRMLS_CC);
|
||||
|
||||
if (PG(modules_activated) && !tmp) {
|
||||
int err_type;
|
||||
|
@ -594,7 +594,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
|
|||
|
||||
/* Do not output error when restoring ini options. */
|
||||
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
|
||||
php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find save handler '%s'", new_value);
|
||||
php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find save handler '%s'", new_value->val);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
|
|||
const ps_serializer *tmp;
|
||||
SESSION_CHECK_ACTIVE_STATE;
|
||||
|
||||
tmp = _php_find_ps_serializer(new_value TSRMLS_CC);
|
||||
tmp = _php_find_ps_serializer(new_value->val TSRMLS_CC);
|
||||
|
||||
if (PG(modules_activated) && !tmp) {
|
||||
int err_type;
|
||||
|
@ -624,7 +624,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
|
|||
|
||||
/* Do not output error when restoring ini options. */
|
||||
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
|
||||
php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find serialization handler '%s'", new_value);
|
||||
php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find serialization handler '%s'", new_value->val);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
@ -638,10 +638,10 @@ static PHP_INI_MH(OnUpdateTransSid) /* {{{ */
|
|||
{
|
||||
SESSION_CHECK_ACTIVE_STATE;
|
||||
|
||||
if (!strncasecmp(new_value, "on", sizeof("on"))) {
|
||||
if (!strncasecmp(new_value->val, "on", sizeof("on"))) {
|
||||
PS(use_trans_sid) = (zend_bool) 1;
|
||||
} else {
|
||||
PS(use_trans_sid) = (zend_bool) atoi(new_value);
|
||||
PS(use_trans_sid) = (zend_bool) atoi(new_value->val);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
@ -654,19 +654,19 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
|
|||
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) {
|
||||
char *p;
|
||||
|
||||
if (memchr(new_value, '\0', new_value_length) != NULL) {
|
||||
if (memchr(new_value->val, '\0', new_value->len) != NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* we do not use zend_memrchr() since path can contain ; itself */
|
||||
if ((p = strchr(new_value, ';'))) {
|
||||
if ((p = strchr(new_value->val, ';'))) {
|
||||
char *p2;
|
||||
p++;
|
||||
if ((p2 = strchr(p, ';'))) {
|
||||
p = p2 + 1;
|
||||
}
|
||||
} else {
|
||||
p = new_value;
|
||||
p = new_value->val;
|
||||
}
|
||||
|
||||
if (PG(open_basedir) && *p && php_check_open_basedir(p TSRMLS_CC)) {
|
||||
|
@ -674,7 +674,7 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
|
|||
}
|
||||
}
|
||||
|
||||
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -682,7 +682,7 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
|
|||
static PHP_INI_MH(OnUpdateName) /* {{{ */
|
||||
{
|
||||
/* Numeric session.name won't work at all */
|
||||
if ((!new_value_length || is_numeric_string(new_value, new_value_length, NULL, NULL, 0))) {
|
||||
if ((!new_value->len || is_numeric_string(new_value->val, new_value->len, NULL, NULL, 0))) {
|
||||
int err_type;
|
||||
|
||||
if (stage == ZEND_INI_STAGE_RUNTIME || stage == ZEND_INI_STAGE_ACTIVATE || stage == ZEND_INI_STAGE_STARTUP) {
|
||||
|
@ -693,12 +693,12 @@ static PHP_INI_MH(OnUpdateName) /* {{{ */
|
|||
|
||||
/* Do not output error when restoring ini options. */
|
||||
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
|
||||
php_error_docref(NULL TSRMLS_CC, err_type, "session.name cannot be a numeric or empty '%s'", new_value);
|
||||
php_error_docref(NULL TSRMLS_CC, err_type, "session.name cannot be a numeric or empty '%s'", new_value->val);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
OnUpdateStringUnempty(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateStringUnempty(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -712,7 +712,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
|
|||
PS(hash_ops) = NULL;
|
||||
#endif
|
||||
|
||||
val = ZEND_STRTOL(new_value, &endptr, 10);
|
||||
val = ZEND_STRTOL(new_value->val, &endptr, 10);
|
||||
if (endptr && (*endptr == '\0')) {
|
||||
/* Numeric value */
|
||||
PS(hash_func) = val ? 1 : 0;
|
||||
|
@ -720,15 +720,15 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (new_value_length == (sizeof("md5") - 1) &&
|
||||
strncasecmp(new_value, "md5", sizeof("md5") - 1) == 0) {
|
||||
if (new_value->len == (sizeof("md5") - 1) &&
|
||||
strncasecmp(new_value->val, "md5", sizeof("md5") - 1) == 0) {
|
||||
PS(hash_func) = PS_HASH_FUNC_MD5;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (new_value_length == (sizeof("sha1") - 1) &&
|
||||
strncasecmp(new_value, "sha1", sizeof("sha1") - 1) == 0) {
|
||||
if (new_value->len == (sizeof("sha1") - 1) &&
|
||||
strncasecmp(new_value->val, "sha1", sizeof("sha1") - 1) == 0) {
|
||||
PS(hash_func) = PS_HASH_FUNC_SHA1;
|
||||
|
||||
return SUCCESS;
|
||||
|
@ -736,7 +736,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
|
|||
|
||||
#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) /* {{{ */
|
||||
{
|
||||
php_hash_ops *ops = (php_hash_ops*)php_hash_fetch_ops(new_value, new_value_length);
|
||||
php_hash_ops *ops = (php_hash_ops*)php_hash_fetch_ops(new_value->val, new_value->len);
|
||||
|
||||
if (ops) {
|
||||
PS(hash_func) = PS_HASH_FUNC_OTHER;
|
||||
|
@ -747,7 +747,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
|
|||
}
|
||||
#endif /* HAVE_HASH_EXT }}} */
|
||||
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.configuration 'session.hash_function' must be existing hash function. %s does not exist.", new_value);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.configuration 'session.hash_function' must be existing hash function. %s does not exist.", new_value->val);
|
||||
return FAILURE;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -755,12 +755,12 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
|
|||
static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
|
||||
{
|
||||
int tmp;
|
||||
tmp = zend_atoi(new_value, new_value_length);
|
||||
tmp = zend_atoi(new_value->val, new_value->len);
|
||||
if(tmp < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.upload_progress.freq must be greater than or equal to zero");
|
||||
return FAILURE;
|
||||
}
|
||||
if(new_value_length > 0 && new_value[new_value_length-1] == '%') {
|
||||
if(new_value->len > 0 && new_value->val[new_value->len-1] == '%') {
|
||||
if(tmp > 100) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.upload_progress.freq cannot be over 100%%");
|
||||
return FAILURE;
|
||||
|
@ -1643,42 +1643,41 @@ PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t
|
|||
static PHP_FUNCTION(session_set_cookie_params)
|
||||
{
|
||||
zval *lifetime;
|
||||
char *path = NULL, *domain = NULL;
|
||||
size_t path_len, domain_len;
|
||||
zend_string *path = NULL, *domain = NULL;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
zend_bool secure = 0, httponly = 0;
|
||||
zend_string *ini_name;
|
||||
|
||||
if (!PS(use_cookies) ||
|
||||
zend_parse_parameters(argc TSRMLS_CC, "z|ssbb", &lifetime, &path, &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) {
|
||||
zend_parse_parameters(argc TSRMLS_CC, "z|SSbb", &lifetime, &path, &domain, &secure, &httponly) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
convert_to_string_ex(lifetime);
|
||||
|
||||
ini_name = zend_string_init("session.cookie_lifetime", sizeof("session.cookie_lifetime") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, Z_STRVAL_P(lifetime), Z_STRLEN_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(ini_name, Z_STR_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
|
||||
if (path) {
|
||||
ini_name = zend_string_init("session.cookie_path", sizeof("session.cookie_path") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, path, path_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(ini_name, path, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
if (domain) {
|
||||
ini_name = zend_string_init("session.cookie_domain", sizeof("session.cookie_domain") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, domain, domain_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(ini_name, domain, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
|
||||
if (argc > 3) {
|
||||
ini_name = zend_string_init("session.cookie_secure", sizeof("session.cookie_secure") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, secure ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry_chars(ini_name, secure ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
if (argc > 4) {
|
||||
ini_name = zend_string_init("session.cookie_httponly", sizeof("session.cookie_httponly") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, httponly ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry_chars(ini_name, httponly ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
}
|
||||
|
@ -1706,11 +1705,10 @@ static PHP_FUNCTION(session_get_cookie_params)
|
|||
Return the current session name. If newname is given, the session name is replaced with newname */
|
||||
static PHP_FUNCTION(session_name)
|
||||
{
|
||||
char *name = NULL;
|
||||
size_t name_len;
|
||||
zend_string *name = NULL;
|
||||
zend_string *ini_name;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1718,7 +1716,7 @@ static PHP_FUNCTION(session_name)
|
|||
|
||||
if (name) {
|
||||
ini_name = zend_string_init("session.name", sizeof("session.name") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
}
|
||||
|
@ -1728,11 +1726,10 @@ static PHP_FUNCTION(session_name)
|
|||
Return the current module name used for accessing session data. If newname is given, the module name is replaced with newname */
|
||||
static PHP_FUNCTION(session_module_name)
|
||||
{
|
||||
char *name = NULL;
|
||||
size_t name_len;
|
||||
zend_string *name = NULL;
|
||||
zend_string *ini_name;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1744,8 +1741,8 @@ static PHP_FUNCTION(session_module_name)
|
|||
}
|
||||
|
||||
if (name) {
|
||||
if (!_php_find_ps_module(name TSRMLS_CC)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find named PHP session module (%s)", name);
|
||||
if (!_php_find_ps_module(name->val TSRMLS_CC)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find named PHP session module (%s)", name->val);
|
||||
|
||||
zval_dtor(return_value);
|
||||
RETURN_FALSE;
|
||||
|
@ -1756,7 +1753,7 @@ static PHP_FUNCTION(session_module_name)
|
|||
PS(mod_data) = NULL;
|
||||
|
||||
ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
}
|
||||
|
@ -1769,7 +1766,7 @@ static PHP_FUNCTION(session_set_save_handler)
|
|||
zval *args = NULL;
|
||||
int i, num_args, argc = ZEND_NUM_ARGS();
|
||||
zend_string *name;
|
||||
zend_string *ini_name;
|
||||
zend_string *ini_name, *ini_val;
|
||||
|
||||
if (PS(session_status) != php_session_none) {
|
||||
RETURN_FALSE;
|
||||
|
@ -1843,7 +1840,9 @@ static PHP_FUNCTION(session_set_save_handler)
|
|||
|
||||
if (PS(mod) && PS(session_status) == php_session_none && PS(mod) != &ps_mod_user) {
|
||||
ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, "user", sizeof("user") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
ini_val = zend_string_init("user", sizeof("user") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_val);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
|
||||
|
@ -1873,7 +1872,9 @@ static PHP_FUNCTION(session_set_save_handler)
|
|||
|
||||
if (PS(mod) && PS(mod) != &ps_mod_user) {
|
||||
ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
ini_val = zend_string_init("user", sizeof("user") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_val);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
|
||||
|
@ -1892,24 +1893,23 @@ static PHP_FUNCTION(session_set_save_handler)
|
|||
Return the current save path passed to module_name. If newname is given, the save path is replaced with newname */
|
||||
static PHP_FUNCTION(session_save_path)
|
||||
{
|
||||
char *name = NULL;
|
||||
size_t name_len;
|
||||
zend_string *name = NULL;
|
||||
zend_string *ini_name;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
RETVAL_STRING(PS(save_path));
|
||||
|
||||
if (name) {
|
||||
if (memchr(name, '\0', name_len) != NULL) {
|
||||
if (memchr(name->val, '\0', name->len) != NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The save_path cannot contain NULL characters");
|
||||
zval_dtor(return_value);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ini_name = zend_string_init("session.save_path", sizeof("session.save_path") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
}
|
||||
|
@ -1990,11 +1990,10 @@ static PHP_FUNCTION(session_regenerate_id)
|
|||
Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */
|
||||
static PHP_FUNCTION(session_cache_limiter)
|
||||
{
|
||||
char *limiter = NULL;
|
||||
size_t limiter_len;
|
||||
zend_string *limiter = NULL;
|
||||
zend_string *ini_name;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &limiter, &limiter_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &limiter) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2002,7 +2001,7 @@ static PHP_FUNCTION(session_cache_limiter)
|
|||
|
||||
if (limiter) {
|
||||
ini_name = zend_string_init("session.cache_limiter", sizeof("session.cache_limiter") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, limiter, limiter_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(ini_name, limiter, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
}
|
||||
|
@ -2024,7 +2023,7 @@ static PHP_FUNCTION(session_cache_expire)
|
|||
if (expires) {
|
||||
convert_to_string_ex(expires);
|
||||
ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0);
|
||||
zend_alter_ini_entry(ini_name, Z_STRVAL_P(expires), Z_STRLEN_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry(ini_name, Z_STR_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_string_release(ini_name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -479,7 +479,7 @@ ZEND_INI_MH(OnUpdateCacheMode)
|
|||
|
||||
p = (char*) (base+(size_t) mh_arg1);
|
||||
|
||||
*p = (char)atoi(new_value);
|
||||
*p = (char)atoi(new_value->val);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -490,19 +490,19 @@ static PHP_INI_MH(OnUpdateCacheDir)
|
|||
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) {
|
||||
char *p;
|
||||
|
||||
if (memchr(new_value, '\0', new_value_length) != NULL) {
|
||||
if (memchr(new_value->val, '\0', new_value->len) != NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* we do not use zend_memrchr() since path can contain ; itself */
|
||||
if ((p = strchr(new_value, ';'))) {
|
||||
if ((p = strchr(new_value->val, ';'))) {
|
||||
char *p2;
|
||||
p++;
|
||||
if ((p2 = strchr(p, ';'))) {
|
||||
p = p2 + 1;
|
||||
}
|
||||
} else {
|
||||
p = new_value;
|
||||
p = new_value->val;
|
||||
}
|
||||
|
||||
if (PG(open_basedir) && *p && php_check_open_basedir(p TSRMLS_CC)) {
|
||||
|
@ -510,7 +510,7 @@ static PHP_INI_MH(OnUpdateCacheDir)
|
|||
}
|
||||
}
|
||||
|
||||
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,17 +58,17 @@ static PHP_INI_MH(OnChangeCallback) /* {{{ */
|
|||
zval_ptr_dtor(&ASSERTG(callback));
|
||||
ZVAL_UNDEF(&ASSERTG(callback));
|
||||
}
|
||||
if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || new_value_length)) {
|
||||
ZVAL_STRINGL(&ASSERTG(callback), new_value, new_value_length);
|
||||
if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || new_value->len)) {
|
||||
ZVAL_STRINGL(&ASSERTG(callback), new_value->val, new_value->len);
|
||||
}
|
||||
} else {
|
||||
if (ASSERTG(cb)) {
|
||||
pefree(ASSERTG(cb), 1);
|
||||
}
|
||||
if (new_value && new_value_length) {
|
||||
ASSERTG(cb) = pemalloc(new_value_length + 1, 1);
|
||||
memcpy(ASSERTG(cb), new_value, new_value_length);
|
||||
ASSERTG(cb)[new_value_length] = '\0';
|
||||
if (new_value && new_value->len) {
|
||||
ASSERTG(cb) = pemalloc(new_value->len + 1, 1);
|
||||
memcpy(ASSERTG(cb), new_value->val, new_value->len);
|
||||
ASSERTG(cb)[new_value->len] = '\0';
|
||||
} else {
|
||||
ASSERTG(cb) = NULL;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ PHP_FUNCTION(assert_options)
|
|||
if (ac == 2) {
|
||||
zend_string *value_str = zval_get_string(value);
|
||||
key = zend_string_init("assert.active", sizeof("assert.active")-1, 0);
|
||||
zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_string_release(key);
|
||||
zend_string_release(value_str);
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ PHP_FUNCTION(assert_options)
|
|||
if (ac == 2) {
|
||||
zend_string *value_str = zval_get_string(value);
|
||||
key = zend_string_init("assert.bail", sizeof("assert.bail")-1, 0);
|
||||
zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_string_release(key);
|
||||
zend_string_release(value_str);
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ PHP_FUNCTION(assert_options)
|
|||
if (ac == 2) {
|
||||
zend_string *value_str = zval_get_string(value);
|
||||
key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0);
|
||||
zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_string_release(key);
|
||||
zend_string_release(value_str);
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ PHP_FUNCTION(assert_options)
|
|||
if (ac == 2) {
|
||||
zend_string *value_str = zval_get_string(value);
|
||||
key = zend_string_init("assert.warning", sizeof("assert.warning")-1, 0);
|
||||
zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_string_release(key);
|
||||
zend_string_release(value_str);
|
||||
}
|
||||
|
|
|
@ -5234,27 +5234,30 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze
|
|||
array_init(&option);
|
||||
|
||||
if (ini_entry->orig_value) {
|
||||
add_assoc_stringl(&option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length);
|
||||
add_assoc_stringl(&option, "global_value", ini_entry->orig_value->val, ini_entry->orig_value->len);
|
||||
} else if (ini_entry->value) {
|
||||
add_assoc_stringl(&option, "global_value", ini_entry->value, ini_entry->value_length);
|
||||
add_assoc_stringl(&option, "global_value", ini_entry->value->val, ini_entry->value->len);
|
||||
} else {
|
||||
add_assoc_null(&option, "global_value");
|
||||
}
|
||||
|
||||
if (ini_entry->value) {
|
||||
add_assoc_stringl(&option, "local_value", ini_entry->value, ini_entry->value_length);
|
||||
add_assoc_stringl(&option, "local_value", ini_entry->value->val, ini_entry->value->len);
|
||||
} else {
|
||||
add_assoc_null(&option, "local_value");
|
||||
}
|
||||
|
||||
add_assoc_long(&option, "access", ini_entry->modifiable);
|
||||
|
||||
add_assoc_zval_ex(ini_array, ini_entry->name, ini_entry->name_length, &option);
|
||||
zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &option);
|
||||
} else {
|
||||
if (ini_entry->value) {
|
||||
add_assoc_stringl(ini_array, ini_entry->name, ini_entry->value, ini_entry->value_length);
|
||||
zval zv;
|
||||
|
||||
ZVAL_STR(&zv, ini_entry->value);
|
||||
zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &zv);
|
||||
} else {
|
||||
add_assoc_null(ini_array, ini_entry->name);
|
||||
zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &EG(uninitialized_zval));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5305,11 +5308,10 @@ static int php_ini_check_path(char *option_name, int option_len, char *new_optio
|
|||
PHP_FUNCTION(ini_set)
|
||||
{
|
||||
zend_string *varname;
|
||||
char *new_value;
|
||||
size_t new_value_len;
|
||||
zend_string *new_value;
|
||||
char *old_value;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss", &varname, &new_value, &new_value_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &varname, &new_value) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5331,14 +5333,14 @@ PHP_FUNCTION(ini_set)
|
|||
_CHECK_PATH(varname->val, varname->len, "mail.log") ||
|
||||
_CHECK_PATH(varname->val, varname->len, "java.library.path") ||
|
||||
_CHECK_PATH(varname->val, varname->len, "vpopmail.directory")) {
|
||||
if (php_check_open_basedir(new_value TSRMLS_CC)) {
|
||||
if (php_check_open_basedir(new_value->val TSRMLS_CC)) {
|
||||
zval_dtor(return_value);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (zend_alter_ini_entry_ex(varname, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
|
||||
if (zend_alter_ini_entry_ex(varname, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
|
||||
zval_dtor(return_value);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
@ -5363,12 +5365,11 @@ PHP_FUNCTION(ini_restore)
|
|||
Sets the include_path configuration option */
|
||||
PHP_FUNCTION(set_include_path)
|
||||
{
|
||||
char *new_value;
|
||||
size_t new_value_len;
|
||||
zend_string *new_value;
|
||||
char *old_value;
|
||||
zend_string *key;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &new_value, &new_value_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &new_value) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5381,7 +5382,7 @@ PHP_FUNCTION(set_include_path)
|
|||
}
|
||||
|
||||
key = zend_string_init("include_path", sizeof("include_path") - 1, 0);
|
||||
if (zend_alter_ini_entry_ex(key, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
|
||||
if (zend_alter_ini_entry_ex(key, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
|
||||
zend_string_release(key);
|
||||
zval_dtor(return_value);
|
||||
RETURN_FALSE;
|
||||
|
@ -5471,11 +5472,10 @@ PHP_FUNCTION(connection_status)
|
|||
Set whether we want to ignore a user abort event or not */
|
||||
PHP_FUNCTION(ignore_user_abort)
|
||||
{
|
||||
char *arg = NULL;
|
||||
size_t arg_len = 0;
|
||||
zend_string *arg = NULL;
|
||||
int old_setting;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &arg) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5483,7 +5483,7 @@ PHP_FUNCTION(ignore_user_abort)
|
|||
|
||||
if (arg) {
|
||||
zend_string *key = zend_string_init("ignore_user_abort", sizeof("ignore_user_abort"), 0);
|
||||
zend_alter_ini_entry_ex(key, arg, arg_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_alter_ini_entry_ex(key, arg, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
|
||||
zend_string_release(key);
|
||||
}
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ PHP_INI_MH(OnChangeBrowscap)
|
|||
if (bdata->filename[0] != '\0') {
|
||||
browscap_bdata_dtor(bdata, 0 TSRMLS_CC);
|
||||
}
|
||||
if (VCWD_REALPATH(new_value, bdata->filename) == NULL) {
|
||||
if (VCWD_REALPATH(new_value->val, bdata->filename) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
|
|
@ -58,7 +58,7 @@ static PHP_INI_MH(OnUpdateTags)
|
|||
|
||||
ctx = &BG(url_adapt_state_ex);
|
||||
|
||||
tmp = estrndup(new_value, new_value_length);
|
||||
tmp = estrndup(new_value->val, new_value->len);
|
||||
|
||||
if (ctx->tags)
|
||||
zend_hash_destroy(ctx->tags);
|
||||
|
|
|
@ -56,7 +56,7 @@ static PHP_INI_MH(OnUpdateTags)
|
|||
|
||||
ctx = &BG(url_adapt_state_ex);
|
||||
|
||||
tmp = estrndup(new_value, new_value_length);
|
||||
tmp = estrndup(new_value->val, new_value->len);
|
||||
|
||||
if (ctx->tags)
|
||||
zend_hash_destroy(ctx->tags);
|
||||
|
|
|
@ -1080,14 +1080,14 @@ static PHP_INI_MH(php_tidy_set_clean_output)
|
|||
int status;
|
||||
zend_bool value;
|
||||
|
||||
if (new_value_length==2 && strcasecmp("on", new_value)==0) {
|
||||
if (new_value->len==2 && strcasecmp("on", new_value->val)==0) {
|
||||
value = (zend_bool) 1;
|
||||
} else if (new_value_length==3 && strcasecmp("yes", new_value)==0) {
|
||||
} else if (new_value->len==3 && strcasecmp("yes", new_value->val)==0) {
|
||||
value = (zend_bool) 1;
|
||||
} else if (new_value_length==4 && strcasecmp("true", new_value)==0) {
|
||||
} else if (new_value->len==4 && strcasecmp("true", new_value->val)==0) {
|
||||
value = (zend_bool) 1;
|
||||
} else {
|
||||
value = (zend_bool) atoi(new_value);
|
||||
value = (zend_bool) atoi(new_value->val);
|
||||
}
|
||||
|
||||
if (stage == PHP_INI_STAGE_RUNTIME) {
|
||||
|
@ -1103,7 +1103,7 @@ static PHP_INI_MH(php_tidy_set_clean_output)
|
|||
}
|
||||
}
|
||||
|
||||
status = OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
status = OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
|
||||
if (stage == PHP_INI_STAGE_RUNTIME && value) {
|
||||
if (!php_output_handler_started(ZEND_STRL("ob_tidyhandler") TSRMLS_CC)) {
|
||||
|
|
|
@ -863,22 +863,28 @@ static const zend_function_entry php_zlib_functions[] = {
|
|||
/* {{{ OnUpdate_zlib_output_compression */
|
||||
static PHP_INI_MH(OnUpdate_zlib_output_compression)
|
||||
{
|
||||
int status, int_value;
|
||||
int int_value;
|
||||
char *ini_value;
|
||||
zend_long *p;
|
||||
#ifndef ZTS
|
||||
char *base = (char *) mh_arg2;
|
||||
#else
|
||||
char *base;
|
||||
|
||||
base = (char *) ts_resource(*((int *) mh_arg2));
|
||||
#endif
|
||||
|
||||
if (new_value == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!strncasecmp(new_value, "off", sizeof("off"))) {
|
||||
new_value = "0";
|
||||
new_value_length = sizeof("0");
|
||||
} else if (!strncasecmp(new_value, "on", sizeof("on"))) {
|
||||
new_value = "1";
|
||||
new_value_length = sizeof("1");
|
||||
if (!strncasecmp(new_value->val, "off", sizeof("off"))) {
|
||||
int_value = 0;
|
||||
} else if (!strncasecmp(new_value->val, "on", sizeof("on"))) {
|
||||
int_value = 1;
|
||||
} else {
|
||||
int_value = zend_atoi(new_value->val, new_value->len);
|
||||
}
|
||||
|
||||
int_value = zend_atoi(new_value, new_value_length);
|
||||
ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0);
|
||||
|
||||
if (ini_value && *ini_value && int_value) {
|
||||
|
@ -886,14 +892,15 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression)
|
|||
return FAILURE;
|
||||
}
|
||||
if (stage == PHP_INI_STAGE_RUNTIME) {
|
||||
status = php_output_get_status(TSRMLS_C);
|
||||
int status = php_output_get_status(TSRMLS_C);
|
||||
if (status & PHP_OUTPUT_SENT) {
|
||||
php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "Cannot change zlib.output_compression - headers already sent");
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
status = OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
p = (zend_long *) (base+(size_t) mh_arg1);
|
||||
*p = int_value;
|
||||
|
||||
ZLIBG(output_compression) = ZLIBG(output_compression_default);
|
||||
if (stage == PHP_INI_STAGE_RUNTIME && int_value) {
|
||||
|
@ -902,7 +909,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression)
|
|||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -914,7 +921,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_handler)
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -790,7 +790,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
|
|||
/* Disable possible output compression for images */
|
||||
if (!strncmp(ptr, "image/", sizeof("image/")-1)) {
|
||||
zend_string *key = zend_string_init("zlib.output_compression", sizeof("zlib.output_compression")-1, 0);
|
||||
zend_alter_ini_entry(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_alter_ini_entry_chars(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(key);
|
||||
}
|
||||
|
||||
|
@ -818,7 +818,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
|
|||
* portable between setups that have and don't have zlib compression
|
||||
* enabled globally. See req #44164 */
|
||||
zend_string *key = zend_string_init("zlib.output_compression", sizeof("zlib.output_compression")-1, 0);
|
||||
zend_alter_ini_entry(key,
|
||||
zend_alter_ini_entry_chars(key,
|
||||
"0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
|
||||
zend_string_release(key);
|
||||
} else if (!STRCASECMP(header_line, "Location")) {
|
||||
|
|
|
@ -94,24 +94,24 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir)
|
|||
|
||||
if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN || stage == PHP_INI_STAGE_ACTIVATE || stage == PHP_INI_STAGE_DEACTIVATE) {
|
||||
/* We're in a PHP_INI_SYSTEM context, no restrictions */
|
||||
*p = new_value;
|
||||
*p = new_value ? new_value->val : NULL;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* Otherwise we're in runtime */
|
||||
if (!*p || !**p) {
|
||||
/* open_basedir not set yet, go ahead and give it a value */
|
||||
*p = new_value;
|
||||
*p = new_value->val;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* Shortcut: When we have a open_basedir and someone tries to unset, we know it'll fail */
|
||||
if (!new_value || !*new_value) {
|
||||
if (!new_value || !*new_value->val) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* Is the proposed open_basedir at least as restrictive as the current setting? */
|
||||
ptr = pathbuf = estrdup(new_value);
|
||||
ptr = pathbuf = estrdup(new_value->val);
|
||||
while (ptr && *ptr) {
|
||||
end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
|
||||
if (end != NULL) {
|
||||
|
@ -128,7 +128,7 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir)
|
|||
efree(pathbuf);
|
||||
|
||||
/* Everything checks out, set it */
|
||||
*p = new_value;
|
||||
*p = new_value->val;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
|
56
main/main.c
56
main/main.c
|
@ -163,7 +163,7 @@ static PHP_INI_MH(OnSetPrecision)
|
|||
{
|
||||
zend_long i;
|
||||
|
||||
ZEND_ATOL(i, new_value);
|
||||
ZEND_ATOL(i, new_value->val);
|
||||
if (i >= 0) {
|
||||
EG(precision) = i;
|
||||
return SUCCESS;
|
||||
|
@ -178,7 +178,7 @@ static PHP_INI_MH(OnSetPrecision)
|
|||
static PHP_INI_MH(OnChangeMemoryLimit)
|
||||
{
|
||||
if (new_value) {
|
||||
PG(memory_limit) = zend_atol(new_value, new_value_length);
|
||||
PG(memory_limit) = zend_atol(new_value->val, new_value->len);
|
||||
} else {
|
||||
PG(memory_limit) = 1<<30; /* effectively, no limit */
|
||||
}
|
||||
|
@ -319,11 +319,11 @@ static PHP_INI_MH(OnUpdateTimeout)
|
|||
{
|
||||
if (stage==PHP_INI_STAGE_STARTUP) {
|
||||
/* Don't set a timeout on startup, only per-request */
|
||||
ZEND_ATOL(EG(timeout_seconds), new_value);
|
||||
ZEND_ATOL(EG(timeout_seconds), new_value->val);
|
||||
return SUCCESS;
|
||||
}
|
||||
zend_unset_timeout(TSRMLS_C);
|
||||
ZEND_ATOL(EG(timeout_seconds), new_value);
|
||||
ZEND_ATOL(EG(timeout_seconds), new_value->val);
|
||||
zend_set_timeout(EG(timeout_seconds), 0);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ static int php_get_display_errors_mode(char *value, int value_length)
|
|||
*/
|
||||
static PHP_INI_MH(OnUpdateDisplayErrors)
|
||||
{
|
||||
PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value, new_value_length);
|
||||
PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value->val, new_value->len);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -379,11 +379,11 @@ static PHP_INI_DISP(display_errors_mode)
|
|||
TSRMLS_FETCH();
|
||||
|
||||
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
|
||||
tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );
|
||||
tmp_value_length = ini_entry->orig_value_length;
|
||||
tmp_value = (ini_entry->orig_value ? ini_entry->orig_value->val : NULL );
|
||||
tmp_value_length = ini_entry->orig_value->len;
|
||||
} else if (ini_entry->value) {
|
||||
tmp_value = ini_entry->value;
|
||||
tmp_value_length = ini_entry->value_length;
|
||||
tmp_value = ini_entry->value->val;
|
||||
tmp_value_length = ini_entry->value->len;
|
||||
} else {
|
||||
tmp_value = NULL;
|
||||
tmp_value_length = 0;
|
||||
|
@ -423,9 +423,10 @@ static PHP_INI_DISP(display_errors_mode)
|
|||
static PHP_INI_MH(OnUpdateInternalEncoding)
|
||||
{
|
||||
if (new_value) {
|
||||
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
} else {
|
||||
OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
zend_string *val = zend_string_init(SG(default_charset), strlen(SG(default_charset)), stage != ZEND_INI_STAGE_RUNTIME);
|
||||
OnUpdateString(entry, val, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -436,9 +437,10 @@ static PHP_INI_MH(OnUpdateInternalEncoding)
|
|||
static PHP_INI_MH(OnUpdateInputEncoding)
|
||||
{
|
||||
if (new_value) {
|
||||
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
} else {
|
||||
OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
zend_string *val = zend_string_init(SG(default_charset), strlen(SG(default_charset)), stage != ZEND_INI_STAGE_RUNTIME);
|
||||
OnUpdateString(entry, val, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -449,9 +451,10 @@ static PHP_INI_MH(OnUpdateInputEncoding)
|
|||
static PHP_INI_MH(OnUpdateOutputEncoding)
|
||||
{
|
||||
if (new_value) {
|
||||
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
} else {
|
||||
OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
zend_string *val = zend_string_init(SG(default_charset), strlen(SG(default_charset)), stage != ZEND_INI_STAGE_RUNTIME);
|
||||
OnUpdateString(entry, val, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -462,12 +465,12 @@ static PHP_INI_MH(OnUpdateOutputEncoding)
|
|||
static PHP_INI_MH(OnUpdateErrorLog)
|
||||
{
|
||||
/* Only do the safemode/open_basedir check at runtime */
|
||||
if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && strcmp(new_value, "syslog")) {
|
||||
if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {
|
||||
if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && strcmp(new_value->val, "syslog")) {
|
||||
if (PG(open_basedir) && php_check_open_basedir(new_value->val TSRMLS_CC)) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -478,11 +481,11 @@ static PHP_INI_MH(OnUpdateMailLog)
|
|||
{
|
||||
/* Only do the safemode/open_basedir check at runtime */
|
||||
if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value) {
|
||||
if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {
|
||||
if (PG(open_basedir) && php_check_open_basedir(new_value->val TSRMLS_CC)) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -1341,7 +1344,7 @@ PHP_FUNCTION(set_time_limit)
|
|||
new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, ZEND_LONG_FMT, new_timeout);
|
||||
|
||||
key = zend_string_init("max_execution_time", sizeof("max_execution_time")-1, 0);
|
||||
if (zend_alter_ini_entry_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) {
|
||||
if (zend_alter_ini_entry_chars_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) {
|
||||
RETVAL_TRUE;
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
|
@ -1439,16 +1442,9 @@ static char *php_resolve_path_for_zend(const char *filename, int filename_len TS
|
|||
|
||||
/* {{{ php_get_configuration_directive_for_zend
|
||||
*/
|
||||
static int php_get_configuration_directive_for_zend(const char *name, uint name_length, zval *contents)
|
||||
static zval *php_get_configuration_directive_for_zend(zend_string *name)
|
||||
{
|
||||
zval *retval = cfg_get_entry(name, name_length);
|
||||
|
||||
if (retval) {
|
||||
*contents = *retval;
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
}
|
||||
return cfg_get_entry_ex(name);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -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("<tr>");
|
||||
PUTS("<td class=\"e\">");
|
||||
PHPWRITE(ini_entry->name, ini_entry->name_length);
|
||||
PHPWRITE(ini_entry->name->val, ini_entry->name->len);
|
||||
PUTS("</td><td class=\"v\">");
|
||||
php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE TSRMLS_CC);
|
||||
PUTS("</td><td class=\"v\">");
|
||||
php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG TSRMLS_CC);
|
||||
PUTS("</td></tr>\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)
|
||||
|
|
|
@ -28,6 +28,7 @@ PHPAPI void config_zval_dtor(zval *zvalue);
|
|||
int php_init_config(TSRMLS_D);
|
||||
int php_shutdown_config(void);
|
||||
void php_ini_register_extensions(TSRMLS_D);
|
||||
PHPAPI zval *cfg_get_entry_ex(zend_string *name);
|
||||
PHPAPI zval *cfg_get_entry(const char *name, uint name_length);
|
||||
PHPAPI int cfg_get_long(const char *varname, zend_long *result);
|
||||
PHPAPI int cfg_get_double(const char *varname, double *result);
|
||||
|
|
|
@ -26,22 +26,21 @@ static char **limit_extensions = NULL;
|
|||
static int fpm_php_zend_ini_alter_master(char *name, int name_length, char *new_value, int new_value_length, int mode, int stage TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
char *duplicate;
|
||||
zend_string *duplicate;
|
||||
|
||||
if ((ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length))) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
duplicate = strdup(new_value);
|
||||
duplicate = zend_string_init(new_value, new_value_length, 1);
|
||||
|
||||
if (!ini_entry->on_modify
|
||||
|| ini_entry->on_modify(ini_entry, duplicate, new_value_length,
|
||||
|| ini_entry->on_modify(ini_entry, duplicate,
|
||||
ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC) == SUCCESS) {
|
||||
ini_entry->value = duplicate;
|
||||
ini_entry->value_length = new_value_length;
|
||||
ini_entry->modifiable = mode;
|
||||
} else {
|
||||
free(duplicate);
|
||||
zend_string_release(duplicate);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
@ -92,7 +91,7 @@ int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode) /* {{{ */
|
|||
return Z_TYPE(zv) == IS_TRUE;
|
||||
}
|
||||
|
||||
if (fpm_php_zend_ini_alter_master(name, name_len+1, value, value_len, mode, PHP_INI_STAGE_ACTIVATE TSRMLS_CC) == FAILURE) {
|
||||
if (fpm_php_zend_ini_alter_master(name, name_len, value, value_len, mode, PHP_INI_STAGE_ACTIVATE TSRMLS_CC) == FAILURE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue