Opened 10 months ago
Closed 3 months ago
#60629 closed defect (bug) (fixed)
PHP Fatal error: Uncaught TypeError: gmdate(): Argument #2 ($timestamp) must be of type ?int, string given in wp-admin/includes/dashboard.php:1025
Reported by: | vanhoucke | Owned by: | hellofromTonya |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | 6.4.3 |
Component: | Date/Time | Keywords: | php80 has-patch commit |
Focuses: | php-compatibility | Cc: |
Description
Bug Report
Description
Describe the bug.
Environment
- WordPress: 6.4.3
- PHP: 8.3.3-1+ubuntu22.04.1+deb.sury.org+1
- Server: Apache/2.4.52 (Ubuntu)
- Database: mysqli (Server: 8.0.36-0ubuntu0.22.04.1 / Client: mysqlnd 8.3.3-1+ubuntu22.04.1+deb.sury.org+1)
- Browser: Chrome 121.0.0.0 (Windows 10/11)
- Theme: tfm4wp 23.05.1
- MU-Plugins:
- wp-hide-loader.php
- Plugins:
- Advanced Cron Manager 2.5.2
- Cron Logger 1.2.1
- ct4gg 1.5.1
- Customer Tools For WordPress 1.1.0
- Cycles For WordPress 24.02.1
- Duplicator 1.5.8.1
- Loco Translate 2.6.6
- Query Monitor 3.15.0
- Solid Security Basique 9.3.1
- stats4wp 1.4.9
- Theme Check 20231220
- WordPress Beta Tester 3.5.5
- WP Hide & Security Enhancer 2.3.1
Steps to Reproduce
- Change Php 7.4 to php 8.3
- login to admin dashboard
- 🐞 Bug occurs.
At login to dashboard
Expected Results
- ✅ What should happen.
Actual Results
- ❌ What actually happened.
[24-Feb-2024 15:34:00 UTC] PHP Fatal error: Uncaught TypeError: gmdate(): Argument #2 ($timestamp) must be of type ?int, string given in /var/www/vhost/dev-wordpress/wp-admin/includes/dashboard.php:1025
Stack trace:
#0 /var/www/vhost/dev-wordpress/wp-admin/includes/dashboard.php(1025): gmdate()
#1 /var/www/vhost/dev-wordpress/wp-admin/includes/dashboard.php(948): wp_dashboard_recent_posts()
#2 /var/www/vhost/dev-wordpress/wp-admin/includes/template.php(1456): wp_dashboard_site_activity()
#3 /var/www/vhost/dev-wordpress/wp-admin/includes/dashboard.php(271): do_meta_boxes()
#4 /var/www/vhost/dev-wordpress/wp-admin/index.php(204): wp_dashboard()
#5 {main}
thrown in /var/www/vhost/dev-wordpress/wp-admin/includes/dashboard.php on line 1025
Change History (6)
#2
@
5 months ago
- Milestone changed from Awaiting Review to 6.7
- Owner set to hellofromTonya
- Status changed from new to assigned
Related: #56358, #57035, #58986.
Each of these tickets is dealing with the same issue, which I summarized in [57035#comment:39]:
I'm thinking this area needs a deeper contextual dive as well as consideration and testing to raise confidence of no side effects or regressions being introduced. It'll also need more test coverage (happy and unhappy paths).
The challenges:
- robust solution to handle all timezones include partial hour timezones.
The
gmt_offset
can be a float/double for partial-hour timezones such as +5:30 UTC for India and Sri Lanka.
- review of what values
gmt_offset
should and could have.- and cross-version compatibility for the PHP versions WP supports.
I'm also curious of how this is solved in other projects.
Pulling it into 6.7 and self-assigning with intent to help shepherd the effort for these tickets.
#4
@
4 months ago
I've created a PR for this and the related tickets to cast the gmt offset throughout the code base. I'm happy to hear suggestions for alternative approaches too.
#5
@
3 months ago
- Keywords has-patch commit added
PR 7233 is ready for commit. Spoke with @peterwilsoncc who will do the commit.
Copying my approval in the PR:
[As I previously noted](https://github.com/WordPress/wordpress-develop/pull/7233#issuecomment-2327431927), this baby step resolves the immediate issue and uses the existing pattern committed in https://core.trac.wordpress.org/changeset/58923.
Ideally these changes would have full test coverage. That said, in talking with @peterwilsoncc, he shared:
The tests are there for current features and the upgrade tests should catch anything in the ugrade routine
Getting this committed early enough gives a longer soak time to hopefully uncover any issues.
I think this is ready enough for commit ✅
Appears related to the following.