Date type custom field with default value

General discussion of Mantis.

Moderators: Contributor, Developer

Date type custom field with default value

Postby shanthini.g » Aug 22, 2017 6:20 am

Hi

We created a date type custom field in which we left the default value as empty. But while accessing report issues page we got error as ''Invalid argument supplied for foreach()' in 'C:\xampp\htdocs\Bugtracker\core\date_api.php' line 25

Our Mantis version is 2.3.1

Please refer below screen shots and suggest

Thanks
Attachments
report-issues-page.png
Report issues page
report-issues-page.png (122.85 KiB) Viewed 1016 times
custom-field-creation-page.png
Custom field creation pag
custom-field-creation-page.png (80.75 KiB) Viewed 1016 times
shanthini.g
 
Posts: 16
Joined: May 31, 2017 7:45 am

Re: Date type custom field with default value

Postby atrol » Aug 22, 2017 6:43 am

I assume this bug causes your issue https://www.mantisbt.org/bugs/view.php?id=22663
It's fixed starting with version 2.3.2.

Adding this single line should fix it
https://github.com/mantisbt/mantisbt/co ... 26bd3799b6
but I recommend to upgrade to latest stable version (2.5.1. at the moment) as there are quite a lot of fixes (especially security related) since 2.3.1.
Please use Search before posting and read the Manual
Use Mantis2Go to try MantisBT on Windows or to reproduce issues
atrol
Site Admin
 
Posts: 6603
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Date type custom field with default value

Postby shanthini.g » Aug 22, 2017 8:10 am

Yes, Fixed. Thanks
shanthini.g
 
Posts: 16
Joined: May 31, 2017 7:45 am

Re: Date type custom field with default value

Postby shanthini.g » Aug 23, 2017 12:55 am

Hi atrol

When we try to save the issue below error appears. We have attached the screen shot for the same. Could you please suggest

SYSTEM WARNING

'date() expects parameter 2 to be long, string given' in 'C:\xampp\htdocs\Bugtracker\core\cfdefs\cfdef_standard.php' line 215
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

Thanks
Attachments
mantis-error.jpg
mantis-error.jpg (160.37 KiB) Viewed 989 times
Last edited by shanthini.g on Aug 23, 2017 7:46 am, edited 1 time in total.
shanthini.g
 
Posts: 16
Joined: May 31, 2017 7:45 am

Re: Date type custom field with default value

Postby atrol » Aug 23, 2017 1:19 am

shanthini.g wrote:When we try to save the issue below error appears.
Is this related to "Date type custom field with default value"?
Please use Search before posting and read the Manual
Use Mantis2Go to try MantisBT on Windows or to reproduce issues
atrol
Site Admin
 
Posts: 6603
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Date type custom field with default value

Postby shanthini.g » Aug 23, 2017 7:45 am

Hi,

Sorry I attached a wrong screen shot.

I have removed old one and attached the correct one. Could you please refer

Thanks
shanthini.g
 
Posts: 16
Joined: May 31, 2017 7:45 am

Re: Date type custom field with default value

Postby atrol » Aug 23, 2017 1:27 pm

Did you upgrade to 2.5.1?
Please use Search before posting and read the Manual
Use Mantis2Go to try MantisBT on Windows or to reproduce issues
atrol
Site Admin
 
Posts: 6603
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Date type custom field with default value

Postby shanthini.g » Aug 23, 2017 11:52 pm

Our Mantis version is 2.3.1. We will do the upgrade and get back if we still face the issue.

Thanks for your support
shanthini.g
 
Posts: 16
Joined: May 31, 2017 7:45 am

Re: Date type custom field with default value

Postby shanthini.g » Sep 06, 2017 4:12 am

Hi

We upgraded mantis to 2.5.1

Still we are facing the issue if we submit an issue with out selecting the date field

Please refer below screen shots

Screen shot of submitting an issue - https://www.sierratec.com/demo/screensh ... issues.png
Screen shot of Mantis error that we got - https://www.sierratec.com/demo/screensh ... -error.png

Thanks
shanthini.g
 
Posts: 16
Joined: May 31, 2017 7:45 am

Re: Date type custom field with default value

Postby atrol » Sep 08, 2017 1:50 am

I am note able to reproduce the issue.

- Do you get any errors or warnings when running admin/check/index.php?
- Could you provide a screen shot of the "Raised on" field definition?
- Did you change any source of Mantis?
- Did you install any 3rd party plugins?
- Which PHP version do you use?
- Which database version do you use?
Please use Search before posting and read the Manual
Use Mantis2Go to try MantisBT on Windows or to reproduce issues
atrol
Site Admin
 
Posts: 6603
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Date type custom field with default value

Postby shanthini.g » Sep 14, 2017 7:28 am

shanthini.g
 
Posts: 16
Joined: May 31, 2017 7:45 am

Re: Date type custom field with default value

Postby atrol » Sep 14, 2017 9:28 am

Please no linked attachments.

You have set default value of the date field to string NULL.
String NULL is not a valid date, so you should remove it.

Except the below suggested one we have not edited the source
https://github.com/mantisbt/mantisbt/co ... 26bd3799b6

You don't have to change the code any longer if you updated to 2.5.1.
Please use Search before posting and read the Manual
Use Mantis2Go to try MantisBT on Windows or to reproduce issues
atrol
Site Admin
 
Posts: 6603
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Date type custom field with default value

Postby shanthini.g » Sep 15, 2017 4:24 am

Thanks for your support

This is working fine while posting new issues as well as editing/updating the newly posted issues after doing as you suggested

But if we edit/update the old issues (that is the issues that we created long before even before mantis upgrade) an issue occurs as 'date() expects parameter 2 to be long, string given'

We checked 'mantis_custom_field_string_table' both has the same value. Could you please refer below screen shots and suggest.

date() expects parameter 2 to be long, string given - Error screen shot - https://www.sierratec.com/demo/screensh ... 092017.png
mantis_custom_field_string_table - screen shot - https://www.sierratec.com/demo/screensh ... 092017.png

Thanks
shanthini.g
 
Posts: 16
Joined: May 31, 2017 7:45 am

Re: Date type custom field with default value

Postby atrol » Sep 15, 2017 1:30 pm

shanthini.g wrote:Could you please refer below screen shots and suggest.

atrol wrote:Please no linked attachments


Additional, debugging information is needed:

1. temporarily configure your system as follows:

Code: Select all
$g_display_errors = array(
    E_WARNING => 'halt',
    E_NOTICE => 'halt',
    E_USER_ERROR => 'halt',
    E_USER_WARNING => 'halt',
    E_USER_NOTICE => 'halt'
);
$g_show_detailed_errors = ON;



WARNING - SECURITY RISK: the 'show_detailed_errors' config can cause MantisBT to display sensitive information about your system. We recommend to restrict its activation to a Test environment, only for as long as necessary. If possible, do not turn it ON globally, instead limit it for specific user(s) using the Manage Configuration page.

2. Reproduce the error

If the output does not help you resolving the issue and you need further assistance,

3. save the output of the error screen, preferably as a single HTML page (not a screenshot !)
4. be careful to remove/mask any confidential information if needed
5. upload the results here
Please use Search before posting and read the Manual
Use Mantis2Go to try MantisBT on Windows or to reproduce issues
atrol
Site Admin
 
Posts: 6603
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Date type custom field with default value

Postby shanthini.g » Sep 19, 2017 6:56 am

Hi

Please find below details. As my limit to upload images exceeds, I posted the screen shot as link, sorry...

SYSTEM WARNING

'date() expects parameter 2 to be long, string given' in 'C:\xampp\htdocs\Bugtracker\core\cfdefs\cfdef_standard.php' line 290
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

Full path: C:\xampp\htdocs\Bugtracker\core\cfdefs\cfdef_standard.php
Line: 290
Variable Value Type
p_value NULL string

Filename Line Function Args
C:\xampp\htdocs\Bugtracker\core\cfdefs\cfdef_standard.php 290 - - date ( <string>'Y-m-d', <string>'NULL' )
- - - - cfdef_prepare_date_value_for_email ( <string>'NULL' )
C:\xampp\htdocs\Bugtracker\core\custom_field_api.php 1476 - - call_user_func ( <string>'cfdef_prepare_date_value_for_email', <string>'NULL' )
C:\xampp\htdocs\Bugtracker\core\history_api.php 674 - - string_custom_field_value_for_email ( <string>'NULL', <string>'8' )
C:\xampp\htdocs\Bugtracker\core\history_api.php 152 - - history_localize_item ( <string>'Raised on', <string>'0', <string>'NULL', <string>'' )
C:\xampp\htdocs\Bugtracker\history_inc.php 63 - - history_get_events_array ( <integer>49725 )
C:\xampp\htdocs\Bugtracker\bug_view_inc.php 775 - - include ( <string>'C:\\xampp\\htdocs\\Bugtracker\\history_inc.php' )
C:\xampp\htdocs\Bugtracker\view.php 37 - - include ( <string>'C:\\xampp\\htdocs\\Bugtracker\\bug_view_inc.php' )
shanthini.g
 
Posts: 16
Joined: May 31, 2017 7:45 am

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 14 guests