PlgFieldsSubform::beforePrepareField() in plugins/fields/subform/src/Extension/Subform.php calls json_decode($field->value, true) guarded only by an is_array($field->value) check. Any custom field of type Subform that has never been given a value has $field->value === null. Passing null to json_decode() triggers a PHP 8.1+ deprecation notice.
Subform on any content type (e.g. Articles).null).Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in plugins/fields/subform/src/Extension/Subform.php on line 143
I noticed this on a live Joomla 6.1.2 site, and confirmed the same unguarded call exists on the current joomla-cms 6.1-dev/main branches.
A related but distinct issue, #39768, previously reported a fatal error here for array values (fixed by #39842, which added the is_array() check) — but that fix never covered the null case.
I've opened a fix for this: #48122 (adds an early return for null/empty values, same pattern as the existing is_array() guard).
6.1
No deprecation notice is raised when a Subform field has no saved value.
Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated notice is raised/logged.
Joomla! 6.1.2 Stable, PHP 8.1+ (deprecation notices visible/logged).
This issue and its accompanying pull request (#48122) were drafted with AI assistance (Claude Code) and reviewed by me on a live site before submission, per the Generative AI policy.
| Labels |
Added:
No Code Attached Yet
|
||