The ImageFieldManagerInterface interface has type for constant and isn't work for PHP less then 8.3

Created on 16 August 2024, 4 months ago

Problem/Motivation

The Drupal 10.3 is full compatible with PHP8.3, but it should continue be compatible with PHP8.1 as well.

The ImageFieldManagerInterface interface has a type for a constant and it's available for PHP greater then 8.3, when PHP8.1 execute this interface the error below happen:

ParseError: syntax error, unexpected identifier "DEFAULT_IMAGE_DIRECTORY", expecting "=" in Composer\Autoload\{closure}() (line 17 of core/modules/image/src/ImageFieldManagerInterface.php).
Composer\Autoload\ClassLoader->loadClass('Drupal\image\ImageFieldManagerInterface') (Line: 23)
include('/var/www/html/core/modules/image/src/ImageFieldManager.php') (Line: 576)
Composer\Autoload\{closure}('/var/www/html/core/modules/image/src/ImageFieldManager.php') (Line: 427)
Composer\Autoload\ClassLoader->loadClass('Drupal\image\ImageFieldManager')
class_exists('Drupal\image\ImageFieldManager') (Line: 76)
Symfony\Component\Config\Resource\ClassExistenceResource->isFresh(0) (Line: 361)
Symfony\Component\DependencyInjection\ContainerBuilder->getReflectionClass('Drupal\image\ImageFieldManager', ) (Line: 27)
Symfony\Component\DependencyInjection\Compiler\AutowireAsDecoratorPass->process(Object) (Line: 80)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object) (Line: 767)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1447)
Drupal\Core\DrupalKernel->compileContainer() (Line: 971)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 853)
Drupal\Core\DrupalKernel->updateModules(Array, Array) (Line: 627)
Drupal\Core\Extension\ModuleInstaller->updateKernel(Array) (Line: 534)
Drupal\Core\Extension\ModuleInstaller->uninstall(Array, 1) (Line: 91)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array) (Line: 182)
Drupal\system\Form\ModulesUninstallConfirmForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('system_modules_uninstall_confirm_form', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

  • Install Drupal 10.3 with PHP8.1
  • Try to create a Content Type with Image Field

Proposed resolution

Remove the type from constant at html/core/modules/image/src/ImageFieldManagerInterface.php:17

Remaining tasks

N/A

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

The image module back to be compatible with PHP8.1

🐛 Bug report
Status

Closed: duplicate

Version

10.3

Component
Image system 

Last updated 1 day ago

Created by

🇧🇷Brazil viniciusrp

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

Comments & Activities

Production build 0.71.5 2024