bugsnag / bugsnag-php

BugSnag error monitoring and crash reporting tool for PHP apps
https://docs.bugsnag.com/platforms/php
MIT License
554 stars 77 forks source link

Swap use of deprecated `strftime` to `date` #640

Closed imjoehaines closed 2 years ago

imjoehaines commented 2 years ago

Goal

PHP 8.1 deprecated strftime, which we were using to get the current minute for counting sessions. This is easily replaced with the date function: https://3v4l.org/GkoF3

var_dump(strftime('%Y-%m-%dT%H:%M:00')); // => 2022-02-03T10:49:00
var_dump(date('Y-m-d\TH:i:00')); // => 2022-02-03T10:49:00

This should have caused unit tests to fail, but didn't. This is because the SessionTrackerTest runs after the HandlerTest, which registers error handlers that affect PHPUnit's reporting of the deprecation. This will be fixed in a separate PR