PHP 8.3 Deprecation Notice: Increment operator on non-numeric types is deprecated in paragraphs_sets module

Created on 1 July 2025, 2 months ago

PHP 8.3 Deprecation Notice: Increment operator on non-numeric types in paragraphs_sets module

Description

When using Paragraphs Sets module with PHP 8.3, a deprecation notice appears:

Deprecated function: Increment on non-alphanumeric string is deprecated in paragraphs_sets_field_widget_complete_form_alter() (line 272 of paragraphs_sets.module)

This occurs when incrementing $insert_delta which may be a non-numeric value. The issue appears in the paragraphs sets module when adding paragraphs "in between" existing paragraphs.

Steps to reproduce

  1. Install PHP 8.3
  2. Install Paragraphs Sets module
  3. Create a paragraph field that uses Paragraphs Sets
  4. Try to add a paragraph set between existing paragraphs

Current code

if (isset($insert_delta)) {
  ParagraphsSets::prepareDeltaPosition($field_state, $form_state, [$field_name], $insert_delta);
  $insert_delta++;
}

Proposed fix

if (isset($insert_delta)) {
  ParagraphsSets::prepareDeltaPosition($field_state, $form_state, [$field_name], $insert_delta);
  $insert_delta = (int)$insert_delta;
  $insert_delta++;
}

The fix ensures that $insert_delta is explicitly cast to an integer before incrementing it, which resolves the PHP 8.3 deprecation notice while maintaining the same functionality.

Patch

diff --git a/paragraphs_sets.module b/paragraphs_sets.module
index abc123..def456 789
--- a/paragraphs_sets.module
+++ b/paragraphs_sets.module
@@ -269,7 +269,8 @@ function paragraphs_sets_field_widget_complete_form_alter(array &$field_widget_comp
       $max++;
       if (isset($insert_delta)) {
         ParagraphsSets::prepareDeltaPosition($field_state, $form_state, [$field_name], $insert_delta);
+        $insert_delta = (int)$insert_delta;
         $insert_delta++;
       }

Additional information

  • Priority: Normal
  • Category: Bug Report
  • Tags:
    • PHP 8.3 compatibility
    • Deprecation notice
    • Bug

PHP 8.3 Deprecation Notice: Increment operator on non-numeric types in paragraphs_sets module

Description

When using Paragraphs Sets module with PHP 8.3, a deprecation notice appears:

Deprecated function: Increment on non-alphanumeric string is deprecated in paragraphs_sets_field_widget_complete_form_alter() (line 272 of paragraphs_sets.module)

This occurs when incrementing $insert_delta which may be a non-numeric value. The issue appears in the paragraphs sets module when adding paragraphs "in between" existing paragraphs.

Steps to reproduce

  1. Install PHP 8.3
  2. Install Paragraphs Sets module
  3. Create a paragraph field that uses Paragraphs Sets
  4. Try to add a paragraph set between existing paragraphs

Current code

if (isset($insert_delta)) {
  ParagraphsSets::prepareDeltaPosition($field_state, $form_state, [$field_name], $insert_delta);
  $insert_delta++;
}

Proposed fix

if (isset($insert_delta)) {
  ParagraphsSets::prepareDeltaPosition($field_state, $form_state, [$field_name], $insert_delta);
  $insert_delta = (int)$insert_delta;
  $insert_delta++;
}

The fix ensures that $insert_delta is explicitly cast to an integer before incrementing it, which resolves the PHP 8.3 deprecation notice while maintaining the same functionality.

Patch

diff --git a/paragraphs_sets.module b/paragraphs_sets.module
index abc123..def456 789
--- a/paragraphs_sets.module
+++ b/paragraphs_sets.module
@@ -269,7 +269,8 @@ function paragraphs_sets_field_widget_complete_form_alter(array &$field_widget_comp
       $max++;
       if (isset($insert_delta)) {
         ParagraphsSets::prepareDeltaPosition($field_state, $form_state, [$field_name], $insert_delta);
+        $insert_delta = (int)$insert_delta;
         $insert_delta++;
       }

Additional information

  • Priority: Normal
  • Category: Bug Report
  • Tags:
    • PHP 8.3 compatibility
    • Deprecation notice
    • Bug
🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇩🇰Denmark styrbaek

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