Pending

User tests: Successful: Unsuccessful:

avatar hans2103
hans2103
19 Jul 2026

Pull Request resolves #48123.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

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.

Testing Instructions

  1. Create a custom field of type Subform on an article/category/etc.
  2. View an item where that subform field has never been given a value (empty/null).
  3. With error_reporting including deprecation notices (PHP 8.1+), observe the notice is raised.
  4. Apply this patch and reload — the notice is gone, page renders identically otherwise.

Actual result BEFORE applying this Pull Request

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated notice shown/logged whenever an unfilled subform field is prepared.

Expected result AFTER applying this Pull Request

No deprecation notice; behavior for non-null values is unchanged.

Link to documentations

Please select:

  • No documentation changes for guide.joomla.org needed

  • No documentation changes for manual.joomla.org needed

avatar hans2103 hans2103 - open - 19 Jul 2026
avatar hans2103 hans2103 - change - 19 Jul 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Jul 2026
Category Front End Plugins
avatar hans2103 hans2103 - change - 19 Jul 2026
The description was changed
avatar hans2103 hans2103 - edited - 19 Jul 2026
avatar hans2103
hans2103 - comment - 20 Jul 2026

closes #48122

avatar hans2103
hans2103 - comment - 20 Jul 2026

closes #48123

avatar tecpromotion tecpromotion - change - 20 Jul 2026
Title
[AI] [6.1] Fix PHP 8.1+ deprecation notice in subform field when value is null
[6.1] [AI] Fix PHP 8.1+ deprecation notice in subform field when value is null
avatar tecpromotion tecpromotion - edited - 20 Jul 2026

Add a Comment

Login with GitHub to post a comment