-
-
Notifications
You must be signed in to change notification settings - Fork 192
Description
A TypeError is thrown when rendering a Custom Certificate using the Date element. This occurs because the $dateformat property is null, but the helper method expects a mandatory string. This is particularly prevalent in PHP 8.x environments.
Environment
- Moodle Version: 4.5.8
- PHP Version: 8.3.6
Error Details / Stack Trace
Exception - mod_customcert\element_helper::get_date_format_string(): Argument #2 ($dateformat) must be of type string, null given, called in [dirroot]/mod/customcert/element/date/classes/element.php on line 269
Stack trace:
line 749 of /mod/customcert/classes/element_helper.php: TypeError thrown
line 269 of /mod/customcert/element/date/classes/element.php: call to mod_customcert\element_helper::get_date_format_string()
line 143 of /mod/customcert/rearrange.php: call to customcertelement_date\element->render_html()
Steps to Reproduce
- Use Moodle 4.5+ with PHP 8.3.
- Create or edit a Custom Certificate.
- Access the Rearrange elements page (rearrange.php).
- Add or view a "Date" element
- Set the date format (example used: "6 July 2026")
- Save or attempt to view the certificate
- The page fails to load with the TypeError.