No Code Attached Yet
avatar PhocaCz
PhocaCz
18 Sep 2024

Hi,

testing to update my smart search plugins, I get following error:

A "finder" plugin has had an error

When running in debug mode:

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in libraries/vendor/joomla/registry/src/Format/Json.php on line 80

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in libraries/vendor/joomla/registry/src/Format/Json.php on line 80

Changing core file: libraries/vendor/joomla/registry/src/Format/Json.php

FROM:
$data = \trim($data);

TO:
$data = \trim((string)$data);

solves the problem.

But of course, I cannot change the core file with the plugin, so the question is, what can be wrong in the plugin which can cause adding null to json function?

Thank you, Jan

image

avatar PhocaCz PhocaCz - open - 18 Sep 2024
avatar joomla-cms-bot joomla-cms-bot - change - 18 Sep 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 18 Sep 2024
avatar PhocaCz PhocaCz - change - 18 Sep 2024
The description was changed
avatar PhocaCz PhocaCz - edited - 18 Sep 2024
avatar PhocaCz PhocaCz - change - 18 Sep 2024
The description was changed
avatar PhocaCz PhocaCz - edited - 18 Sep 2024
avatar PhocaCz PhocaCz - change - 18 Sep 2024
The description was changed
avatar PhocaCz PhocaCz - edited - 18 Sep 2024
avatar PhocaCz PhocaCz - change - 18 Sep 2024
The description was changed
avatar PhocaCz PhocaCz - edited - 18 Sep 2024
avatar PhocaCz
PhocaCz - comment - 18 Sep 2024

OK, I found it, it is caused by Joomla\Registry class sending empty values.

avatar PhocaCz PhocaCz - change - 18 Sep 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-09-18 22:03:23
Closed_By PhocaCz
avatar PhocaCz PhocaCz - close - 18 Sep 2024
avatar HLeithner
HLeithner - comment - 19 Sep 2024

Hmm strange the file you posted doesn't have 80 lines: https://github.com/joomla-framework/registry/blob/3.x-dev/src/Format/Json.php

avatar PhocaCz
PhocaCz - comment - 19 Sep 2024

Hi, yes, sorry for confusion, in this file I had added a few lines for debug (trace where the variable comes from), the message without debug is the line 56 55:

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in libraries/vendor/joomla/registry/src/Format/Json.php on line 56 55

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in libraries/vendor/joomla/registry/src/Format/Json.php on line 56 55

image

It's hard to say, maybe it would be worth to treat the $data (string) somehow, because then it will help to remove the index malfunction for some older plugins.

EDIT:
Actually, the line should be 55 (seems like some empty row is still added on my test environment), the problematic line is:

$data = \trim($data);

Add a Comment

Login with GitHub to post a comment