Skip to content

element_helper::get_date_format_string(): Argument #1 ($date) must be of type int, string given (5.2) #782

@leonstr

Description

@leonstr

Steps to reproduce issue

  1. Create a course.
  2. Enrol a student.
  3. Add a custom certificate instance.
  4. Add a date element to the certificate set to "Issued date".
  5. Log in as the student and view the certificate.

Expected results

The certificate is displayed.

Actual results

On page mod/customcert/view.php?id=10&downloadown=1:

Exception - mod_customcert\element_helper::get_date_format_string(): Argument #1 ($date) must be of type int, string given, called in [dirroot]/mod/customcert/element/date/classes/element.php on line 274

More information about this error

Debug info:
Error code: generalexceptionmessageDismiss this notification
Stack trace:
line 788 of /public/mod/customcert/classes/element_helper.php: TypeError thrown
line 274 of /public/mod/customcert/element/date/classes/element.php: call to mod_customcert\element_helper::get_date_format_string()
line 68 of /public/mod/customcert/classes/service/pdf_renderer.php: call to customcertelement_date\element->render()
line 123 of /public/mod/customcert/classes/local/preview_renderer.php: call to mod_customcert\service\pdf_renderer->render_pdf()
line 112 of /public/mod/customcert/classes/service/pdf_generation_service.php: call to mod_customcert\local\preview_renderer->render_pdf_page()
line 253 of /public/mod/customcert/view.php: call to mod_customcert\service\pdf_generation_service->generate_pdf()

Environment

Tested with Moodle 5.2dev (Build: 20260306) and mod_customcert 2025122800 (commit 0cc3c13).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions