SP Page Builder 6 Pro
Version: 6.6.2
Bug Report: "Remove" button fails in Blog Media tab when deleting a featured image
File: plugins/system/helixultimate/src/Platform/Blog.php
Method: remove_image() (~line 247)
Steps to Reproduce
- Open any article for editing in the Joomla administrator
- Navigate to the Blog Media tab
- A thumbnail of the article's featured image is displayed
- Click the Remove button on the image thumbnail
- The removal appears to fail on the frontend
Symptom
The AJAX response returned to the browser is corrupted — a PHP warning is emitted before the JSON payload, making the response unparseable:
Warning: Trying to access array offset on null in ...Blog.php on line 249
{"status":true,"output":"Invalid Token"}
The frontend AJAX handler cannot parse this as valid JSON and reports failure, even though the underlying DB operation actually completed successfully.
Root Cause
Two issues in remove_image():
- Missing null guard on $galleryImages (line 249) — the breaking issue
The image being removed is the article's featured image (helix_ultimate_image). That reference is correctly cleared on lines 243–245. Execution then falls through to the gallery block (lines 247–257), which checks whether helix_ultimate_gallery is set in the article
attribs — it is, but its value is empty or contains non-object JSON, so json_decode() returns null. The code immediately accesses $galleryImages['helix_ultimate_gallery_images'] without first confirming $galleryImages is a valid array. This emits a PHP warning into
the response body, corrupting the JSON and breaking the frontend.
This is the common case: an article that has a featured image but no gallery images will have an empty or null helix_ultimate_gallery value, making this bug reproducible on the majority of articles.
- Success path never clears the output field (line 266) — misleading response
$report['output'] is initialized to 'Invalid Token' as the default message for the early-exit die path. When the operation succeeds, status is set to true but output is never updated, resulting in the confusing "output":"Invalid Token" appearing in an otherwise
successful response.
Fix
// Before (line 249):
if (is_array($galleryImages['helix_ultimate_gallery_images'])) {
// After:
if (is_array($galleryImages) && is_array($galleryImages['helix_ultimate_gallery_images'])) {
// Before (line 266):
$report['status'] = true;
// After:
$report['status'] = true;
$report['output'] = 'Image removed successfully.';
Notes
- The file physically exists on disk and the DB update completes successfully — the failure is purely in the response being corrupted by the warning
- The bug is reliably triggered on any article that has a featured image but no gallery images assigned — which is the typical use case
- Likely exposed by a recent extension update that may have changed how helix_ultimate_gallery is stored or initialized in article attribs