Protect against empty default_CD_modifiers in opensrf.xml
authorMike Rylander <mrylander@gmail.com>
Wed, 29 Feb 2012 17:04:54 +0000 (12:04 -0500)
committerDan Scott <dan@coffeecode.net>
Mon, 9 Apr 2012 18:57:35 +0000 (14:57 -0400)
If the app settings for the open-ils.search service in opensrf.xml had
an empty (but not entirely missing) <default_CD_modifiers> element, then
the open-ils.storage log would contain entries like the following:

Use of uninitialized value $class in hash element at
/usr/local/share/perl5/OpenILS/Application/Storage/QueryParser.pm

Protect against that problem with more defensive code in QueryParser.pm.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Dan Scott <dan@coffeecode.net>

Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm

index eb2602a..22b50f8 100644 (file)
@@ -2846,8 +2846,11 @@ sub query_parser_fts {
     my $default_CD_modifiers = OpenSRF::Utils::SettingsClient->new->config_value(
         apps => 'open-ils.search' => app_settings => 'default_CD_modifiers'
     );
-    $args{query} = "$default_CD_modifiers $args{query}" if ($default_CD_modifiers);
 
+    # Protect against empty / missing default_CD_modifiers setting
+    if ($default_CD_modifiers and !ref($default_CD_modifiers)) {
+        $args{query} = "$default_CD_modifiers $args{query}";
+    }
 
     my $simple_plan = $args{_simple_plan};
     # remove bad chunks of the %args hash