Environment
|
|
| Bludit version |
3.19.0 |
| Plugin |
ImageGallery Pro v1.5.0 |
| PHP version |
8.2.30 |
| Web server |
Apache |
Description
After installing and activating the plugin, the following operations all produce error messages in the UI, although the actions are partially executed server-side:
- Create album → "Error: Could not save album settings." (album appears after page reload)
- Upload image → "Invalid JSON response from server." (thumbnail shows with ❌, image name appears after reload but image is not displayed, clicking shows "Image not found, next image will be loaded")
- Delete album → "Error: Album could not be deleted." (album is gone after page reload)
The root cause in all cases is that PHP fatal errors and warnings corrupt the JSON response before it reaches the client.
Steps to Reproduce
- Install Bludit 3.19.0 on a server running PHP 8.2.x
- Install and activate ImageGallery Pro v1.5.0
- Navigate to the plugin in the admin panel → tab "Images"
- Click "Add Album", enter a name, click "Save" → error appears
- Open the album, try to upload an image → error appears, thumbnail shows ❌
- Reload the page → image name is listed but not displayed, clicking shows "Image not found"
- Try to delete the album → error appears, album is gone after reload
PHP Error Log
[php:error] PHP Fatal error: Uncaught DivisionByZeroError: Division by zero
in .../vendors/SimpleImage.php:1272
Stack trace:
#0 .../vendors/novaImage.php(27): claviska\SimpleImage->thumbnail()
#1 .../ajax/helper.php(112): novafacile\novaImage->resize()
#2 .../ajax/request.php(74): uploadImage()
#3 {main}
[php:warn] PHP Warning: Undefined array key "test"
in .../plugin.php on line 173
[php:warn] PHP Warning: Trying to access array offset on value of type null
in .../plugin.php on line 175
[php:warn] PHP Warning: Undefined array key "title"
in .../plugin.php on line 195
[php:warn] PHP Warning: Undefined array key "sort"
in .../plugin.php on line 199
[php:warn] PHP Warning: Undefined array key "test"
in .../app/BluditImageGalleryAdmin.php on line 22
[php:warn] PHP Warning: Trying to access array offset on value of type null
in .../app/BluditImageGalleryAdmin.php on line 22
[php:warn] PHP Warning: Undefined array key "test"
in .../app/BluditImageGallery.php on line 88
[php:warn] PHP Warning: Trying to access array offset on value of type null
in .../app/BluditImageGallery.php on line 88
[php:warn] PHP Warning: file_put_contents(
.../bl-content/workspaces/imagegallery-pro/album-pages.json):
Failed to open stream: No such file or directory
in .../ajax/Config.php on line 55
[php:error] PHP Fatal error: Uncaught Error: Class "Log" not found
in .../ajax/Config.php:58
Stack trace:
#0 .../ajax/helper.php(130): Config->save()
#1 .../ajax/request.php(60): removeAlbum()
#2 {main}
Root Causes Identified
-
DivisionByZeroError in SimpleImage.php:1272 – thumbnail generation crashes during image upload; the PHP fatal error corrupts the JSON response, causing the "Invalid JSON response from server" error in the UI. The image file may be partially saved but no thumbnail is generated.
-
Undefined array key warnings in plugin.php, BluditImageGallery.php, BluditImageGalleryAdmin.php – PHP 8.0 changed the behavior for undefined array key access (previously silent, now emits warnings). These warnings are output before the JSON response and break JSON parsing on the client side.
-
Missing directory bl-content/workspaces/imagegallery-pro/ – file_put_contents() fails because the directory is not created during plugin installation/activation.
-
Class "Log" not found in ajax/Config.php:58 – Bludit's Log class is not loaded in the AJAX context. This causes a fatal error when attempting to delete an album, which again corrupts the JSON response.
Expected Behavior
All operations (create album, upload image, delete album) should complete without errors and the UI should reflect the changes immediately without requiring a page reload.
Actual Behavior
All write operations return error messages in the UI. The operations are partially executed server-side and only visible after a manual page reload.
Notes
- The "Settings" tab and "ImageGallery Pro" tab save correctly without errors – only operations that go through the AJAX handlers in
ajax/request.php are affected.
- No configuration errors on the user side – this is reproducible on a clean installation.
Environment
Description
After installing and activating the plugin, the following operations all produce error messages in the UI, although the actions are partially executed server-side:
The root cause in all cases is that PHP fatal errors and warnings corrupt the JSON response before it reaches the client.
Steps to Reproduce
PHP Error Log
Root Causes Identified
DivisionByZeroErrorinSimpleImage.php:1272– thumbnail generation crashes during image upload; the PHP fatal error corrupts the JSON response, causing the "Invalid JSON response from server" error in the UI. The image file may be partially saved but no thumbnail is generated.Undefined array keywarnings inplugin.php,BluditImageGallery.php,BluditImageGalleryAdmin.php– PHP 8.0 changed the behavior for undefined array key access (previously silent, now emits warnings). These warnings are output before the JSON response and break JSON parsing on the client side.Missing directory
bl-content/workspaces/imagegallery-pro/–file_put_contents()fails because the directory is not created during plugin installation/activation.Class "Log" not foundinajax/Config.php:58– Bludit'sLogclass is not loaded in the AJAX context. This causes a fatal error when attempting to delete an album, which again corrupts the JSON response.Expected Behavior
All operations (create album, upload image, delete album) should complete without errors and the UI should reflect the changes immediately without requiring a page reload.
Actual Behavior
All write operations return error messages in the UI. The operations are partially executed server-side and only visible after a manual page reload.
Notes
ajax/request.phpare affected.