get_class_methods() is not supported for interfaces in PHP 8

Created on 22 March 2023, about 2 years ago
Updated 24 March 2023, about 2 years ago

Problem/Motivation

Rules calls the PHP function get_class_methods() multiple places and passes the name of an interface.

With PHP 8.0.0 the function only accepts objects or valid class names. Consequently an error is thrown:

TypeError: get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given in get_class_methods() (line 227 of [...]/modules/contrib/rules/includes/faces.inc)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: works as designed

Version

2.13

Component

Rules Core

Created by

πŸ‡©πŸ‡°Denmark kasperg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kasperg
  • @kasperg opened merge request.
  • Status changed to Needs work about 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia
  • Status changed to Postponed: needs info about 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    I disagree with your conclusion of what is happening. My testing shows that get_class_methods() *does* work for interfaces in PHP 8.1

    Here is test code you can run on the web that demonstrates this: https://onlinephp.io/c/98c07317-283c-4e3a-9f77-b1feac2bc439

  • Status changed to Closed: won't fix about 2 years ago
  • πŸ‡©πŸ‡°Denmark kasperg

    TR, you are right. Sorry about the confusion.

    Drupal was not properly bootstrapped so PHP could not autoload the specified interface names. That is why the error occurred.

  • Status changed to Closed: works as designed about 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    OK, thanks for following up.

Production build 0.71.5 2024