[PR #5030] [CLOSED] Fix TypeError in GalleryImageController by Ensuring Default Value for uploadedTo #6437

Closed
opened 2026-02-05 10:32:18 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/5030
Author: @kalebalebachew
Created: 5/23/2024
Status: Closed

Base: developmentHead: development


📝 Commits (1)

  • 2b486d4 Fix null issue in GalleryImageController by ensuring uploadedTo parameter defaults to 0

📊 Changes

1 file changed (+19 additions, -18 deletions)

View changed files

📝 app/Uploads/Controllers/GalleryImageController.php (+19 -18)

📄 Description

Problem

  • The application encountered a TypeError when the uploadedTo parameter was passed as null to the getEntityFiltered method within the GalleryImageController.
  • This error was triggered during GIF uploads that failed to generate thumbnails, subsequently causing the image picker to malfunction (stuck in an infinite loading state with a 501 error) as stated one issue #5029

Root Cause

  • The list function in GalleryImageController did not enforce a non-null default for the uploadedTo parameter when calling getEntityFiltered. This oversight allowed null values to be passed, which are not compatible with the expected integer type, leading to a TypeError.

Changes Made

  • Modified the $uploadedToFilter variable assignment in the list method to default to 0 if no value is provided.
    Included comments to explain the rationale behind the default value.

Impact

  • This fix prevents the server error encountered during GIF uploads and ensures the image picker continues to function correctly even if a thumbnail generation fails. It also enhances the robustness of the method by ensuring type consistency for critical parameters.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/5030 **Author:** [@kalebalebachew](https://github.com/kalebalebachew) **Created:** 5/23/2024 **Status:** ❌ Closed **Base:** `development` ← **Head:** `development` --- ### 📝 Commits (1) - [`2b486d4`](https://github.com/BookStackApp/BookStack/commit/2b486d45de35dc5d455b158d8f446d40b2b22217) Fix null issue in GalleryImageController by ensuring uploadedTo parameter defaults to 0 ### 📊 Changes **1 file changed** (+19 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `app/Uploads/Controllers/GalleryImageController.php` (+19 -18) </details> ### 📄 Description ## Problem - The application encountered a TypeError when the uploadedTo parameter was passed as null to the getEntityFiltered method within the GalleryImageController. - This error was triggered during GIF uploads that failed to generate thumbnails, subsequently causing the image picker to malfunction (stuck in an infinite loading state with a 501 error) as stated one issue #5029 ## Root Cause - The list function in GalleryImageController did not enforce a non-null default for the uploadedTo parameter when calling getEntityFiltered. This oversight allowed null values to be passed, which are not compatible with the expected integer type, leading to a TypeError. ## Changes Made - Modified the $uploadedToFilter variable assignment in the list method to default to 0 if no value is provided. Included comments to explain the rationale behind the default value. ## Impact - This fix prevents the server error encountered during GIF uploads and ensures the image picker continues to function correctly even if a thumbnail generation fails. It also enhances the robustness of the method by ensuring type consistency for critical parameters. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:32:18 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6437