PHP 8 compatibilities

Created on 20 July 2021, about 3 years ago
Updated 20 October 2023, 11 months ago

Problem/Motivation

I'm seeing this deprecated function error when using geocoder with php 8.0.

Cases:
1.

Deprecated function: uksort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero
Drupal\geocoder\Plugin\Geocoder\Provider\Random->getRandomCountryInfo()() (Line: 71)

2. Deprecated function: Implicit conversion from float 1.679 to int loses precision in Drupal\geocoder\GeocoderThrottle->waitForAvailability() (line 47 of modules/contrib/geocoder/src/GeocoderThrottle.php).

Steps to reproduce

Run tests with php 8.0

Proposed resolution

1. Replace operator with spaceship operator (<=>) to return -1, 0, or 1 instead of a boolean.
2. use ceil() for the division result

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇺🇸United States katherined

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024