[pmwiki-users] New warnings with php 8.1.2

Dominique Faure dominique.faure at gmail.com
Mon Feb 7 06:12:04 PST 2022


Hi,

Toying with the prerelease on an updated php8.1-fpm (8.1.2), I got
another set of deprecation warnings:

Deprecated: strncmp(): Passing null to parameter #1 ($string1) of type
string is deprecated in /home/debian/websites/X/pmwiki.php on line
1595
Deprecated: strncmp(): Passing null to parameter #1 ($string1) of type
string is deprecated in /home/debian/websites/X/pmwiki.php on line
1599

Which can be easily removed by inserting at 1595 the following line:

$fmt = strval($fmt);

But I'm not sure this would be optimal.

Regards,
Dominique

On Wed, Jan 26, 2022 at 5:29 PM Petko Yotov <5ko at 5ko.fr> wrote:
>
> Absolutely, there will be a version 2.3.2 with corrections.
>
> Thanks for your report. I have PHP 8.1.2 on Ubuntu but for some reason
> it didn't show this warning even with error_reporting(E_ALL),
> display_errors and track_errors enabled.
>
> Anyway, I know what causes this, and I have fixed if for PmWiki 2.3.2,
> due in a few days.
>
> This precise warning is indeed caused by a change in PHP where
> previously it treated undefined variables or null as an empty string,
> now it complains that these are undefined. The "@" before the variable
> that previously suppressed the warnings is no longer enough.
>
> The fix I use is to wrap the possibly undefined variable with strval(),
> it makes it behave like it did before.
>
> You can get the pre-release, or even only the files that changed since
> 2.3.1, from the top of the page Changelog:
>
>    https://www.pmwiki.org/wiki/PmWiki/ChangeLog
>
> Please test it and let me know if you encounter other problems.
>
> Petko
>
> --
> PmWeekly Blog  :  http://www.pmwiki.org/News
> If you upgrade :  http://www.pmwiki.org/Upgrades
>
>
> On 26/01/2022 16:43, Hans-Jürgen Godau wrote:
> > Today I got a number of deprecated error messages in my pmwiki after
> > setting up php to version 8.1.2 on arch linux. There seem to be new
> > warnings in case of unset parameters to preg_repalce, strlen or
> > strncmp.
> > That happens for examplin pmwiki.php:
> >
> > Passing null to parameter #3 ($subject) of type array|string is
> > deprecated in pmwiki.php on line 75
> >
> > and also in some skin/cookbook scripts.
> >
> > Will there be a Version 2.3.2 with corrections?
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users



More information about the pmwiki-users mailing list