View Issue Details

IDProjectCategoryView StatusLast Update
0014650mantisbtcode cleanuppublic2014-09-23 18:05
Reporterdregad Assigned Todregad  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version1.2.12 
Target Version1.2.12Fixed in Version1.2.12 
Summary0014650: Improve comments for check custom field length in custom_field_delete_all_values()
Description

This function checks for truncated custom field's name.

This dates back to the time when the history table's field_name column was only 32 chars long, whereas the custom field's size is 64.

Even though the history's field_name size has been increased to 64 since
1.1.0a4 (see issue 0008002), the check must be maintained to ensure
compatibility with upgraded legacy systems.

However the comments in the code are a bit misleading as they refer to obsolete db schema.

TagsNo tags attached.

Relationships

related to 0008002 closedgrangeway Unable to report issue. Error "data too long" on custom field name 
related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 
related to 0016433 new History should store custom fields as ID not name 

Activities

dregad

dregad

2012-08-26 08:03

developer   ~0032668

I'm having second thoughts about this.

Considering that it's such a corner case (only applicable for initial Mantis deployment prior to 1.1.0 having custom fields with names longer than 32 chars), maybe it would be a better approach to get rid of this special case check and provide instead a short script to update the legacy systems' database (replacing the truncated custom field names references in history table by their full name using the same logic in the check).

dregad

dregad

2012-09-01 09:52

developer   ~0032757

Following my previous note, I revised the install/upgrade script in master branch accordingly, and removed the obsolete code.

Since schema changes are not possible in 1.2.x branch, the code will remain the same, with improved comments.

grangeway

grangeway

2013-04-05 17:56

reporter   ~0036180

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master ce3450aa

2012-08-31 03:17

dregad


Details Diff
Add upgrade step to replace truncated custom field names in history

Function custom_field_get_id_from_name() contained code to check for
truncated custom fields names. This dates back to when the history
table's field_name column was only 32 chars long, whereas the custom
field's size is 64.

The history's field_name size has been increased to 64 since 1.1.0a4
(see issue 0008002), so the check has been removed from the code and
replaced by an upgrade step (calling new install helper function
install_update_history_long_custom_fields(), which converts legacy
history entries storing truncated custom field names by their expanded
full name.

Fixes 0014650
Affected Issues
0008002, 0014650
mod - admin/schema.php Diff File
mod - core/custom_field_api.php Diff File
mod - core/history_api.php Diff File
mod - core/install_helper_functions_api.php Diff File

MantisBT: master-1.2.x b5abce1f

2012-08-31 03:37

dregad


Details Diff
Improve comments for custom field length check

Function custom_field_get_id_from_name() contains code to check for
truncated custom fields names. This dates back to when the history
table's field_name column was only 32 chars long, whereas the custom
field's size is 64.

Even though the history's field_name size has been increased to 64 since
1.1.0a4 (see issue 0008002), the check must be maintained to ensure
compatibility with upgraded legacy systems.

The fix ce3450aaabbd9d9feceb03d77d4358f195e7d966 implemented in master
branch cannot be applied here as it contains a schema update. Instead,
comments have been reworded and obsolete reference to old schema
removed.

Fixes 0014650
Affected Issues
0008002, 0014650
mod - core/custom_field_api.php Diff File
mod - core/history_api.php Diff File