[Rt-commit] rt branch, 4.4/update-article-postfix-loops-variable, created. rt-4.4.2-133-g7de33c08d

Maureen Mirville maureen at bestpractical.com
Wed Apr 11 10:54:22 EDT 2018


The branch, 4.4/update-article-postfix-loops-variable has been created
        at  7de33c08da6136b60026c01c2895e019308d7494 (commit)

- Log -----------------------------------------------------------------
commit 7de33c08da6136b60026c01c2895e019308d7494
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Wed Apr 11 10:29:52 2018 -0400

    Update article postfix loops from using $_ to a named variable
    
    The previous use of $_ could potentially cause other code to try to
    claim $_ resulting in unusual errors. Using a named variable rather
    will prevent any confusion.

diff --git a/share/html/Articles/Article/Elements/Preformatted b/share/html/Articles/Article/Elements/Preformatted
index 49ac0fcef..bb70538cd 100644
--- a/share/html/Articles/Article/Elements/Preformatted
+++ b/share/html/Articles/Article/Elements/Preformatted
@@ -86,8 +86,13 @@
 my $class = $Article->ClassObj;
 my %include = (Name => 1, Summary => 1);
 my $cfs = $class->ArticleCustomFields;
-$include{"CF-Title-".$_->Id} = $include{"CF-Value-".$_->Id} = 1 while $_ = $cfs->Next;
-$include{$_} = not $class->FirstAttribute("Skip-$_") for keys %include;
+while ( my $cf = $cfs->Next ) {
+    $include{"CF-Title-" . $cf->Id} = 1;
+    $include{"CF-Value-" . $cf->Id} = 1;
+}
+foreach my $key ( keys %include ) {
+    $include{$key} = not $class->FirstAttribute("Skip-$key");
+}
 
 my $get_content = sub {
     my $value = shift;

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


More information about the rt-commit mailing list