Sourcerer: many deprecated & warning messages

Search
Other Bug Reports questions
Forum

Sourcerer: many deprecated & warning messages

Paul Willockx's Avatar Paul Willockx
Hi Peter,

When I develop PHP code I try to keep it perfect, so during development I also respond to 'deprecated', 'warnings' and 'notices' by setting error_reporting (E_ALL);

The following reporting from Sourcerer pollutes my error log, making it difficult for me to perfect my code. Can it be fixed?

It produces hundreds of instances of:
- Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in C:\wamp\www\ictmj4\plugins\system\sourcerer\src\Replace.php on line 555
- Warning: Undefined array key 1 in C:\wamp\www\ictmj4\plugins\system\sourcerer\src\Replace.php on line 555

- Sourcerer 9.3.0
- Apache 2.4
- php 8.1
- Joomla 4.2.6


From an article using Sourcerer, this is how I call my PHP file (busy replacing all obsolete JUMI calls):
{source}
<?php
require_once JPATH_BASE . "/components/my/path/to/code.php";
?>
{/source}


Thanks in advance,
Paul
Peter van Westen's Avatar Peter van Westen ADMIN
Can you give me (super) admin and (s)ftp access so I can take a look?
And tell me on what url I can see/reproduce the issue.
You can use the 'Confidential information' button in the forum editor to hide sensitive information.
Please post a rating at the Joomla! Extensions Directory
Paul Willockx's Avatar Paul Willockx
Sorry Peter, the site is not live yet and I cannot yet create a simple php file to replicate the issue.

There could still be something in my code, however your deprecated trim() call could be fixed.

I'll get back to you when I can replicate.
Paul Willockx's Avatar Paul Willockx
Hi Peter,

Here is a simple example: if you pass a null to mb_strlen(), sourcerer produces many deprecation warnings, not just once but many times.

//
// mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated
error_reporting(E_DEPRECATED);
$testVar = null;
echo "<p>Var length defect: " . mb_strlen ($testVar) . "</p>";
Paul Willockx's Avatar Paul Willockx
And if you specify error_reporting(E_ALL); the window & logs are flooded with messages.
Peter van Westen's Avatar Peter van Westen ADMIN
That is not Sourcerer doing that.
That is PHP itself.
And it is not a bug in Sourcerer or PHP. It is down to issues in your custom code.
Please post a rating at the Joomla! Extensions Directory
You can only post on this forum if you log in