Symfony 8.1
Last reviewed Oct 16, 2026
Prompt Details
Prompt Composition
2prompts
- PHP 8.5145 lines · 5.4K tokens
- Symfony 8.181 lines · 6.1K tokens
Total226 lines · 11.5K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 93
- 95
- 98
- 117
- 187
- 201
- 208
- 209
- 214
- 256
- 287
- 294
- 295
- 307
- 321
- 323
- 338
- 340
- 345
- 347
- 352
- 354
- 362
- 367
- 384
- 390
- 409
- 434
- 470
- 488
- 502
- 522
- 524
- 532
- 552
- 601
- 611
- 613
- 614
- 639
- 674
- 732
- 770
- 776
- 798
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 940
- 942
- 1004
- 1275
- 1333
- 1336
- 1395
Prompt Preview
Apply the PHP 8.5 baseline first. These rules cover the Symfony 8.1 line. Read each release range against the installed version of the component that owns the API, because Symfony does not tag every component in every patch release.
Requests, forms, and validation
- Bind requests to narrow DTOs or form types and never map arbitrary request data directly to entities. Set explicit accepted formats and validation groups for
#[MapRequestPayload]; installing another encoder must not silently enable an unwanted input format. - Define form fields explicitly, omit protected entity fields, and retain
allow_extra_fields=falseso undeclared input fails rather than disappearing silently;mapped=falseonly disables automatic object mapping and does not make submitted values trusted. - Apply validators to lengths, ranges, formats, collections, files, and cross-field invariants. Persist form data only after
isSubmitted()andisValid()succeed;handleRequest()can mutate the bound object before validation, so keep that state out of side effects until accepted. - Reject extra fields where ambiguity or mass assignment could change protected state; for Serializer-backed DTOs set
AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES => false, because the default istrue, and supply the required class metadata factory. Keep type enforcement enabled, use application-owned groups and#[Ignore], and never commit the partial object fromPartialDenormalizationException. - For
FormFlow, authorize the current flow and accumulated data on each request. RequireisSubmitted(),