You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[2.1.18] Subs-Attachments.php: Line 698, bool treated as array, forum error generated after attaching .txt or .pdf #9787
I am using Apache 2.4 (32-bit), PHP 8.5.10 (32-bit) and was seeing this error on every .txt or .pdf attachment.
I am not a PHP programmer so I relied on ChatGPT to identify and patch the problem.
Excuse me in advance if the etiquette for reports is supposed to exclude AI bug identification or patches.
ChatGPT:
The code treats a Boolean false as an array, and I confirmed the exact cause in your installed forum.
Both logs identify Subs-Attachments.php, line 698:
The failing code is:
$size = @getimagesize($attachmentOptions['tmp_name']);
list ($attachmentOptions['width'], $attachmentOptions['height']) = $size;
getimagesize() returns an array for supported images, but returns false when it cannot determine image dimensions. A PDF or other non-image attachment can therefore reach the next line with $size === false.
This preserves image dimensions and uses zero dimensions for other attachments. The existing SVG handling immediately afterward remains applicable.
I reproduced the exact warning using your local PHP 8.5.10 executable. The guarded version completed without that warning. The logs alone don’t identify which uploaded files caused it; an unreadable or damaged image could also return false.
Attached is a patch from ChatGPT for the line in question. Search 'ChatGPT' to locate the patch.
Activity
sbulen commentedon Oct 21, 2026
Not seeing this on php 8.4. Will be able to test 8.5 later...
smith-48116 commentedon Oct 21, 2026
Thanks for looking at it. I am sure you guys are already aware, but you might want to update to the latest version of PHP!
https://www.nsa.gov/Press-Room/Press-Releases-Statements/Press-Release-View/Article/4630238/nsa-advisory-php-updates/
I posted this report with my prior version, as submitted in the report, but I have upgraded to the latest version because of that advisory.
sbulen commentedon Oct 23, 2026
I have confirmed these both on php 8.5, but neither exist on php 8.4.
Change in 8.5 on list() processing:
So this is a new PHP 8.5 issue...
sbulen commentedon Oct 25, 2026
Note this was reported in the forum as well:
https://www.simplemachines.org/community/index.php?topic=594725.0