https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22429

--- Comment #6 from David Cook <[email protected]> ---
Aha... it's the parentheses which are the problem. They're being interpreted as
regex metacharacters and not literal values! 


First line: '12345678 123456 (Test) Test'
First string width: 299.775390625
First $1: ' Test'
First $trim: ''

Next line: '12345678 123456 (Test)'
Next string width: 249.94140625
Next $1: ' (Test)'
Next $trim: ' (Test) Test'

Next line: '12345678 123456 (Test)'
Next string width: 249.94140625
Next $1: ' (Test)'
Next $trim: ' (Test) (Test) Test'

And the $trim just keeps prepending (Test) over and over again. 

--

Fortunately, this is a very easy solve.

I change the following
$line =~ s/$1//;

to

$line =~ s/\Q$1\E//;

And voila. It works. 

I bet this sort of "regular expression injection" could bite us in other parts
of Koha...

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to