Skip to content

Commit

Permalink
add warning on f$getdate overflow (#959)
Browse files Browse the repository at this point in the history
  • Loading branch information
astrophysik authored Feb 9, 2024
1 parent dfeaf72 commit 71bdc7e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runtime/datetime/datetime_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,11 @@ array<mixed> f$getdate(int64_t timestamp) {
}
tm t;
time_t timestamp_t = timestamp;
localtime_r(&timestamp_t, &t);
tm * tp = localtime_r(&timestamp_t, &t);
if (tp == nullptr) {
php_warning("Error \"%s\" in getdate with timestamp %" PRId64, strerror(errno), timestamp);
memset(&t, 0, sizeof(tm));
}

array<mixed> result(array_size(11, false));

Expand Down

0 comments on commit 71bdc7e

Please sign in to comment.