Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to regenerate certificate - date() error. #814

Open
thepurpleblob opened this issue May 8, 2024 · 1 comment
Open

Unable to regenerate certificate - date() error. #814

thepurpleblob opened this issue May 8, 2024 · 1 comment

Comments

@thepurpleblob
Copy link

Exception - date(): Argument #2 ($timestamp) must be of type ?int, string given

[More information about this error](https://docs.moodle.org/404/en/error/moodle/generalexceptionmessage)

Debug info:
Error code: generalexceptionmessage×Dismiss this notification
Stack trace:
line 63 of /auth/saml2/regenerate.php: TypeError thrown
line 63 of /auth/saml2/regenerate.php: call to date()

Seems to be true the second parameter is a str_replace which returns a string not an int. Casting the str_replace with (int) seems to sort it.

@anku57
Copy link

anku57 commented Jan 9, 2025

To resolve this error, you can cast the result of the str_replace function to an integer, as suggested. This ensures that the second argument passed to the date() function is of type int, which is what it expects.

Here’s an example of how to modify the code:

$timestamp = (int) str_replace(...);
$date = date('Y-m-d', $timestamp);

By casting the result of str_replace to an integer, you’ll ensure that the date() function gets a valid timestamp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants