Francois Gouget : testbot/cgi: Fix handling of '0' in text fields.

Alexandre Julliard julliard at winehq.org
Tue Mar 29 15:04:23 CDT 2022


Module: tools
Branch: master
Commit: 0044e4eda7fdbc8fdba23f341d8a79b7a5b12535
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=0044e4eda7fdbc8fdba23f341d8a79b7a5b12535

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Mar 29 17:57:39 2022 +0200

testbot/cgi: Fix handling of '0' in text fields.

'0' should be set as the field's initial value even though it evaluates
to false.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/lib/ObjectModel/CGI/FormPage.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm
index 83b078b..f47d628 100644
--- a/testbot/lib/ObjectModel/CGI/FormPage.pm
+++ b/testbot/lib/ObjectModel/CGI/FormPage.pm
@@ -300,7 +300,7 @@ sub GenerateField($$$)
         print "50' rows='", int(($MaxLength + 49) / 50);
       }
       print "'>";
-      if ($Value)
+      if (defined $Value)
       {
         print $self->CGI->escapeHTML($Value), "'";
       }
@@ -313,7 +313,7 @@ sub GenerateField($$$)
       $Size=45 if ($Size > 45);
       print "<input type='$InputType' name='", $PropertyDescriptor->GetName(),
             "' maxlength='", $PropertyDescriptor->GetMaxLength(), "' size='$Size'";
-      if ($Value && $InputType ne "password")
+      if (defined $Value && $InputType ne "password")
       {
         print " value='", $self->CGI->escapeHTML($Value), "'";
       }




More information about the wine-cvs mailing list