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

Created on 15 February 2023, over 1 year 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

Needs review

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

Comments & Activities

Production build 0.69.0 2024