Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#514 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
devtools

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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:

Ngôn ngữ chính
PHP
Star
806
Fork
104
Merge trung bình
27 phút
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của phpstan/phpstan-symfony

Tất cả issue của phpstan/phpstan-symfony

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.