[Rt-commit] rt branch, 4.4/fix-deserialize-recently-viewed-tickets, created. rt-4.4.3-61-gfb3b54b79

Craig Kaiser craig at bestpractical.com
Mon Oct 29 17:01:16 EDT 2018


The branch, 4.4/fix-deserialize-recently-viewed-tickets has been created
        at  fb3b54b7967c12b3eb7144f4425550efb42c17d6 (commit)

- Log -----------------------------------------------------------------
commit fb3b54b7967c12b3eb7144f4425550efb42c17d6
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Mon Oct 29 16:24:06 2018 -0400

    Load Content rather than Attribute object for RecentlyViewedTickets
    
    Previously, if the RecentlyViewedTickets content somehow was set
    to undef, $content still evaluated to true because it was an
    RT::Attribute object. Calling the Content method then resulted in:
    
        Can't use an undefined value as an ARRAY reference
    
    This caused a 500 error for the end-user.
    
    Loading the content provides the intended true/false value and handles
    the empty content case.

diff --git a/lib/RT/User.pm b/lib/RT/User.pm
index daae994e7..4003d3451 100644
--- a/lib/RT/User.pm
+++ b/lib/RT/User.pm
@@ -2082,8 +2082,8 @@ Returns a list of two-element (ticket id, timestamp) array references ordered by
 
 sub RecentlyViewedTickets {
     my $self = shift;
-    my $content = $self->FirstAttribute('RecentlyViewedTickets');
-    return $content ? @{$content->Content} : ();
+    my $content = $self->FirstAttribute('RecentlyViewedTickets')->Content;
+    return $content ? @{$content} : ();
 }
 
 =head2 AddRecentlyViewedTicket TICKET

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


More information about the rt-commit mailing list