[Rt-commit] rt branch, 4.0/config-set-regex, created. rt-4.0.6-254-g0b4e4a9

? sunnavy sunnavy at bestpractical.com
Wed Aug 15 11:01:30 EDT 2012


The branch, 4.0/config-set-regex has been created
        at  0b4e4a9a4e69e3831489cd4f9b4b5f2fddaf7122 (commit)

- Log -----------------------------------------------------------------
commit 0b4e4a9a4e69e3831489cd4f9b4b5f2fddaf7122
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Aug 15 22:54:40 2012 +0800

    handle regex value right in config files, see also #16951
    
    before this, a variable could be set to a regex successfully only once.  now
    it could be set arbitrary times as other variables.

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index ba338bb..b217155 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1219,13 +1219,20 @@ sub SetFromConfig {
             # Otherwie 5.10 goes boom. maybe we should skip any
             # reference
             next if ref($entry) eq 'SCALAR' || ref($entry) eq 'REF';
-            my $entry_ref = *{$entry}{ ref($ref) };
+
+            my $ref_type = ref($ref);
+            if ( $ref_type eq 'REF' && ref $$ref eq 'Regexp' ) {
+                # take care of regex, which is actually stored as scalar
+                $ref_type = 'SCALAR';
+            }
+
+            my $entry_ref = *{$entry}{ $ref_type };
             next unless $entry_ref;
 
             # if references are equal then we've found
             if ( $entry_ref == $ref ) {
                 $last_pack = $pack;
-                return ( $REF_SYMBOLS{ ref($ref) } || '*' ) . $pack . $k;
+                return ( $REF_SYMBOLS{ $ref_type } || '*' ) . $pack . $k;
             }
         }
         return '';

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


More information about the Rt-commit mailing list