Skip to content

Bug: Validation on null for trim #7067

Closed
@ValdisM

Description

@ValdisM

PHP Version

8.1

CodeIgniter4 Version

4.2.5

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

macOS

Which server did you use?

apache

Database

No response

What happened?

trim() on null is not working for validation.

I suggest to edit: Validation.php Line 302:

$passed = $param === false ? $rule((string) $value ?? '') : $rule((string) $value ?? '', $param, $data);

Steps to Reproduce

make rule without a post.

Expected Output

Expected:\

Previous:
$passed = $param === false ? $rule($value) : $rule($value, $param, $data);

$passed = $param === false ? $rule((string) $value ?? '') : $rule((string) $value ?? '', $param, $data);

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting for infoIssues or pull requests that need further clarification from the author

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions