Date type custom field with default value

General discussion of Mantis.

Moderators: Developer, Contributor

atrol
Site Admin
Posts: 7958
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Date type custom field with default value

Post by atrol »

The problem occurs as there are still ´NULL´ strings in mantis_history_table.
Please use Search before posting and read the Manual
shanthini.g
Posts: 42
Joined: 31 May 2017, 12:45

Re: Date type custom field with default value

Post by shanthini.g »

Thanks this is resolved. :)
mos
Posts: 2
Joined: 12 Feb 2021, 15:23

Re: Date type custom field with default value

Post by mos »

I know this is an old thread, but I'm faced with a similar issue after updating to the latest version.
We have a custom date field which is somehow causing us trouble now, which worked in the past.
the date field is empty by default and is optional.

Code: Select all

date(): Argument #2 ($timestamp) must be of type ?int, string given
C:\inetpub\wwwroot\mantisbt-2.24.4\core\date_api.php: 241: - - - - date( <string>'Y-m-d', <string>'' )
C:\inetpub\wwwroot\mantisbt-2.24.4\core\cfdefs\cfdef_standard.php: 500: - - - - print_date_selection_set( <string>'custom_field_12', <string>'Y-m-d', <string>'', <boolean>false, <boolean>true, <integer>0, <integer>0, <string>'input-sm', <string>'' )
C:\inetpub\wwwroot\mantisbt-2.24.4\core\custom_field_api.php: 1429: - - - - cfdef_input_date( <array> { ['id'] => '12', ['name'] => 'Start of Development/Fixing', ['type'] => '8', ['possible_values'] => '', ['default_value'] => '', ['valid_regexp'] => '', ['access_level_r'] => '55', ['access_level_rw'] => '55', ['length_min'] => '0', ['length_max'] => '0', ['require_report'] => '0', ['require_update'] => '0', ['display_report'] => '0', ['display_update'] => '1', ['require_resolved'] => '0', ['display_resolved'] => '0', ['display_closed'] => '0', ['require_closed'] => '0', ['filter_by'] => '1', ['linked_projects'] => <array> { [0] => 1, [1] => 2, [2] => 3, [3] => 4, [4] => 5, [5] => 6, [6] => 7, [7] => 8, [8] => 12, [9] => 15, [10] => 19, [11] => 32, [12] => 42 } }, <string>'', <string>'' )
C:\inetpub\wwwroot\mantisbt-2.24.4\bug_update_page.php: 713: - - - - print_custom_field_input( <array> { ['id'] => '12', ['name'] => 'Start of Development/Fixing', ['type'] => '8', ['possible_values'] => '', ['default_value'] => '', ['valid_regexp'] => '', ['access_level_r'] => '55', ['access_level_rw'] => '55', ['length_min'] => '0', ['length_max'] => '0', ['require_report'] => '0', ['require_update'] => '0', ['display_report'] => '0', ['display_update'] => '1', ['require_resolved'] => '0', ['display_resolved'] => '0', ['display_closed'] => '0', ['require_closed'] => '0', ['filter_by'] => '1', ['linked_projects'] => <array> { [0] => 1, [1] => 2, [2] => 3, [3] => 4, [4] => 5, [5] => 6, [6] => 7, [7] => 8, [8] => 12, [9] => 15, [10] => 19, [11] => 32, [12] => 42 } }, <integer>6014, <string>'0' )

Any help would be appreciated
jmsoupeaux
Posts: 4
Joined: 26 Feb 2021, 13:59

Re: Date type custom field with default value

Post by jmsoupeaux »

Bonjour,
je viens de faire un upgrade de la version 1.2.15 vers une version 2.24.4 et j'ai le même plantage.
je crée une fiche la mise à jour se fait bien et lorsque je passe en modification je ne change rien, à la validation j'ai le message suivant :

date(): Argument #2 ($timestamp) must be of type ?int, string given
C:\inetpub\wwwroot\mantisbtprod-new\core\date_api.php: 242: - - - - date()
C:\inetpub\wwwroot\mantisbtprod-new\core\cfdefs\cfdef_standard.php: 500: - - - - print_date_selection_set()
C:\inetpub\wwwroot\mantisbtprod-new\core\custom_field_api.php: 1429: - - - - cfdef_input_date()
C:\inetpub\wwwroot\mantisbtprod-new\bug_update_page.php: 713: - - - - print_custom_field_input()

config :
PHP 8.0.2
Mantisbt 2.24.4
MySQL 8.0.22
cas
Posts: 1069
Joined: 11 Mar 2006, 16:08
Contact:

Re: Date type custom field with default value

Post by cas »

Upgrade tp 2.24.5 , there they fixed in an issue with date custom fields :mrgreen:
atrol
Site Admin
Posts: 7958
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Date type custom field with default value

Post by atrol »

jmsoupeaux wrote: 05 Mar 2021, 18:07 PHP 8.0.2
Using PHP 7.x should also fix the issue and maybe even some more PHP 8 related issues.
Please use Search before posting and read the Manual
mos
Posts: 2
Joined: 12 Feb 2021, 15:23

Re: Date type custom field with default value

Post by mos »

I figured it out, the old database had empty entries for the custom date for each issue.
I simply removed the empty values and the issue was gone.
jmsoupeaux
Posts: 4
Joined: 26 Feb 2021, 13:59

Re: Date type custom field with default value

Post by jmsoupeaux »

Thank you for your help.

I have resolved my problem in post https://www.mantisbt.org/forums/viewtop ... 593#p71593
Post Reply