Skip to content

Fix Deprecated Warning for trim() on Null Values #21

Open
@izzygld

Description

@izzygld

Fix Deprecated Warning for trim() on Null Values

Description

This issue tracks a PHP 8.1+ deprecation warning caused by passing null to trim() in the redirect() function. The error message is:

PHP Deprecated: trim(): Passing null to parameter ($string) of type string is deprecated

Steps to Reproduce

  1. Use PHP 8.1 or later.
  2. Activate the Simple 301 Redirects plugin.
  3. Observe the deprecated warning in logs.

Proposed Fix

  • Ensure that $userrequest and $storedrequest are cast to (string) before calling trim().
  • A pull request has been created to fix this: #20.

Impact

  • ✅ Eliminates the deprecation notice.
  • ✅ Improves compatibility with newer PHP versions.

Related PR: #20

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