Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
\Drupal\Core\Datetime\DateFormatter::formatInterval()
triggers deprecations in PHP because $interval is not always an integer.
Steps to reproduce
See tests in #3220021: [meta] Ensure compatibility of Drupal 9 with PHP 8.1 (as it evolves)
Proposed resolution
Fix in callers so we can add a typehint of int later.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#8 | 3236798-8.patch | 3.08 KB | alexpott |
#8 | 5-8-interdiff.txt | 704 bytes | alexpott |
#3 | 3236798-3.patch | 1.26 KB | alexpott |
#3 | 2-3-interdiff.txt | 590 bytes | alexpott |
#2 | 3236798-2.patch | 704 bytes | alexpott |
Comments
Comment #2
alexpottLet's see where this breaks...
Comment #3
alexpottComment #4
larowlanShouldn't there error say 'is not an integer' rather than string
Comment #5
alexpottSome more fixes...
@larowlan this exception is here just to prove that eventually core is only putting an integer into this method - once we've done that this code will be removed and we'll rely on the PHP 8.1 deprecation.
Comment #7
larowlan👍
Comment #8
alexpottRemoving the exception. I wonder if we should trigger our own deprecation so code being run on PHP < 8.1 gets a deprecation. Not sure.
Comment #9
daffie CreditAttribution: daffie commented@alexpott: Are you sure that you got all instances? Could you add a combination patch with the patch from comment #3 and comment #8? In that way we can see if we missed some.
All the changes is the patch look good to me.
Comment #10
alexpott@daffie the combination patch is #5 - see the interdiff on #8.
Comment #11
daffie CreditAttribution: daffie commentedLooks good to me.
Comment #13
catchI think we can leave this for when contrib tests are run against PHP 8.1 (probably a bit after 9.3.0 releases as long as we get through everything).
Committed 8e56a52 and pushed to 9.3.x. Thanks!