Subject: | [PATCH] silense "uninitialized value" warning in Constraint.pm |
Originally reported at https://bugzilla.redhat.com/show_bug.cgi?id=755903
Make the noise stop in FormFu::Constraint
Description of problem:
"Use of uninitialized value in string eq at
/usr/share/perl5/vendor_perl/HTML/FormFu/Constraint.pm line 107."
Version-Release number of selected component (if applicable):
0.09003-2.fc16
How reproducible:
Certain input data causes the warning to be generated
Actual results:
"Use of uninitialized value in string eq at
/usr/share/perl5/vendor_perl/HTML/FormFu/Constraint.pm line 107."
printed to terminal
Expected results:
Glorious silence
Additional info:
Scalar::Util's reftype can return undef. There is no sanity check before
using in a string eq, hence terminal spam.
The attached trivial patch silences the warning.
Subject: | 0001-Silence-use-of-uninitialized-value-warning.patch |
From 5055d6664d94a825d2f27f208cc135964b7fe3df Mon Sep 17 00:00:00 2001
From: Iain Arnell <iarnell@gmail.com>
Date: Tue, 22 Nov 2011 12:47:01 +0100
Subject: [PATCH] Silence "use of uninitialized value" warning
---
lib/HTML/FormFu/Constraint.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/HTML/FormFu/Constraint.pm b/lib/HTML/FormFu/Constraint.pm
index b9a2b71..62564c9 100644
--- a/lib/HTML/FormFu/Constraint.pm
+++ b/lib/HTML/FormFu/Constraint.pm
@@ -104,7 +104,7 @@ sub _find_field_value {
croak 'did not find ourself - how can this happen?'
if !defined $index;
- if ( reftype($value) eq 'ARRAY' ) {
+ if ( (reftype($value) || '') eq 'ARRAY' ) {
$value = $value->[$index];
}
elsif ( $index == 0 ) {
--
1.7.7.3