- Issue created by @chike
I noticed this issue after I updated the site to Drupal 10.5.1 and updated php on the server from 8.2 to 8.3. I have two custom roles on the site, student and tutor. I added an office_hours
field on the user account but I made the field available to only users with the tutor role. For other roles on the site, they never get to see the field when editing or viewing their profiles. This has worked until I made the last update on the site then I tried to view an admin profile and I got the error below. I logged in as a student and trying to view the profile also threw the error.
TypeError: strtotime(): Argument #2 ($baseTimestamp) must be of type ?int, string given in strtotime() (line 211 of modules/contrib/office_hours/src/OfficeHoursSeason.php). The error mentions the current file.
Later on, I discovered the issue also existed in another line,
The error now changes to, TypeError: strtotime(): Argument #2 ($baseTimestamp) must be of type ?int, string given in strtotime() (line 215 of modules/contrib/office_hours/src/OfficeHoursSeason.php).
Create two custom roles on the site, add an office_hours
field to the user account. Make the field available to one of the custom roles and not available to the other. Try viewing the profile page of a user with the other role i.e. the role that doesn't use the field. You will see this error.
I made the attached patch to address the issue by ensuring all values passed as the $baseTimestamp argument to strtotime() are integer timestamps.
This solved the issue for me.
Active
1.0
Code