Closed (fixed)
Project:
Calendar Systems
Version:
4.0.2
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Nov 2023 at 16:45 UTC
Updated:
19 Jul 2026 at 13:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
amir jamshidi commentedhi. I use Drupal 10.2.3 , calendar_systems Version: 4.0.2 and webform 6.2.2 but get this error in webform add element
TypeError: function_exists(): Argument #1 ($function) must be of type string, array given in function_exists() (line 178 of /modules/contrib/calendar_systems/src/Element/CalendarSystemsDateTime.php).
I change
to
in /modules/contrib/calendar_systems/src/Element/CalendarSystemsDateTime.php line 178 and 210
Comment #3
arefen commentedThanks, Amir
your solution works for me
Comment #4
naeim commentedHi everyone,
I encountered the same error with Drupal 10.2.3, calendar_systems 4.0.2, and Webform 6.2.2:
To fix this, I modified the code to check if the callback is a string before calling `function_exists()`. Here’s the relevant snippet I used:
This prevents passing an array (or other non-string types) to function_exists(), which causes the TypeError.
I applied this check in both #date_date_callbacks and #date_time_callbacks loops. After this change, the error stopped occurring and the webform element addition works properly.
I believe this is a safer and cleaner fix than assuming the callback is an array or accessing $callback[1].
Comment #5
amir jamshidi commentedYou are right Naeim. You suggested a better way. I will turn these changes into a patch file so that everyone can use it. I hope these changes will be applied to the module in future versions.
Comment #6
doxigo commentedThis is fixed, will tag a new release soon, thanks everyone