From 3fc49c4f74f32b6b4846ba786fa1a0f1ee913149 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Thu, 13 Dec 2012 10:14:52 -0500 Subject: [PATCH] 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 --- Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm | 5 +++++ 1 file changed, 5 insertions(+) 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() ) -- 2.11.0