[Rt-devel] RT 3.6.5 RT::SearchBuilder bug report and patch

Jesse Vincent jesse at bestpractical.com
Tue Nov 6 14:25:05 EST 2007




On Tue, Nov 06, 2007 at 01:55:29PM -0500, Stephen Turner wrote:
> Hello,
> 
> In tracking down an apparent difference between RT 3.4 and 3.6, I've 
> found what appears to be a bug, or at least an inconsistency in 3.6. 
> It's causing several of my perl scripts that use the RT API to fail.
> 
> The difference between 3.4 & 3.6 is that in 3.6, objects have to have 
> CurrentUser actually be a RT::CurrentUser object. 3.4 allowed 
> CurrentUser to be a RT::User or RT:CurrentUser.


It's actually something we tightened up. In RT 3.4, the loose behaviour
caused a lot of subtle bugs further down the chain.

> 
> The inconsistency (in 3.6) is that collection objects behave 
> differently from single-row objects:

That's not good.
> 
> I'd like to suggest a patch to RT/SearchBuilder.pm that will do the 
> right thing if you supply an RT::User object to "new" on a 
> collection. The patch is based on RT 3.6.5. (This patch also has the 
> effect of making the error message correct. Well, except for "obejct"! ).


That seems reasonable, but will break RT 3.7 as RT::CurrentUser now ISA
RT::User. Ruz, thoughts?

> Steve
> 
> 
> --- SearchBuilder.pm.base       2007-11-06 13:40:03.000000000 -0500
> +++ SearchBuilder.pm    2007-11-06 13:39:20.000000000 -0500
> @@ -80,7 +80,7 @@
>      my $self = shift;
> 
>      $self->{'user'} = shift;
> -    unless(defined($self->CurrentUser)) {
> +    unless(defined($self->CurrentUser( $self->{'user'} ))) {
>         use Carp;
>         Carp::confess("$self was created without a CurrentUser");
>         $RT::Logger->err("$self was created without a CurrentUser");
> 
> 
> 
> 
> Stephen Turner
> Senior Programmer/Analyst - Client Support Services
> MIT Information Services and Technology (IS&T)
> 
> 
> _______________________________________________
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
> 
> SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:
> 
> If you sign up for a new RT support contract before December 31, we'll take
> up to 20 percent off the price. This sale won't last long, so get in touch 
> today. Email us at sales at bestpractical.com or call us at +1 617 812 0745.
> 

-- 


More information about the Rt-devel mailing list