Bug: Variable with Parameters in Form Fields Disappear
A
TWikiForms text field handles
%THISTYPE% variable OK, but not if you try
%THATTYPE{...}% with parameters:
- Preview is OK
- After save you see an empty text field
Test case
Add
%SERVERTIME{ "$day $mon $year $hou:$min" }% to any text field of a TWiki form.
Environment
| TWiki version: |
TWikiRelease01Feb2003 |
| TWiki plugins: |
N/A |
| Server OS: |
N/A |
| Web server: |
N/A |
| Perl version: |
N/A |
| Client OS: |
N/A |
| Web Browser: |
N/A |
--
PeterThoeny - 17 Jan 2004
Follow up
The bug happens because the regular expression extracting the meta data from topics does a non-greedy scan for
}%, which stops inside a text field value in case it contains a variable like in:
%META:FIELD{name="Test" title="Test" value="...<= stops here"}%
Fix record
Fix is in
TWikiAlphaRelease and TWiki.org
*** b/lib/TWiki/Meta.pm 2003-10-18 08:37:49.000000000 -0700
--- a/lib/TWiki/Meta.pm 2004-01-17 00:23:58.000000000 -0800
***************
*** 299,305 ****
my $newText = "";
foreach ( split( /\n/, $text ) ) {
! if( /^%META:([^{]+){([^}]*)}%/ ) {
my $type = $1;
my $args = $2;
my %list = _keyValue2Hash( $args );
--- 299,305 ----
my $newText = "";
foreach ( split( /\n/, $text ) ) {
! if( /^%META:([^{]+){(.*)}%$/ ) { # greedy match for ending "}%"
my $type = $1;
my $args = $2;
my %list = _keyValue2Hash( $args );
--
PeterThoeny - 17 Jan 2004