Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ PHP NEWS
passing an array of CURLFile or CURLStringFile objects to
CURLOPT_POSTFIELDS. (Sjoerd Langkemper)

- Date:
. Improved performance of strtotime() with "now". (Alexander Danilov)

- FPM:
. Use recommended TYPE, HELP order for OpenMetrics metadata.
(Marcel Hernandez)
Expand Down
3 changes: 3 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ PHP 8.7 UPGRADE NOTES
. Improved performance of integer to string conversion (string casts, echo,
implode(), json_encode(), serialize(), var_export() and others).

- Date:
. Improved performance of strtotime() with "now".

- DOM:
. Parsing HTML with Dom\HTMLDocument or innerHTML uses much less memory for
small inputs.
Expand Down
4 changes: 4 additions & 0 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,10 @@ PHP_FUNCTION(strtotime)
return;
}

if (zend_string_equals_literal(times, "now")) {
RETURN_LONG(!preset_ts_is_null ? preset_ts : php_time());
}

now = timelib_time_ctor();
now->tz_info = tzi;
now->zone_type = TIMELIB_ZONETYPE_ID;
Expand Down
2 changes: 2 additions & 0 deletions ext/date/tests/strtotime.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $d[] = strtotime("2005-07-14 22:30:41");
$d[] = strtotime("2005-07-14 22:30:41 GMT");
$d[] = strtotime("@1121373041");
$d[] = strtotime("@1121373041 CEST");
$d[] = strtotime("now", 1121373041);

foreach($d as $date) {
echo date(DATE_ISO8601, $date), "\n";
Expand All @@ -18,3 +19,4 @@ foreach($d as $date) {
2005-07-15T00:30:41+0200
2005-07-14T22:30:41+0200
2005-07-14T22:30:41+0200
2005-07-14T22:30:41+0200
Loading