[wp-trac] [WordPress Trac] #64496: Type Error with gmdate() in dashboard Activity widget (was: Uncaught Error: gmdate(): Argument #2 ($timestamp) must be of type ?int, string given in wp-admin/includes/dashboard.php on line 1017)
WordPress Trac
noreply at wordpress.org
Tue Jan 13 02:28:21 UTC 2026
#64496: Type Error with gmdate() in dashboard Activity widget
-----------------------------------------+------------------------------
Reporter: vanhoucke | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 6.9
Severity: normal | Resolution:
Keywords: has-patch reporter-feedback | Focuses: ui
-----------------------------------------+------------------------------
Changes (by sabernhardt):
* keywords: php8.3 has-patch reporter-feedback => has-patch reporter-
feedback
* focuses: ui, php-compatibility => ui
Old description:
> Uncaught Error: gmdate(): Argument #2 ($timestamp) must be of type ?int,
> string given
> in wp-admin/includes/dashboard.php on line 1017
>
> Call stack:
>
> gmdate()
>
> wp-admin/includes/dashboard.php:1017
> wp_dashboard_recent_posts()
>
> wp-admin/includes/dashboard.php:940
> wp_dashboard_site_activity()
>
> wp-admin/includes/template.php:1453
> do_meta_boxes()
>
> wp-admin/includes/dashboard.php:271
> wp_dashboard()
>
> wp-admin/index.php:204
> Query Monitor
New description:
{{{
Uncaught Error: gmdate(): Argument #2 ($timestamp) must be of type ?int,
string given
in wp-admin/includes/dashboard.php on line 1017
Call stack:
gmdate()
wp-admin/includes/dashboard.php:1017
wp_dashboard_recent_posts()
wp-admin/includes/dashboard.php:940
wp_dashboard_site_activity()
wp-admin/includes/template.php:1453
do_meta_boxes()
wp-admin/includes/dashboard.php:271
wp_dashboard()
wp-admin/index.php:204
Query Monitor
}}}
--
Comment:
#60629 reported the error message earlier.
A [https://wpdirectory.net/search/01KESXCZRSGYZHHSV58ENA44W8 directory
search] lists some of the plugins that //might// filter the 'get_the_time'
information.
I removed the PHP 8.3 keyword and PHP compatibility focus.
- I did not receive errors or warnings when the filtered date was a
numeric string or boolean `false`.
- A non-numeric string resulted in a fatal error with PHP 8.0.30, and
7.4.33 gave a warning for the same.
== Testing
I added `var_dump($time);` immediately after `$time = get_the_time( 'U'
);` in `wp_dashboard_recent_posts()` to show the output type in my local
trunk installation. Also, my time zone is UTC-6, which likely explains why
the numeric string value is 6 hours different than the integer.
With no plugins, the Activity widget used integers and displayed the
relative post dates.
- `int 1768214078` Today, 10:34 am
- `int 1762863730` Nov 11th 2025, 12:22 pm
[https://wordpress.org/plugins/simple-location/ Simple Location] changed
`get_the_date` output to a numeric string, but it still gave the same post
dates.
- `string '1768235678'` Today, 10:34 am
- `string '1762885330'` Nov 11th 2025, 12:22 pm
[https://wordpress.org/plugins/hide-metadata/ Hide/Remove Metadata], set
to Hide By PHP and Hide published date, returned `false` in the filter.
Then the Activity widget showed today's date without the time, still
including the comma and space.
- `boolean false` Jan 12th 2026,
- `boolean false` Jan 12th 2026,
[https://wordpress.org/plugins/wp-last-modified-info/ WP Last Modified
Info] also can return `false` with its 'get_the_time' filter, but that
specifically does **not** run [https://plugins.trac.wordpress.org/browser
/wp-last-modified-info/tags/1.9.5/inc/Core/Backend/MiscActions.php#L164 in
the admin area].
I reproduced the fatal error by returning a string in a custom must-use
plugin.
{{{add_filter( 'get_the_time', function ( $the_time ) { return 'gotcha'; }
);}}}
- `string 'gotcha'`
{{{
( ! ) Fatal error: Uncaught TypeError: gmdate(): Argument #2 ($timestamp)
must be of type ?int, string given in ...\wp-admin\includes\dashboard.php
on line 1017
( ! ) TypeError: gmdate(): Argument #2 ($timestamp) must be of type ?int,
string given in ...\wp-admin\includes\dashboard.php on line 1017
}}}
== Correcting
Plugin filters could need to avoid changing the 'get_the_time' output when
`is_admin` or when the `$format` is `'U'`.
If Core should update the Activity widget, I think it could change the
list item `<span>` contents if the timestamp is not an integer. Casting to
an integer might work with the Simple Location plugin, but other non-
integer values are likely inappropriate (for comparison or display).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64496#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list