Skip to content

Bug: ErrorException: Passing null to strtolower() is deprecated in php8.1 #5436

@RussellJapheth

Description

@RussellJapheth

PHP Version

8.1

CodeIgniter4 Version

4.1.5

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

cli-server (PHP built-in webserver)

Database

No response

What happened?

An ErrorException is thrown when accessing the controller. The message is:
strtolower(): Passing null to parameter #1 ($string) of type string is deprecated

Steps to Reproduce

Start the built-in server using $ php8.1 spark serve
Open up any route in the browser

Expected Output

The HTML that the controller outputs is expected

Anything else?

The error appears to be thrown because in SYSTEMPATH/Validation/FormatRules.php at line 253 the strtolower() function is passed a variable $which which can be null, and passing null to strtolower() is deprecated in php8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions