Pressing upload on the h5p libraries page results in a wsod

Created on 5 September 2025, 27 days ago

Problem/Motivation

Fatal TypeError occurs when users click the "Upload" button on the H5P Library Upload form without selecting a file.

Steps to reproduce

  1. Navigate to /admin/content/h5p
  2. Click "Upload" button WITHOUT selecting a file
  3. Fatal error occurs

Proposed resolution

Add null check before sizeof() call in H5PLibraryUploadForm::validateH5PFileUpload() at line 80.

Error Details

TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, null given in sizeof() (line 80 of modules/contrib/h5p/src/Form/H5PLibraryUploadForm.php)

Drupal\h5p\Form\H5PLibraryUploadForm->validateH5PFileUpload(Array, Object) (Line: 52)
Drupal\h5p\Form\H5PLibraryUploadForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 274)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'h5p_library_upload_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('h5p_library_upload_form', Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('h5p_library_upload_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm('Drupal\h5p\Form\H5PLibraryUploadForm', Object) (Line: 219)
Drupal\Core\Form\FormBuilder->getForm('Drupal\h5p\Form\H5PLibraryUploadForm') (Line: 108)
Drupal\h5p\Controller\H5PLibraryAdmin->libraryList()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
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: 183)
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: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->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: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States frob US

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

Comments & Activities

Production build 0.71.5 2024