PHP 8.1 Deprecated function: round(): Passing null to parameter #1 ($num) of type int|float is deprecated

Created on 19 July 2022, almost 2 years ago
Updated 16 March 2023, over 1 year ago

Problem/Motivation

When applying the "Mask" or "Watermark" effect with PHP 8.1 the following warning message is displayed:

Mask error:

Deprecated function: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->validateArguments() (line 37 of core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php).
Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->validateArguments(Array) (Line: 171)
Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array) (Line: 124)
Drupal\Core\ImageToolkit\ImageToolkitBase->apply('resize', Array) (Line: 142)
Drupal\Core\Image\Image->apply('resize', Array) (Line: 33)
Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\Mask->execute(Array) (Line: 172)
Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array) (Line: 124)
Drupal\Core\ImageToolkit\ImageToolkitBase->apply('mask', Array) (Line: 142)
Drupal\Core\Image\Image->apply('mask', Array) (Line: 224)
Drupal\image_effects\Plugin\ImageEffect\MaskImageEffect->applyEffect(Object) (Line: 329)
Drupal\image\Entity\ImageStyle->createDerivative('core/modules/image/sample.png', 'public://styles/texto_destacado/public/core/modules/image/sample.png') (Line: 58)
template_preprocess_image_style_preview(Array, 'image_style_preview', Array)
...

Watermark error:

Deprecated function: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->validateArguments() (line 37 of core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php).
Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->validateArguments(Array) (Line: 171)
Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array) (Line: 124)
Drupal\Core\ImageToolkit\ImageToolkitBase->apply('resize', Array) (Line: 142)
Drupal\Core\Image\Image->apply('resize', Array) (Line: 32)
Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\Watermark->execute(Array) (Line: 172)
Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array) (Line: 124)
Drupal\Core\ImageToolkit\ImageToolkitBase->apply('watermark', Array) (Line: 142)
Drupal\Core\Image\Image->apply('watermark', Array) (Line: 237)
Drupal\image_effects\Plugin\ImageEffect\WatermarkImageEffect->applyEffect(Object) (Line: 329)
Drupal\image\Entity\ImageStyle->createDerivative('core/modules/image/sample.png', 'public://styles/texto_destacado/public/core/modules/image/sample.png') (Line: 58)
template_preprocess_image_style_preview(Array, 'image_style_preview', Array)
...

Steps to reproduce

Add a "Mask" or "Watermark" effect to an image style.

Proposed resolution

Looking for suggestions on the best way to solve this problem.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡΅πŸ‡ΉPortugal lolgm

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