PHP 8 deprecation messages

Created on 28 November 2022, almost 2 years ago

Problem/Motivation

There are PHP 8 deprecation messages:

exception: [Deprecated function] Line 377 of sites/all/modules/uc_extra_fields_pane/class/UCXF_Field.class.php:
strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

Problematic code should be this strpos() call with the NULL parameter of $default_db_name:

    $default_db_name = $this->db_name;
    if (strpos($default_db_name, 'ucxf_') !== 0) {
      $default_db_name = 'ucxf_';
    }

However it seems to me that the variable $default_db_name is not used anywhere, so the whole code block can probably be removed.

--------

exception: [Deprecated] Line 482 of includes/unicode.inc:
mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated

Problematic code should be drupal_strlen() in the createFieldHelper() function:

   global $db_prefix;
    $edit += array(
      'ucxf[label]' => $this->randomName(10),
      'ucxf[db_name]' => drupal_strtolower($this->randomName(32 - 5 - drupal_strlen($db_prefix) - 1)),
      'ucxf[description]' => $this->randomString(10),
      'ucxf[value_type]' => $type,
      'ucxf[required]' => TRUE,
    );

Steps to reproduce

Proposed resolution

Fix deprecations.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia poker10

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