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

DeserializeProvider calls PartialDenormalizationException::getErrors(), deprecated in Symfony 8.1

Đang mở Phù hợp với người mới
#8,650 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@dualfroz đang làm issue này rồi.

Từ ngày 10/10/2026.

  • #8663 của @dualfroz — đang mở

Đánh giá

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

Hướng nghiên cứu

Bắt đầu tại src/State/Provider/DeserializeProvider.php, ở lời gọi quanh dòng 110 được nêu trong issue. Kiểm tra cách dự án hỗ trợ cả Symfony Serializer 7.4 và 8.1, sau đó chạy các bài kiểm thử liên quan đến đầu vào không hợp lệ với collect_denormalization_errors: true. Công việc được xem là hoàn tất khi các bài kiểm thử đó vượt qua mà không có cảnh báo không còn được khuyến nghị của Symfony 8.1, đồng thời Symfony 7.4 vẫn được hỗ trợ.

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

Mô tả

API Platform version(s) affected: 4.3.21 and the current head of 4.4 (5.0 is not affected)

Symfony 8.1 deprecates PartialDenormalizationException::getErrors() in favour of getNotNormalizableValueErrors(). The 4.4 branch still calls it: https://github.com/api-platform/core/blob/4.4/src/State/Provider/DeserializeProvider.php#L110

Since symfony/serializer 8.1: The "Symfony\Component\Serializer\Exception\PartialDenormalizationException::getErrors()" method is deprecated, use "Symfony\Component\Serializer\Exception\PartialDenormalizationException::getNotNormalizableValueErrors()" instead.

Every 422 caused by a denormalization error goes through this line, so with collect_denormalization_errors: true it shows up in each test that sends invalid input. 5.0 no longer has the call, but it went away with the rewrite in #8211, which won't be backported.

Possible solution

In Symfony 8.1 getErrors() only returns getNotNormalizableValueErrors(), so the swap is exact. 4.4 also supports symfony/serializer ^7.4, which doesn't have that method, so the fallback would be needed. Yet the fix seems as trivial as

$errors = method_exists($e, 'getNotNormalizableValueErrors')
    ? $e->getNotNormalizableValueErrors()
    : $e->getErrors();

foreach ($errors as $exception) {
    ...
Ngôn ngữ chính
PHP
Star
2.6k
Fork
987
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
80

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

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 api-platform/core

Tất cả issue của api-platform/core

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.