Typed property must not be accessed before initialization on D10.3

Created on 11 July 2024, 8 months ago
Updated 30 July 2024, 8 months ago

Problem/Motivation

Fix fatal error :

Error: Typed property Drupal\s3fs_bucket\Entity\S3Bucket::$bucket_type must not be accessed before initialization in Drupal\s3fs_bucket\Entity\S3Bucket->getPluginId() (line 123 of modules/contrib/s3fs/modules/s3fs_bucket/src/Entity/S3Bucket.php).

Full stack trace:

Error: Typed property Drupal\s3fs_bucket\Entity\S3Bucket::$bucket_type must not be accessed before initialization in Drupal\s3fs_bucket\Entity\S3Bucket->getPluginId() (line 123 of modules/contrib/s3fs/modules/s3fs_bucket/src/Entity/S3Bucket.php).
Drupal\s3fs_bucket\Form\S3BucketForm->buildEntityForm(Array, Object, Object) (Line: 81)
Drupal\s3fs_bucket\Form\S3BucketForm->form(Array, Object) (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('s3fs_bucket_add_form', Object) (Line: 284)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->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: 121)
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: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->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

  1. Install module s3fs_bucket
  2. Browse to /admin/config/s3/s3fs_bucket/add
  3. Confirm the page crashes with fatal error.

Proposed resolution

Fix the error, see similar issues with solutions:

Solution: Initialize property $bucket_type.

πŸ› Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

πŸ‡«πŸ‡·France dydave

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