Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Account for `\ErrorException` from `unserialize()` when Symfony’s PHP error conversion is enabled

オープン
#514 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php
領域
devtools

調査の方向性

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 \ErrorException when the relevant diagnostic is converted into an exception.

References:

主要言語
PHP
スター
806
フォーク
104
平均マージ
27分
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

phpstan/phpstan-symfony のほかの issue

phpstan/phpstan-symfony の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。