Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Concerns about passing null to some polyfill arguments #506

Copy link
Copy link
Open
@pilif

Description

@pilif
Issue body actions

For years our code-base (like presumably many others) had an existing mb_trim() polyfill of our own and as it pre-dates even php 7, it had a slight quirk in that it accepted a null as the first argument.

PHP 8.4 will provide its own mb_trim() implementation which has its first argument typed as string, but which also accepts a null argument, albeit with a deprecation warning.

The symfony polyfill on the other hand does not accept a null argument and thus, it being an userland function will throw a TypeError instead.

In the case of our code-base, this caused an issue where a completely non-related composer update now turned code which run perfectly well (and would have changed to raising a deprecation notice in 8.4) into a TypeError.

I know that this is probably a slight edge-case, but I'm still coming here to raise the issue because it might affect other users.

IMHO, to be a proper polyfill for PHP 8.4 mb_trim, your implementation should accept nulls too and raise an E_USER_DEPRECATED error if a null is passed.

And the same is probably true for many other functions as well.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.