View Issue Details

IDProjectCategoryView StatusLast Update
0010184mantisbtcustom fieldspublic2009-06-26 12:04
ReporterChi-Yu Assigned Tojreese  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.1.6 
Target Version1.1.8Fixed in Version1.1.8 
Summary0010184: APPLICATION ERROR 0001303 when optional custom date field is left blank
Description

We defined an optional custom date field "due date". When reporting a new bug, Mantis throws an "APPLICATION ERROR 0001303". The field is NOT mandatory and even after removing the field from the bug report page by unchecking the according checkbox, Mantis still says that the field "due date" contains an invalid value.

I just updated our mantis installation using nightly build "mantisbt-1.1.6-2009-03-01-master-1.1.x-f461da7.tar.gz" and this problem is still present.

So we are currently unable to submit any new bugs unless we fill in some random due date.

Steps To Reproduce
  • Create a custom date field with default settings.
  • Submit a new bug and leave the date fields emtpy.
Tagscustom fields, date

Relationships

has duplicate 0007754 closedjreese Empty Custom Date Fields 

Activities

Chi-Yu

Chi-Yu

2009-03-05 11:39

reporter   ~0021004

This seems to be related to 0009979.

jreese

jreese

2009-03-05 12:05

reporter   ~0021006

Reminder sent to: grangeway, thraxisp

Glenn, not sure if this has anything to do with what you've fixed previously, but it seems like it's related.

frc77

frc77

2009-04-14 18:26

reporter   ~0021533

I have same problem with 1.1.6 stable and same with mantisbt-1.1.6-2009-04-14-master-1.1.x-4593490.zip

thraxisp

thraxisp

2009-04-14 20:08

reporter   ~0021536

I am not seeing this in master-1.1.x HEAD. Can I mark it resolved?

ave

ave

2009-04-20 09:26

reporter   ~0021602

Last edited: 2009-04-20 09:51

Hi,

The error seems to exist in master-1.1.x HEAD (45934909ad91f08127876f69dbde381a40ae843a).

The function custom_field_validate($p_field_id, $p_value) returns false when $p_value is null and $t_type is CUSTOM_FIELD_TYPE_DATE.
For other types, though, the function returns true when $p_value is null.

--
I should have written that (1) I use PHP 5.2.1 and (2) the error is thrown at line 97 of bug_report.php.

maximini

maximini

2009-04-27 02:34

reporter   ~0021684

The problem still exists in version 1.1.7. To solve the problem I have changed in file core/custom_field_api.php the function custom_field_validate. The case CUSTOM_FIELD_TYPE_DATE has to be adapted from
$t_valid &= ( $p_value !== false ) && ( $p_value > 0 ) ;
to
$t_valid &= ( $p_value == NULL ) || ( ( $p_value !== false ) && ( $p_value > 0 ) );

iherrmann

iherrmann

2009-04-27 05:34

reporter   ~0021686

Tested the workaround provided from maximini, works. Well.. at least i can submit new issues again. ;)

Chi-Yu

Chi-Yu

2009-05-08 10:45

reporter   ~0021796

The solution suggested in 0010184:0021684 seems to work.

damien_b

damien_b

2009-05-11 05:55

reporter   ~0021802

Last edited: 2009-05-11 05:56

Thanks for sharing the fix maximini (fix applied to v1.1.7).

jreese

jreese

2009-05-11 10:21

reporter   ~0021804

I've replicated both the problem and the resolution in both 1.1.x and 1.2.x. Fix committed to master-1.1.x and master branches.

alphasupremicus

alphasupremicus

2009-05-19 10:25

reporter   ~0021839

I just upgraded to Mantis 1.1.7 from 1.1.6 in attempts to correct the inability to update custom date fields. That problem is fixed, but this problem and the fix suggested in 0010184:0021684 didn't help me with my optional custom date fields. With the code fix in place, I still get Application Error 1303 when I try to submit a new bug where I did not complete the optional due date field.

I also have the LongCF plugin installed, which may or may not be interacting with this (not sure). But I also noticed that my optional Checkbox ON/OFF field that comes as part of the LongCF package also gets the same error now if I don't check the box and put some value in this field. Of course, that defeats the purpose of a checkbox field if I always have to check it.

I am running php 5.2.6-1 on Debian Lenny with kernel 2.5.26-2 on AMD 64-bit.

For now I had to put a blanket "return true" statement as the first line in the custom_field_validate function in order to bypass all validation checking as there appears to be something more wrong with this custom field validation than just date fields (like an odd interaction with LongCF plugin that I'm not able to pin down).

bartik

bartik

2009-06-23 05:04

reporter   ~0022236

As to the LongCF not working with date validation see this http://forum.morinie.fr/mantis/read.php?6,4051 maybe it helps.

Related Changesets

MantisBT: master 205681da

2009-05-11 10:17

jreese


Details Diff
Fix 0010184: Properly validate null values for custom date fields. Affected Issues
0010184
mod - core/custom_field_api.php Diff File

MantisBT: master-1.1.x 86ea1ec7

2009-05-11 10:17

jreese


Details Diff
Fix 0010184: Properly validate null values for custom date fields. Affected Issues
0010184
mod - core/custom_field_api.php Diff File