vimeo/psalm

Incorrect assumptions about mysqli object parameters

Open

#4,502 opened on 2020年11月7日

GitHub で見る
 (6 comments) (0 reactions) (0 assignees)PHP (668 forks)batch import
Help wantedenhancementinternal stubs/callmap

Repository metrics

Stars
 (5,369 stars)
PR merge metrics
 (平均マージ 3d 12h) (30d で 5 merged PRs)

説明

Example: https://psalm.dev/r/c8e212f816

Psalm assumes the PHP documentation is correct. It is not. Specifically the Mysqli object has a lot of shady stuff going on with strange states of the connection.

In PHP 7.4 sqlstate is false in an empty Mysqli object while client_info is a string. client_info will also be false when a connection is attempted and fails. To make matters worse, the behavior of the class in edge cases like this changes between PHP versions. (I know it's different in PHP 8 and in older PHP 5 versions)

コントリビューターガイド