Skip to content

v3.35 - Fix count() error for null json_decode

Choose a tag to compare

@leapswitch-repos leapswitch-repos released this 23 Dec 11:43
· 16 commits to main since this release

Fixed

  • count() Error: count(): Argument #1 ($value) must be of type Countable|array, null given

Root Cause

json_decode() returns null when it encounters invalid JSON (e.g., HTML-encoded strings like "). The code was passing this null value directly to count().

Fix

Added null-safe defaults using the null coalescing operator:

$images = json_decode($imagesRaw ?: '[]', true) ?: [];

Applied to all three option types: images, flavors, and disks.