View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011166 | mantisbt | administration | public | 2009-11-12 06:13 | 2012-12-28 17:11 |
Reporter | chrisnik | Assigned To | dhx | ||
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.0rc2 | ||||
Target Version | 1.2.1 | Fixed in Version | 1.2.1 | ||
Summary | 0011166: new configuration option of 'complex' type is created with string type | ||||
Description | When you try to set configuration option of 'complex' type, the option is created with string type | ||||
Steps To Reproduce |
(see Picture 1)
(See Picture 2) | ||||
Tags | No tags attached. | ||||
Attached Files | adm_config_set.php.diff (1,454 bytes)
--- adm_config_set.php Tue Mar 2 10:44:32 2010 +++ adm_config_set_new.php Tue Mar 2 10:30:46 2010 @@ -101,18 +101,21 @@ if ( $t_type === 'string' ) { # 3. associative arrays with the form: array( a=>1, b=>2, c=>3, d=>4 ) $t_full_string = trim( $f_value ); if ( preg_match('/array[\s]*\((.*)\)/', $t_full_string, $t_match ) === 1 ) { - // we have an array here - $t_values = explode( ',', trim( $t_match[1] ) ); - foreach ( $t_values as $key => $value ) { - $t_split = explode( '=>', $value, 2 ); - if ( count( $t_split ) == 2 ) { - // associative array - $t_new_key = constant_replace( trim( $t_split[0] ) ); - $t_new_value = constant_replace( trim( $t_split[1] ) ); - $t_value[ $t_new_key ] = $t_new_value; - } else { - // regular array - $t_value[ $key ] = constant_replace( trim( $value ) ); + @eval('$t_value='.$t_full_string); + if (!$t_value) { + // we have an array here + $t_values = explode( ',', trim( $t_match[1] ) ); + foreach ( $t_values as $key => $value ) { + $t_split = explode( '=>', $value, 2 ); + if ( count( $t_split ) == 2 ) { + // associative array + $t_new_key = constant_replace( trim( $t_split[0] ) ); + $t_new_value = constant_replace( trim( $t_split[1] ) ); + $t_value[ $t_new_key ] = $t_new_value; + } else { + // regular array + $t_value[ $key ] = constant_replace( trim( $value ) ); + } } } } else { | ||||
extracted the pictures from the pdf files, adding them as images so they can be previewed within the ticket |
|
Having the same problem in version 1.1.7 right now. |
|
I can confirm this in 1.1.8 as well. |
|
You can't use line breaks when specifying the "value" AFAIK. The array has to be defined on a single line for things to work. This is something I consider high on the list of bugs to fix for 1.2.x Thanks for the bug report. |
|
Hi! I've posted a patch that illustrates the use of eval to try to convert the string into an actual array. PHP automatically adds detects unquoted strings and converts them to actual strings and so accepts input in various formats so can accept something like this: The use of eval may have security implications, but as the Manage Configuration page is used only by the administrator (i.e. Mantis has a privilege-check to ensure other users don't access the page), the possibility for an attack is minimal. |
|
BTW, would a check like the following be appropriate for determining if the user has entered an array, instead of using a regex check? $var1check = trim($t_full_string); |
|
this issue is making a nightmare my upgrade from 1.1.1 to 1.2.0. do you have any idea (more than the workaround) when will be fixed ? regards Francisco |
|
at least to manage the columns you have not to use this dialog, there is another page since 1.2 which also does the job: [ Manage Columns ] |
|
Hi! Ok now I can change simple arrays (with no line breaks). But how can I change arrays with two dimensions like status_enum_workflow? Thanks |
|
@atrol: You are right, but this option exists if I'm not wrong on for each user on [Manage Account], only drawback need to ask each user to do this change in every project. |
|
@fman: There is [ Managage ] -> [ Manage Configuration ] -> [ Manage Columns ] which can be used to set defaults for all users |
|
@atrol: Thanks, with this I solve part of my problems => column config, but as pointed by wodghor other persist. regards |
|
I just finished fixing a lot of the problems with setting complex array types. You'll see these fixes in v1.2.1 :) Current bugs:
|
|
MantisBT: master 4dd383f5 2010-04-22 22:40 Details Diff |
Fix 0011166: Complex types could not be entered with newline chars When setting complex configuration values via Manage Configuration => Configuration Report, newline characters weren't parsed correctly. This meant that users had to enter complex array types on a single line. This patch resolves the issue by stripping newline characters from any complex type entered. It also applies a few other fixes to the parsing of complex array types. Bugs do remain and this complex array parsing is still very limited. The current problems are: * An inability to parse multidimensional arrays * Array keys and values cannot contain commas or "=>" |
Affected Issues 0011166 |
|
mod - adm_config_set.php | Diff File | ||
MantisBT: master-1.2.x 7f68bdba 2010-04-22 22:40 Details Diff |
Fix 0011166: Complex types could not be entered with newline chars When setting complex configuration values via Manage Configuration => Configuration Report, newline characters weren't parsed correctly. This meant that users had to enter complex array types on a single line. This patch resolves the issue by stripping newline characters from any complex type entered. It also applies a few other fixes to the parsing of complex array types. Bugs do remain and this complex array parsing is still very limited. The current problems are: * An inability to parse multidimensional arrays * Array keys and values cannot contain commas or "=>" |
Affected Issues 0011166 |
|
mod - adm_config_set.php | Diff File |