Bug 22941

Summary: Giving malformed sortfield to list results in Internal Server Error
Product: Koha Reporter: paxed <pasi.kallinen>
Component: ListsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, katrin.fischer, lucas, m.de.rooy, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23084
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17526
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.01
Attachments: Bug 22941: Do not return 500 if sortfield contain parenthesis
Bug 22941: Do not return 500 if sortfield contain parenthesis
Bug 22941: Do not return 500 if sortfield contain parenthesis

Description paxed 2019-05-20 06:34:05 UTC
Giving sortfield a malformed value when viewing lists results in Internal Server Error.
    
eg. virtualshelves/shelves.pl?op=view&shelfnumber=619&sortfield=author(

Note the trailing (
Comment 1 Jonathan Druart 2019-06-08 19:47:09 UTC
Created attachment 90441 [details] [review]
Bug 22941: Do not return 500 if sortfield contain parenthesis

Test plan:
Hit /virtualshelves/shelves.pl?op=view&shelfnumber=1&sortfield=author(

You must not get:
Unmatched ( in regex; marked by <-- HERE in m/^author( <-- HERE $/ at /home/vagrant/kohaclone/virtualshelves/shelves.pl line 236
Comment 2 Mark Tompsett 2019-06-13 19:17:20 UTC
Created attachment 90583 [details] [review]
Bug 22941: Do not return 500 if sortfield contain parenthesis

Test plan (on staff client of kohadevbox after making a list):
http://localhost:8081/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=1&sortfield=title(&direction=desc

You must not get:
Unmatched ( in regex; marked by <-- HERE in m/^author( <-- HERE $/ at /home/vagrant/kohaclone/virtualshelves/shelves.pl line 236

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 3 Martin Renvoize 2019-06-14 11:01:38 UTC
Created attachment 90590 [details] [review]
Bug 22941: Do not return 500 if sortfield contain parenthesis

Test plan:
Hit /virtualshelves/shelves.pl?op=view&shelfnumber=1&sortfield=author(

You must not get:
Unmatched ( in regex; marked by <-- HERE in m/^author( <-- HERE $/ at /home/vagrant/kohaclone/virtualshelves/shelves.pl line 236

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2019-06-14 11:02:04 UTC
Works as expected, no QA script failures.. Passing QA
Comment 5 Martin Renvoize 2019-06-15 07:02:55 UTC
Nice work!

Pushed to master for 19.11.00
Comment 6 Fridolin Somers 2019-06-20 12:27:22 UTC
Pushed to 19.05.x for 19.05.01
Comment 7 Lucas Gass 2019-06-26 16:40:31 UTC
backported to 18.11.x for 18.11.07