User tests: Successful: Unsuccessful:
PHP error was encountered when test instructions below are met:
json_decode(): Passing null to parameter #1 ($json) of type string is deprecated
If $value is null at line 86 in plugins/fields/media/media.php, then the deprecated error occurs.
Added if statement to checkValue function to check $value is set before trying to decode the string.
(ShackOpenGraph also installs Social Images fields that are Media type and trigger the error)
If there's no image in the custom field, then the code in the plugin does a check on the $value provided to the checkValue function. As there's no value, json_decode triggers
json_decode(): Passing null to parameter #1 ($json) of type string is deprecated
The checkValue function will now firstly check whether $value is null, and then only proceed with the rest of the function when $value has a value provided to it.
This in turn stops the deprecated message being generated.
Please select:
Category | ⇒ | Front End Plugins |
Status | New | ⇒ | Pending |
Title |
|
Labels |
Added:
?
|
Labels |
Added:
?
|
Labels |
Removed:
?
|
With 4.2-dev locked for 4.3 release, rebased this PR to 4.3-dev.
@particthistle Actually, 4.2-dev still accepts bugs fix. So you should not have to rebase to 4.3-dev.
Category | Front End Plugins | ⇒ | Administration com_admin SQL Postgresql com_config com_fields com_finder com_installer com_modules com_templates com_users Language & Strings |
It looks like something went wrong with the files associated with the PR. Can you fix it on your end Patrick @particthistle? Thanks, I appreciate it.
Was nudged on this during PBF. Aside from botching the rebasing of the PR, and being away 3 months due to finding a new house and moving, the problem preventing the code being merged is more due to the entire Custom Fields code being refactored for Joomla 4.3 from what I have worked out. Had it been actioned back in February it would not have had an issue.
https://github.com/joomla/joomla-cms/blob/4.4-dev/plugins/fields/media/src/Extension/Media.php shows where the code has moved to.
In trying to replicate the problem with 4.3.3 and 4.3.4.rc1 it appears to have been resolved in the refactoring process.
If it does turn out that it needs to be fixed (scenario may be where data has been imported from J3 to J4, and the initial values for the data is NULL instead of a correct default blank value) then the code to add into a new PR before Line 89 is:
if (!$value)
{
return;
}
However as I can't replicate the problem with the above testing instructions, I'm closing this PR at the moment.
If anyone wants to walk me through the issue, or help with creating some "Github PR for Joomlers" content, reach out on Mattermost.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-08-29 23:55:37 |
Closed_By | ⇒ | particthistle | |
Labels |
Added:
Language Change
bug
PR-4.3-dev
Removed: ? |
I have tested this item✅ successfully on 9e169df
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39542.