User tests: Successful: Unsuccessful:
Pull Request resolves #48123.
PlgFieldsSubform::beforePrepareField() calls json_decode($field->value, true) after only checking is_array($field->value). Any subform custom field that has never been filled in has $field->value === null, so json_decode() is called with null, which triggers a PHP 8.1+ deprecation notice:
Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated
This adds an early return for null/empty string values, following the same pattern as the existing is_array() guard directly above it.
This PR was drafted with AI assistance (Claude Code) and reviewed/tested by me on a live Joomla 6.1.2 site before submitting, per the Generative AI policy.
Subform on an article/category/etc.error_reporting including deprecation notices (PHP 8.1+), observe the notice is raised.Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated notice shown/logged whenever an unfilled subform field is prepared.
No deprecation notice; behavior for non-null values is unchanged.
Please select:
No documentation changes for guide.joomla.org needed
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Front End Plugins |
| Title |
|
||||||
closes #48122