First load call to ip2location_get_records() triggers php notice if cookie does not exist yet

Created on 15 February 2023, almost 2 years ago

Problem/Motivation

ip2location_get_records() expects the cookie to exist, so passes the result of the cookie to json_decode. Passing null to json_decode is deprecated and cookie load can result in null. So before the cookie exists the php deprecation is fired.

Steps to reproduce

Use php 8.1 and load the page for the first time in incognito.

Proposed resolution

Check that $session is not null first before json_decoding it

Remaining tasks

Patch

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom scott_euser

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024