amqp-bunny icon indicating copy to clipboard operation
amqp-bunny copied to clipboard

php8.1 deprecation warning "strlen(null)"

Open 2mt-heuser opened this issue 2 years ago • 0 comments

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?

2mt-heuser avatar Feb 06 '23 09:02 2mt-heuser