[Rt-commit] rt branch, 4.2-trunk, updated. rt-4.2.13-99-g9a94881
Dustin Collins
strega at bestpractical.com
Fri Jan 6 03:36:49 EST 2017
The branch, 4.2-trunk has been updated
via 9a94881e42337c0a94bb4aef3966eec58f8877e5 (commit)
via 03a12c0a16fa524c96031dde1342e8e633017a64 (commit)
from 2ef9d3ee277df3f2b2a762b2579c2472416f1caa (commit)
Summary of changes:
lib/RT/ObjectCustomFieldValues.pm | 3 ++-
t/web/cf_textarea.t | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
- Log -----------------------------------------------------------------
commit 03a12c0a16fa524c96031dde1342e8e633017a64
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Wed Nov 16 20:20:00 2016 +0000
Add failing tests for "CF changed from 0 to 0"
for I#32440
diff --git a/t/web/cf_textarea.t b/t/web/cf_textarea.t
index d11bda4..444020e 100644
--- a/t/web/cf_textarea.t
+++ b/t/web/cf_textarea.t
@@ -27,6 +27,10 @@ my $cfs = {
type => 'FreeformSingle',
name => 'TheControlField',
},
+ zero => {
+ type => 'FreeformSingle',
+ name => 'Zero',
+ },
};
while ( my( $label, $data ) = each %$cfs ) {
@@ -55,10 +59,13 @@ $m->submit_form_ok({
$cfs->{area}{input} . '-Magic' => "1",
$cfs->{text}{input} => 'value a',
$cfs->{text}{input} . '-Magic' => "1",
+ $cfs->{zero}{input} => '0',
+ $cfs->{zero}{input} . '-Magic' => "1",
},
}, 'submitted form to initially set CFs');
$m->content_contains('<li>TheControlField value a added</li>');
$m->content_contains("<li>TheTextarea $content added</li>", 'content found');
+$m->content_contains("<li>Zero 0 added</li>", 'zero field found');
# http://issues.bestpractical.com/Ticket/Display.html?id=30378
# #30378: RT 4.2.6 - Very long text fields get updated even when they haven't changed
@@ -71,5 +78,9 @@ $m->submit_form_ok({
$m->content_contains('<li>TheControlField value a changed to value b</li>');
$m->content_lacks("<li>TheTextarea $content changed to $content</li>", 'textarea wasnt updated');
+# http://issues.bestpractical.com/Ticket/Display.html?id=32440
+# #32440: Spurious "CF changed from 0 to 0"
+$m->content_lacks("<li>Zero 0 changed to 0</li>", "Zero wasn't updated");
+
undef $m;
done_testing;
commit 9a94881e42337c0a94bb4aef3966eec58f8877e5
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Wed Nov 16 20:27:45 2016 +0000
Avoid spurious "CF changed from 0 to 0" results
Introduced in RT 4.2.9 with 724cf7f845cbdbb2e97c37d008a71ceba4f372a, a
refactoring to address a similar spurious "CF changed from long value to
long value" message (I#30378).
That commit uses the old `($a || '') eq $b` idiom to avoid undef
warnings, but when $a is the value "0", the "eq" operator produces a
false negative, as `(0 || '') eq 0` is evaluated as `'' eq 0`, but the
intent is that it should be true as `0 eq 0`. The modern // operator
avoids the undef warnings but not at the expense of treating "0" in this
broken way.
Fixes: I#32440
diff --git a/lib/RT/ObjectCustomFieldValues.pm b/lib/RT/ObjectCustomFieldValues.pm
index 8e7fe0e..4ea660c 100644
--- a/lib/RT/ObjectCustomFieldValues.pm
+++ b/lib/RT/ObjectCustomFieldValues.pm
@@ -50,6 +50,7 @@ package RT::ObjectCustomFieldValues;
use strict;
use warnings;
+use 5.010;
use base 'RT::SearchBuilder';
@@ -145,7 +146,7 @@ sub HasEntry {
return $item if lc $item->Content eq lc $args->{Content};
}
else {
- if ( ($item->_Value('Content') || '') eq $args->{Content} ) {
+ if ( ($item->_Value('Content') // '') eq $args->{Content} ) {
if ( defined $item->LargeContent ) {
return $item
if defined $args->{LargeContent}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list