MantisBT - mantisbt
View Issue Details
0011631mantisbtcustom fieldspublic2010-03-08 18:432010-06-09 03:45
RyanLind 
dhx 
normalcrashalways
closedduplicate 
1.2.0 
 
0011631: Custom Fields with special characters in the name cause SQL errors on sort.
If I create a custom field with a character in it such as "(" or "#" and I added it as a column to my view issues, sorting on this column causes a crash:

Database query failed. Error received from database was 0001051: Unknown table 'mantis_bug_table' for the query: SELECT DISTINCT mantis_bug_table.*, mantis_bug_table.last_updated ...

I then go to Manage custom fields and rename it (Eg test # -> test number) and it works fine. I can sort on it and everything.

I've seen some similar issues related to sorting on custom fields, but none quite the same as this.
1) Create a custom field with a # sign (e.g. "Test #")
2) Add this custom field to your view issues columns in "my account"->"manage columns"
3) Go to "View Issues"
4) Try to sort on "test #"
The offending code is in filter_api.php on line 2,018 (as of 1.2.0):

----PHP------
$t_result = db_query_bound( "$t_select_string $t_from_string $t_join_string $t_where_string $t_order_string", $t_query_clauses['where_values'], $p_per_page, $t_offset );
---END PHP---

The above causes the SQL error.
No tags attached.
duplicate of 0010901resolved dhx We can't use & in custom field value and it's impossible search the first and last value from custom list 
related to 0011634closed dhx using special characters on Custom Field name generates issue when trying to order by this CF 
Issue History
2010-03-08 18:43RyanLindNew Issue
2010-03-08 18:44RyanLindIssue Monitored: RyanLind
2010-03-09 04:29atrolRelationship addedrelated to 0011634
2010-03-12 08:36dhxRelationship addedduplicate of 0010901
2010-03-12 08:36dhxStatusnew => resolved
2010-03-12 08:36dhxResolutionopen => duplicate
2010-03-12 08:36dhxAssigned To => dhx
2010-06-09 03:45dhxStatusresolved => closed

There are no notes attached to this issue.