From: <gi...@ma...> - 2010-04-23 02:51:03
|
The branch, master-1.2.x has been updated via 7f68bdbae2f992a9cdb8f3d6de4e319c74f7c2fe (commit) from 04ab0f4f815572709f80337d2b70a1e2a940b8fa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7f68bdbae2f992a9cdb8f3d6de4e319c74f7c2fe Author: David Hicks <hic...@op...> Date: Fri Apr 23 12:40:36 2010 +1000 Fix #11166: 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 "=>" ----------------------------------------------------------------------- Summary of changes: adm_config_set.php | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) ----------------------------------------------------------------------- commit 7f68bdbae2f992a9cdb8f3d6de4e319c74f7c2fe Author: David Hicks <hic...@op...> Date: Fri Apr 23 12:40:36 2010 +1000 Fix #11166: 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 "=>" diff --git a/adm_config_set.php b/adm_config_set.php index 28e9a76..e84a823 100644 --- a/adm_config_set.php +++ b/adm_config_set.php @@ -82,20 +82,24 @@ # 1. constant values (like the ON/OFF switches): they are defined as constants mapping to numeric values # 2. simple arrays with the form: array( a, b, c, d ) # 3. associative arrays with the form: array( a=>1, b=>2, c=>3, d=>4 ) + # TODO: allow multi-dimensional arrays, allow commas and => within strings $t_full_string = trim( $f_value ); - if ( preg_match('/array[\s]*\((.*)\)/', $t_full_string, $t_match ) === 1 ) { + if ( preg_match('/array[\s]*\((.*)\)/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 ) { + if ( !trim( $value ) ) { + continue; + } $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_new_key = constant_replace( trim( $t_split[0], " \t\n\r\0\x0B\"'" ) ); + $t_new_value = constant_replace( trim( $t_split[1], " \t\n\r\0\x0B\"'" ) ); $t_value[ $t_new_key ] = $t_new_value; } else { // regular array - $t_value[ $key ] = constant_replace( trim( $value ) ); + $t_value[ $key ] = constant_replace( trim( $value, " \t\n\r\0\x0B\"'" ) ); } } } else { ----------------------------------------------------------------------- -- Mantis Bug Tracker |