Deprecate image_filter_keyword()

Created on 5 October 2014, about 10 years ago
Updated 4 October 2024, about 2 months ago

Problem/Motivation

In preparing another issue, I ran into the non OO function image_filter_keyword() in image.module.

Besides, image_filter_keyword() can return float despite its doc says

 * @return int|string
 *   The offset from the anchor, in pixels, or the anchor itself, if its value
 *   isn't one of the accepted values.

This causes deprecations in PHP 8.1 if the returned value is used in GD functions that expect ints instead.

Proposed resolution

This patch:

  • Moves the function image_filter_keyword() to a static method in \Drupal\Component\Utility\Image.
  • Adds test coverage for it.

Remaining tasks

User interface changes

None.

API changes

image_filter_keyword() deprecated
new \Drupal\Component\Utility\Image::getKeywordOffset() method

📌 Task
Status

Needs review

Version

11.0 🔥

Component

image.module

Created by

🇫🇷France fietserwin Le Mont-Dore

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

    The issue particularly affects sites running on PHP version 8.1.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.71.5 2024