Skip to content

mb_convert_encoding strict comparison errors on false check. #13463

@jannes-io

Description

@jannes-io

Bug report

https://www.php.net/manual/en/function.mb-convert-encoding.php

Function returns false on error. I checked phpstan-src, and it does have the correct return type there (string|array|false), but in reality, phpstan reports identical.alwaysFalse.

This particular case can happen when there are certain unicode characters in the input, so we want to check if it is false specifically.

Code snippet that reproduces the problem

https://phpstan.org/r/e833d30c-5c4c-448c-9f1e-98d611a3e691

Expected output

No error.

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions