PHP notice when trying to delete a path alias that doesn't exist

Created on 18 February 2021, over 3 years ago
Updated 15 May 2023, about 1 year ago

Problem/Motivation

On PHP 7.4, when path_delete() is called for an unaliased path, the following notice is given:

Notice: Trying to access array offset on value of type bool in path_delete() (line 480 of /code/profiles/aclu_affiliates/modules/contrib/redis/redis.path.inc).

This occurs because calls in the function, including one to redis_path_backend_get()->deleteAlias(), are not conditional on the return value of path_load().

Steps to reproduce

Proposed resolution

In commit 23b14e9 in #3084980: Trying to access array offset on value of type null in path_delete() β†’ this issue was fixed in the core version of path_delete() from which the Redis module's version was originally copied.

The fix here is to sync with the corresponding code in core. For ease of comparing the two path_delete() methods in future, also bring in coding style changes from the core version.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada nedjo

Live updates comments and jobs are added and updated live.
  • PHP 7.4

    The issue particularly affects sites running on PHP version 7.4.0 or later.

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.69.0 2024