View Issue Details

IDProjectCategoryView StatusLast Update
0020082mantisbtcustom fieldspublic2015-12-06 02:45
ReportervboctorAssigned Tovboctor 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.3.0-beta.3 
Target Version1.3.0-rc.1Fixed in Version1.3.0-rc.1 
Summary0020082: Invalid query error when updating an issue

In some cases a field would exist on the form but the value would evaluate to null. In such case, an invalid query is issue attempting to set the value of the custom field to null which is not allowed.

The fix would be to make sure that when we convert from value of the custom field to the database value we convert null to string. Before we used to skip these and hence didn't get the error, but that caused the issue with purging custom field values after setting them.

function custom_field_value_to_database( $p_value, $p_type ) {
global $g_custom_field_type_definition;

    $t_value = $p_value;

    if( isset( $g_custom_field_type_definition[$p_type]['#function_value_to_database'] ) ) {
            $t_value = call_user_func( $g_custom_field_type_definition[$p_type]['#function_value_to_database'], $p_value );

    return $t_value === null ? '' : $t_value;




Related Changesets

MantisBT: master 99172361

2015-09-07 14:55:39


Details Diff
Fix invalid query error when updating an issue

If a custom field is on the form but has value of null, it caused invalid query error.

Fixes 0020082
mod - core/custom_field_api.php Diff File

Issue History

Date Modified Username Field Change
2015-09-07 14:31 vboctor New Issue
2015-09-07 14:31 vboctor Status new => assigned
2015-09-07 14:31 vboctor Assigned To => vboctor
2015-09-07 14:31 vboctor Tag Attached: mantishub
2015-09-07 14:56 vboctor Note Added: 0051389
2015-09-11 11:42 vboctor Changeset attached => MantisBT master 99172361
2015-09-11 11:42 vboctor Status assigned => resolved
2015-09-11 11:42 vboctor Resolution open => fixed
2015-09-11 11:42 vboctor Fixed in Version => 1.3.0-rc.1
2015-12-06 02:45 vboctor Status resolved => closed