checkdate error, int expected string provided

Created on 14 October 2024, 3 months ago

Problem/Motivation

php date returns a string also for numeric formats. Checkdate returns an error because of this.

Steps to reproduce

- Generate a new code while providing from/to dates
- Php error is returned on php 8.3

Proposed resolution

Will provide patch/MR

Remaining tasks

Provide patch

User interface changes

API changes

None

Data model changes

None

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands jb044 Leeuwarden

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jb044
  • @jb044 opened merge request.
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    I would like so see something more than a cast here. That form element was inherited from Drupal 7 and not updated for Drupal 8+, and the way it is handling dates is not what we do in Drupal these days.

    For example, a default value of an array, and parsing the string with strtotime(), which isn't necessary because the front-end date picker delivers a fixed format. So the description of what to enter is wrong too.

    I would like to update these '#type' => 'date' form elements, and add a test case to make sure that values can be entered in this form and submitted without an error. There is a test case that will be put in as part of πŸ› Symfony\Component\Routing\Exception\RouteNotFoundException Active which just verifies that the form page can be accessed, but that should be modified to fill out the form and submit it as well. For all the tabs.

    Can you work on this?

  • πŸ‡³πŸ‡±Netherlands jb044 Leeuwarden

    I'm a bit uncertain what test case(s) to add since a html5 date form element does not seem to accept an invalid date. Also I found yet another flaw that since then appears to have been fixed already: both regcode_create_number and regcode_create_case need to be typecasted as integer and boolean for the code to work. You could argue that "create number" should be a number then for it to not be passed as a string, but I don't think that would be very user friendly. That is I dislike html5 toggle up/down elements :)

    Please let me know if this still needs work with test cases.

    Also a bit offtopic but still relevant: for 2.0.0 the patches are piling up, when can we expect another stable point release?

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    As far as the test, what I had in mind is to modify RegcodeSettingsTest to add a new test case which does drupalGet('admin/config/people/regcode/settings') then sets values for all the fields, then does submitForm(). Nothing more than that - that would have been enough to detect this issue that you reported because the test would have failed with the error you reported.

    Also I found yet another flaw that since then appears to have been fixed already: both regcode_create_number and regcode_create_case need to be typecasted as integer and boolean for the code to work.

    Yes, I did some general work trying to fix typing problems. I would really like to get these form settings into configuration, so that the entered values can be remembered and used as the defaults - I find it annoying that every time I go to this form I have to enter all the values and make all the selections over again because it doesn't remember my previous entries.

    I think the only outstanding issues I wanted to get in before the next release are πŸ› Symfony\Component\Routing\Exception\RouteNotFoundException Active and ✨ Display all users which used the current regcode. Needs review , in addition to this current issue.

  • πŸ‡³πŸ‡±Netherlands jb044 Leeuwarden
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Very nice. Thank you! Merged.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024