Priority: Low
Current State: Closed
Released In: 2.1.3
Target Release: patch
Applies To: Engine
Component: FoswikiForm
Branches: Release02x01 master
In a situation when form is in construction stage and one of its fields has default value containing %SEARCH% which refers back to the same form
getFields
method would be called on an undone form object where there is no
fields
key defined yet. Though it doesn't generate a error message but this would cause dereferencing of an undef. Here is the proposed patch:
--- Form.pm.orig 2016-02-13 23:40:23.000000000 -0500
+++ Form.pm 2016-02-13 23:40:53.000000000 -0500
@@ -672,8 +672,10 @@
sub getField {
my ( $this, $name ) = @_;
- foreach my $fieldDef ( @{ $this->{fields} } ) {
- return $fieldDef if ( $fieldDef->{name} && $fieldDef->{name} eq $name );
+ if (defined $this->{fields}) {
+ foreach my $fieldDef ( @{ $this->{fields} } ) {
+ return $fieldDef if ( $fieldDef->{name} && $fieldDef->{name} eq $name );
+ }
}
return;
}
--
VadimBelman - 14 Feb 2016