get_class() without arguments causes deprecation warnings in PHP8.3

Created on 6 May 2024, 7 months ago
Updated 26 May 2024, 6 months ago

Problem/Motivation

When using the module on a PHP 8.3 server one gets warnings like:

Deprecated function: Calling get_class() without arguments is deprecated in Drupal\codefilter\Plugin\Filter\CodeFilter::processCode() (line 141 of modules/contrib/codefilter/src/Plugin/Filter/CodeFilter.php).

Steps to reproduce

  • Install Drupal 10 on a server running PHP 8.3
  • Add codefilter, enable it, configure it as part of a text format
  • Create a node where a field uses that iput format
  • Navigate to that node; observe the warning

Proposed resolution

The problem is in a preg_replace_callback:

$text = preg_replace_callback('/<\?php.+?\?>/s', [get_class(), 'processPhpInline'], $text);

That call can probably be replaced by __CLASS__.

Remaining tasks

Verify and implement.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇫🇷France fgm Paris, France

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