PHP8 compatibility.

Created on 5 July 2022, over 2 years ago
Updated 6 February 2023, almost 2 years ago

Problem/Motivation

After switching to PHP 8, when trying to clear cache, got errors:
"Fatal Error: Declaration of Doctrine\Common\Reflection\StaticReflectionClass::getConstants() must be compatible with ReflectionClass::getConstants(?int $filter = null)" in modules/providers/service_container_annotation_discovery/lib/Doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php on line 109.

"Fatal error: Declaration of Doctrine\Common\Reflection\StaticReflectionClass::newInstance($args) must be compatible with ReflectionClass::newInstance(mixed ...$args)" in modules/providers/service_container_annotation_discovery/lib/Doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php on line 397.

The root cause, that in PHP8 getConstants method of ReflectionClass needs a filter parameter (https://www.php.net/manual/en/reflectionclass.getconstants.php).
And newInstance accepts a variable number of arguments which are passed to the class constructor - (https://www.php.net/manual/en/reflectionclass.newinstance.php).

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡°πŸ‡ΏKazakhstan Dmitrii_Zadorozhnyi

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

  • 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