Index: trunk/extensions/Arrays/RELEASE-NOTES |
— | — | @@ -3,6 +3,9 @@ |
4 | 4 | |
5 | 5 | * (trunk) -- Version 2.0rc3 alpha |
6 | 6 | - Adjusted to work with 'Regex Fun' version 1.1 |
| 7 | + - '{{#arraydefine: a |}}' will create an empty array instead of an array with an empty element as in |
| 8 | + version 1.3.2. A new option 'singleempty' can be used to avoid this behavior, ',' can be used to |
| 9 | + create an array with two empty elements. |
7 | 10 | |
8 | 11 | * December 5, 2011 -- Version 2.0rc2 |
9 | 12 | - Bug introduced in r105069 fixed where '#arrayprint' was broken in compatibility mode in some cases. |
Index: trunk/extensions/Arrays/Arrays.php |
— | — | @@ -181,8 +181,6 @@ |
182 | 182 | $array = array(); |
183 | 183 | } |
184 | 184 | else { |
185 | | - $value = trim( $value ); // just in case... |
186 | | - |
187 | 185 | // fill array with user input: |
188 | 186 | if( $delimiter === '' ) { |
189 | 187 | // whole input one element, also takes care of special case empty '' value and 'unique' option set |
— | — | @@ -211,6 +209,15 @@ |
212 | 210 | // unique like the parser function would do it |
213 | 211 | $array = self::array_unique( $array ); |
214 | 212 | } |
| 213 | + |
| 214 | + // if 'singleempty' is NOT set, {{#arraydefine:a|}} will be empty. |
| 215 | + // by default this would give an empty array (due to historical as well as usability reasons) |
| 216 | + if( ! array_key_exists( 'singleempty', $arrayOptions ) ) { |
| 217 | + // there is no other uncomplicated way than this to define a single empty elemented array currently! |
| 218 | + if( count( $array ) === 1 && $array[0] === '' ) { |
| 219 | + $array = array(); |
| 220 | + } |
| 221 | + } |
215 | 222 | |
216 | 223 | /** |
217 | 224 | * @ToDo: |