From: Jared Camins-Esakov Date: Thu, 13 Dec 2012 15:14:52 +0000 (-0500) Subject: LP#1089468: QueryParser is not re-entrant X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3fc49c4f74f32b6b4846ba786fa1a0f1ee913149;p=working%2FEvergreen.git LP#1089468: QueryParser is not re-entrant Because the ->parse() method of QueryParser did not clear an instance's parse tree prior to parsing, any time a QP instance was reused, the user ended up with a corrupted parse tree containing bits of old queries as well as bits of the new query. Signed-off-by: Jared Camins-Esakov --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm index 7ee0402dd4..0b39cace8c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm @@ -459,6 +459,11 @@ sub parse { my $self = shift; my $pkg = ref($self) || $self; warn " ** parse package is $pkg\n" if $self->debug; + + # Without this, calling ->parse() twice on a single instance results + # in parse tree corruption + undef $self->{_parse_tree}; + $self->parse_tree( $self->decompose( $self->query( shift() )