Skip to content

php8.1 deprecation warning "strlen(null)" #2

Open
@2mt-heuser

Description

@2mt-heuser

Since i've upgraded my current project to php8.1 I always get the deprecation warning about passing null to the strlen() function.

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated

The call itself is not in this bundle, but rather in the underlying bunny-project
/vendor/bunny/bunny/src/Bunny/ClientMethods.php:1300)

$buffer->appendUint8(strlen($routingKey)); $buffer->append($routingKey);

but:
This bundle passes null down to bunny (because the used interop classes allow for that) where it gets put into an strlen() function which does not allow null to be passed.
https://github.com/php-enqueue/amqp-bunny/blob/master/AmqpContext.php#L221
https://github.com/php-enqueue/amqp-bunny/blob/master/AmqpContext.php#L230
https://github.com/php-enqueue/amqp-bunny/blob/master/AmqpContext.php#L239

So what's the better approach? Add a check in here or open an issue over at bunny to add stricter typechecks?

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