CMSB v3.57 Released (maintenance release)

10 posts by 5 authors in: Forums > CMS Builder
Last Post: November 17   (RSS)

By gversion - September 30

Hi Dave,

Thanks for the notification about this and, of course, for releasing v3.57!

Are the latest versions of all the plugins that are available to download from your website compatible with PHP 8? For example, I am wondering about the website membership plugin, which doesn't seem to have been updated since Jan 19, 2018 so I would be surprised if this didn't need an update.

Also, is there a free scanner/script that can identify code that won't work with PHP 8 or is is just a case of upgrading and then manually testing everything?

Thanks again,

Greg

By daniel - October 3

Hi Greg,

We've been working on getting some of our more popular plugins updated for PHP 8.1; Website Membership being one of them. They should be getting an official release in the next few days, but let me know if there's anything you need to get updated ASAP and can provide a patch in the meantime.

Also, is there a free scanner/script that can identify code that won't work with PHP 8 or is is just a case of upgrading and then manually testing everything?

Nothing that we're aware of, yet.

I can let you know that the big culprit in PHP 8.1 is that a number of internal PHP functions no longer allow "null" to be used as an empty value (e.g., strlen() or str_replace() which expect strings), which can cause issues in places where "@" is used to silence notices for variables that may not exist if they then get passed to any of these functions. This is a pattern that was used historically in our code, that now needs to be shifted away from. It's simple to fix, but if you have custom code that uses that pattern it increases the likelihood that you'll get errors in PHP 8.1. 

Ideally, these sections should be rewritten to explicitly check whether or not the variable exists, but if you get an error like "Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in ... on line ...", it can be fixed in a pinch by changing this:

strlen(@$_REQUEST['somevar']);

To this:

strlen($_REQUEST['somevar']??'');

(Note that ??'' should be used when the function expects a string. You'd use ??0 if expecting an integer, ??false if expecting a boolean, etc.)

Thanks,

Daniel
Technical Lead
interactivetools.com

By gversion - October 4

Hi Daniel,

Thanks for the reply.

Great to hear there will be updates coming soon for the main plugins and that's really useful to know about PHP 8.1.

Thanks again!

Regards,

Greg

By KennyH - November 16

I have migrated my websites to a new server and am running into a small issue with PHP v8.1.12 when using the forgot password feature. I haven't tried using any other SMTP functions in CMSB yet to see if the same issue happens.

E_DEPRECATED: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
/home/[username]/domains/[domain-name]/public_html/cmsb/3rdParty/SwiftMailer5/classes/Swift/Transport/Esmtp/AuthHandler.php (line 251)
https://www.[domain-name]/cmsb/admin.phpmodifyerase

E_DEPRECATED: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
/home/[username]/domains/[domain-name]/public_html/cmsb/3rdParty/SwiftMailer5/classes/Swift/Transport/EsmtpTransport.php (line 143)
https://www.[domain-name]/cmsb/admin.php

By gkornbluth - November 16

Hi KennyH,

There's a post that I copied into my CMSB Cookbook http://www.thecmsbcookbook.com/recipedetail.php?PHP-8.1-errors-various-629 where Daniel Louwe mentions:


To get rid of PHP 8.1 deprecation warnings (specifically ones that mention "passing null"), note which function and
parameter is throwing the warning, and add ??'' to the end of the
variable being passed to that parameter. It's also possible to remove the @ from the variable if there is one.

@$_REQUEST[$name]

becomes this:

$_REQUEST[$name]??''

There's another similar error noted in this post: https://www.interactivetools.com/forum/forum-posts.php?postNum=2245997

Other PHP 8 errors and some fixes are talked about in
https://www.interactivetools.com/forum/forum-posts.php?postNum=2246123
and https://www.interactivetools.com/forum/forum-posts.php?postNum=2246122

Hope that helps

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!

Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By KennyH - November 16

Thanks, Jerry!  I will take a look at that

KH

By Dave - November 17

Hi Kenny, 

Can you try these fixes and see if they work for you?  If they do will include them in the next release.

/cmsb/3rdParty/SwiftMailer5/classes/Swift/Transport/Esmtp/AuthHandler.php:line 251
From: if (!$mode = strtolower($this->_auth_mode)) {
To:   if (!$mode = strtolower($this->_auth_mode ?? '')) {

/cmsb/3rdParty/SwiftMailer5/classes/Swift/Transport/EsmtpTransport.php:line 143
From: $encryption = strtolower($encryption);
To:   $encryption = strtolower($encryption ?? '');

Let me know if that works for you!

Thanks!

Dave Edis - Senior Developer
interactivetools.com

By KennyH - November 17

Hi Dave - 

That fixed worked. After make the changes, the forgot password feature works without error now.

Thanks,

Kenny

By Dave - November 17

Perfect, thanks!

Dave Edis - Senior Developer
interactivetools.com