No Code Attached Yet PHP 8.x
avatar jschmi102
jschmi102
26 Jan 2023

Steps to reproduce the issue

open a component's settings at admin backend

Actual result

got notice;
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated
in ..\administrator\components\com_fields\src\Helper\FieldsHelper.php on line 59

I changed code at line 59 to:

if (empty($contextString)) 
  $parts = array();		
else
  $parts = explode('.', $contextString, 2);

this fixed it.

System information (as much as possible)

4.3-apha4-dev
php 8.1.6

Additional comments

avatar jschmi102 jschmi102 - open - 26 Jan 2023
avatar joomla-cms-bot joomla-cms-bot - change - 26 Jan 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 26 Jan 2023
avatar Quy Quy - change - 3 Feb 2023
Labels Added: PHP 8.x
avatar Quy Quy - labeled - 3 Feb 2023
avatar joomdonation
joomdonation - comment - 15 Feb 2023

@jschmi102 Could you please let us know what component you are having this error :

  • If it is a core component, please let us know how we can see the issue ourself so that we can check it
  • If it is a third party component, I would suggest to report to the developer of the extension and ask him to fix it. It's very likely he passed wrong data to the method call in his own code.
avatar jschmi102
jschmi102 - comment - 15 Feb 2023

hi,
I am not able to find out which component is causing this. But I think that any coding esp. in libraries should take care, if parameters or any other input is not set as expected- E.g. if your variable "$contextString" is expected to be an array you should check this and add code to handle wrong assignments.

avatar joomdonation
joomdonation - comment - 15 Feb 2023

Yes, we can take care of that, but it will make our codebase a bit ugly. Since you proposed code, could you please make a PR to address this issue ? I think we can just return early if null is passed for that parameter, something like:

if ($contextString === null) {
	return null;
}
avatar joomdonation joomdonation - change - 15 Feb 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-02-15 11:30:58
Closed_By joomdonation
avatar joomdonation joomdonation - close - 15 Feb 2023
avatar joomdonation
joomdonation - comment - 15 Feb 2023

PR #39864 should address this issue. Please help testing. Thanks !

Add a Comment

Login with GitHub to post a comment