Skip Menu |

This queue is for tickets about the Data-FormValidator CPAN distribution.

Maintainer(s)' notes

This is the bug queue for Data::FormValidator.

Report information
The Basics
Id: 30221
Status: resolved
Priority: 0/
Queue: Data-FormValidator

People
Owner: MARKSTOS [...] cpan.org
Requestors: c.a.vincent [...] ncl.ac.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 4.55
Fixed in: (no value)



Subject: Length validation regular expressions and multi-line values
I'm using Data::FormValidator to validate some input from a textarea in a web form. I'm performing a basic length check on the input, just to make sure I can feedback something useful if the content is too big for my database column using Data::FormValidator::Constraints::FV_max_length It works fine - until I put a carriage return into the text area, at which point it fails to validate. I'm running a modified version which adds the s modifier to the regular expressions so the input is treated as a single line and the line breaks ignored: For FV_max_length: m/^(.{0,$max}$)/s I could knock up a patch and test for the module but I thought I'd check there wasn't a reason for it being like this... Carl
Subject: Re: [rt.cpan.org #30221] Length validation regular expressions and multi-line values
Date: Tue, 23 Oct 2007 11:38:58 -0400
To: bug-Data-FormValidator [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
On Tuesday 23 October 2007 11:06, via RT wrote: Show quoted text
> > I'm using Data::FormValidator to validate some input from a textarea > in a web form. > > I'm performing a basic length check on the input, just to make sure I > can feedback something useful if the content is too big for my > database column using Data::FormValidator::Constraints::FV_max_length > > It works fine - until I put a carriage return into the text area, at > which point it fails to validate. > > I'm running a modified version which adds the s modifier to the > regular expressions so the input is treated as a single line and the > line breaks ignored: > > For FV_max_length: m/^(.{0,$max}$)/s > > I could knock up a patch and test for the module but I thought I'd > check there wasn't a reason for it being like this...
Carl, Your patch and test would be welcome. Thanks. Mark
Subject: RE: [rt.cpan.org #30221] Length validation regular expressions and multi-line values
Date: Fri, 26 Oct 2007 16:54:19 +0100
To: <bug-Data-FormValidator [...] rt.cpan.org>
From: "Carl Vincent" <c.a.vincent [...] newcastle.ac.uk>
Hi Mark, Show quoted text
>Your patch and test would be welcome.
I've attached a patch created against 4.55 downloaded today from CPAN. I've tried to be comprehensive with the tests. I discovered the simple fix to the regular expressions caused problems with my test cases: $ and \Z anchors in regexps seem to match "not only at the end of the string, but also one character earlier that that, if the last character happens to be a newline" (quoted from my camel book). That was a surprise for me, but I've added a couple of lines to handle that. Hope this is acceptable! Cheers Carl -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Carl Vincent http://www.netskills.ac.uk/ (URL) Systems Manager 0191 222 5003 (voice) Netskills, Newcastle University 0191 222 5001 (fax) Training - Accreditation - Consultancy - Development

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #30221] Length validation regular expressions and multi-line values
Date: Fri, 26 Oct 2007 12:29:19 -0400
To: bug-Data-FormValidator [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Thanks Carl. I suspect your patch will be fine. I'll run it by the mailing list for comment as well. Mark
Releasing fix today. Thanks for the contribution, Carl.