Account for `\ErrorException` from `unserialize()` when Symfony’s PHP error conversion is enabled
まだ誰も着手していません。
評価
調査の方向性
The payload names no files, so start by locating where phpstan-symfony reads the framework configuration and where it could add throw types for functions. Reproduce with a small Symfony config that sets php_errors.log, then check whether PHPStan flags the catch (\ErrorException) around unserialize() as unreachable. Done when that catch is no longer reported and a test covers the enabled and disabled configurations.
索引モデルが issue の本文から書いたものです。
説明
Hey there 👋
Disclaimer: the text below is generated with LLM, but I checked it 🤞
When Symfony is configured to convert PHP errors into exceptions (framework.php_errors.log: true), malformed input to unserialize() can throw \ErrorException.
PHP emits an E_NOTICE for malformed serialized input before PHP 8.3 and an E_WARNING from PHP 8.3 onward. Symfony’s error handler converts that diagnostic into \ErrorException when the corresponding error level is enabled for throwing and included in error_reporting().
For example:
try {
$value = unserialize($data, ['allowed_classes' => false]);
} catch (\ErrorException $exception) {
// Handle malformed serialized data.
}
PHPStan’s built-in exception model does not account for this conversion and can report the catch as unreachable, although it is reachable with Symfony’s throwing error handler active.
Could phpstan-symfony account for this behavior when the Symfony configuration enables PHP error conversion, including the configured throwing levels?
Expected behavior:
- Recognize that
unserialize()may throw\ErrorExceptionwhen the relevant diagnostic is converted into an exception.
References:
- 主要言語
- PHP
- スター
- 806
- フォーク
- 104
- 平均マージ
- 27分
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
phpstan/phpstan-symfony のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
phpstan/phpstan-symfony#510 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
phpstan/phpstan-symfony#494 · コメント 5 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
phpstan/phpstan-symfony#268 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
phpstan/phpstan-symfony#509 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
phpstan/phpstan-symfony#466 · コメント 4 件 ·
phpstan/phpstan-symfony の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
grokability/snipe-it#19869 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 1/5 1時間未満 初心者へのやさしさ 77/100
メンテナーはふだん 3 日以内に返信
-
Перевод устарел
難易度 1/5 1時間未満 初心者へのやさしさ 74/100