[Rt-commit] rt branch, 4.4/do-not-declare-var-in-modifier-statements, created. rt-4.4.4-105-g49ae6ce096

? sunnavy sunnavy at bestpractical.com
Mon Jun 1 11:54:48 EDT 2020


The branch, 4.4/do-not-declare-var-in-modifier-statements has been created
        at  49ae6ce096cb70fc6b043505ed4981e6b508fb34 (commit)

- Log -----------------------------------------------------------------
commit 49ae6ce096cb70fc6b043505ed4981e6b508fb34
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Jun 1 23:39:50 2020 +0800

    Don't declare varaibles in modifier statements
    
    The behavior is not defined according to perlsyn:
    
    NOTE: The behaviour of a my, state, or our modified with a statement
    modifier conditional or loop construct (for example, my $x if ... ) is
    undefined. The value of the my variable may be undef, any previously
    assigned value, or possibly anything else. Don't rely on it. Future
    versions of perl might do something different from the version of perl
    you try it out on. Here be dragons.

diff --git a/lib/RT/CustomRole.pm b/lib/RT/CustomRole.pm
index 5d1bfb3d60..8bac86d3d5 100644
--- a/lib/RT/CustomRole.pm
+++ b/lib/RT/CustomRole.pm
@@ -411,7 +411,8 @@ sub AddToObject {
         unless $queue->CurrentUserHasRight('AdminCustomRoles');
     my $rec = RT::ObjectCustomRole->new( $self->CurrentUser );
     my ( $status, $add ) = $rec->Add( %args, CustomRole => $self );
-    my $msg = $self->loc("[_1] added to queue [_2]", $self->Name, $queue->Name) if $status;
+    my $msg;
+    $msg = $self->loc("[_1] added to queue [_2]", $self->Name, $queue->Name) if $status;
 
     return ( $add, $msg );
 }
@@ -450,7 +451,8 @@ sub RemoveFromObject {
     $rec->LoadByCols( CustomRole => $self->id, ObjectId => $args{'ObjectId'} );
     return (0, $self->loc('Custom role is not added') ) unless $rec->id;
     my ( $status, $delete ) = $rec->Delete;
-    my $msg = $self->loc("[_1] removed from queue [_2]", $self->Name, $queue->Name) if $status;
+    my $msg;
+    $msg = $self->loc("[_1] removed from queue [_2]", $self->Name, $queue->Name) if $status;
 
     return ( $delete, $msg );
 }
diff --git a/share/html/Dashboards/Queries.html b/share/html/Dashboards/Queries.html
index c7c6b240d1..9e7689b1fe 100644
--- a/share/html/Dashboards/Queries.html
+++ b/share/html/Dashboards/Queries.html
@@ -214,7 +214,8 @@ for my $pane (sort keys %pane_name) {
             for (@{ $self->{Current} }) {
                 my $item = $_;
                 my $desc = $desc_of{$item};
-                my $portlet_type = $1 if $item =~ s/^(\w+)-//;
+                my $portlet_type;
+                $portlet_type = $1 if $item =~ s/^(\w+)-//;
 
                 if ($portlet_type eq 'search' || $portlet_type eq 'dashboard') {
                     my ($id, $privacy) = split '-', $item, 2;
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index f6233c33fa..02c7d42386 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -863,7 +863,8 @@ my $build_main_nav = sub {
 
                 if ( defined $session{"tickets"} ) {
                     # we have to update session data if we get new ItemMap
-                    my $updatesession = 1 unless ( $session{"tickets"}->{'item_map'} );
+                    my $updatesession;
+                    $updatesession = 1 unless ( $session{"tickets"}->{'item_map'} );
 
                     my $item_map = $session{"tickets"}->ItemMap;
 

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


More information about the rt-commit mailing list