[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.2-46-g8713a66

Alex Vandiver alexmv at bestpractical.com
Mon Nov 6 12:32:48 EST 2017


The branch, 4.4-trunk has been updated
       via  8713a66cb87097a01d51289b6b68fa0a174559a6 (commit)
       via  648a76ac2b9e3ab2a2a23b699cef6f833014b15e (commit)
      from  cb2451cfc891239a3e6a5e5a0a53b35718b3de06 (commit)

Summary of changes:
 lib/RT/ObjectCustomFieldValue.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 648a76ac2b9e3ab2a2a23b699cef6f833014b15e
Author: Fritz Zaucker <fritz.zaucker at oetiker.ch>
Date:   Wed Oct 25 15:04:25 2017 +0200

    _FillInTemplateURL(): check for empty CF
    
    The original code generates two warnings "Use of uninitialized value
    $value" for empty custom fields.

diff --git a/lib/RT/ObjectCustomFieldValue.pm b/lib/RT/ObjectCustomFieldValue.pm
index 859a870..4552aaa 100644
--- a/lib/RT/ObjectCustomFieldValue.pm
+++ b/lib/RT/ObjectCustomFieldValue.pm
@@ -48,6 +48,7 @@
 
 package RT::ObjectCustomFieldValue;
 
+use 5.010;
 use strict;
 use warnings;
 use base 'RT::Record';
@@ -343,6 +344,7 @@ sub _FillInTemplateURL {
     # special case, whole value should be an URL
     if ( $url =~ /^__CustomField__/ ) {
         my $value = $self->Content;
+        $value //= '';
         # protect from potentially malicious URLs
         if ( $value =~ /^\s*(?:javascript|data):/i ) {
             my $object = $self->Object;
@@ -359,7 +361,7 @@ sub _FillInTemplateURL {
     for my $key (keys %placeholders) {
         $url =~ s{__${key}__}{
             my $value = $placeholders{$key}{'value'}->( $self );
-            $value = '' if !defined($value);
+            $value //= '';
             RT::Interface::Web::EscapeURI(\$value) if $placeholders{$key}{'escape'};
             $value
         }gxe;

commit 8713a66cb87097a01d51289b6b68fa0a174559a6
Merge: cb2451c 648a76a
Author: Alex Vandiver <alex at chmrr.net>
Date:   Mon Nov 6 12:32:41 2017 -0500

    Merge branch '4.4/undef-cf-in-template' into 4.4-trunk


-----------------------------------------------------------------------


More information about the rt-commit mailing list