From 6a414548fbcc2b4768afee38a133482c396badea Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 3 Jul 2012 19:02:08 +0800 Subject: [PATCH] Bug 8349 - Attempted string substitution in C4::Breeding fails on undefined By moving the string substitution inside an existing if statement, the string substitution succeeds. And if it was null, a string substitution would leave it null. In the case that it is 0 or '0', it doesn't have whitespace, and so the substitution doesn't need to be run. Content-Type: text/plain; charset="utf-8" --- C4/Breeding.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 19bb7e2..0fbc00f 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -179,9 +179,9 @@ sub BreedingSearch { $query .= "z3950random = ?"; @bind=($z3950random); } else { - $search =~ s/(\s+)/\%/g; @bind=(); - if ($search) { + if ($search) { + $search =~ s/(\s+)/\%/g; $query .= "title like ? OR author like ?"; push(@bind,"%$search%", "%$search%"); } -- 1.7.9.5