DeserializeProvider calls PartialDenormalizationException::getErrors(), deprecated in Symfony 8.1
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 issue 中指出的第 110 行附近的调用处开始检查 src/State/Provider/DeserializeProvider.php。确认项目如何同时支持 Symfony Serializer 7.4 和 8.1,然后运行使用 collect_denormalization_errors: true 处理无效输入的相关测试。完成标准是这些测试通过,且没有 Symfony 8.1 弃用警告,同时继续支持 Symfony 7.4。
由索引模型根据 Issue 内容生成。
描述
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) {
...
- 主要语言
- PHP
- 星标
- 2.6k
- 派生
- 989
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 90
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
api-platform/core 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
api-platform/core#8690 ·
维护者通常 1 天内回复
-
SkolemIriConverter isn't reset between requests in worker mode (missing kernel.reset tag)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
api-platform/core#8680 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
api-platform/core#8686 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 54/100
api-platform/core#8664 · 1 条评论 ·
维护者通常 1 天内回复
-
[Metadata] Incorrect api schema for path variable可能已有人在做 @bram123 于 3 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
api-platform/core#8646 · 1 条评论 ·
维护者通常 1 天内回复
查看 api-platform/core 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
Automattic/blocks-engine#2866 ·
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 2/5 1-3 小时 新手友好度 82/100
-
backend gamification P0
难度 2/5 1-3 小时 新手友好度 66/100
semanadeinformatica/website#461 ·
-
HttpRequestTrait fatals on WordPress 7.2: $blocked_http_requests clashes with WP_UnitTestCase_Base未关闭
难度 2/5 1-3 小时 新手友好度 72/100
-
area: docs eco: php good first issue help wanted lane: free-agent roadmap size: XS type: docs
难度 2/5 1-3 小时 新手友好度 68/100
arminazimi/evergreen#453 ·
维护者通常 1 天内回复