backdrop-contrib / bee

:bee: Bee is a command line utility for Backdrop CMS. It includes commands that allow developers to interact with Backdrop sites.
GNU General Public License v2.0
16 stars 22 forks source link

Error PHP 8.1 - mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated /app/includes/render.inc #211

Closed yorkshire-pudding closed 2 years ago

yorkshire-pudding commented 2 years ago

In a PHP 8.1 environment run bee status or bee status --show-password

mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated
 /app/includes/render.inc:280

 Backdrop CMS        1.24.x-dev
 Root directory      /app/backdrop
 Site type           Single
 Database            mysql
 Database name       backdrop
 Database username   backdrop
 Database password   **********
 Database host       database
mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated
 /app/includes/render.inc:232

mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated
 /app/includes/render.inc:332

mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated
 /app/includes/render.inc:332

 Database port

PR to follow

yorkshire-pudding commented 2 years ago

@indigoxela - would you be happy to do a quick code review on this and then I'll merge it?

indigoxela commented 2 years ago

How can I trigger the warning for $delimiter_...? I don't get those.

I only get the ones you posted in the issue description.

yorkshire-pudding commented 2 years ago

@indigoxela - I don't think you do as these are passed by other functions. I think someone could write an add-on that forgets to specify delimiter so I simply cast them all as string; for that function, they all should be string, so I didn't see any harm in doing them all.

indigoxela commented 2 years ago

@yorkshire-pudding ah, got it!

I can confirm that the annoying deprecated warnings are gone on php8.1 after applying the patch. :+1: