PHP 8.3

Last reviewed Sep 5, 2026

Export as PDF

Prompt Details

Prompt Composition

1prompt
  1. PHP 8.3119 lines · 5.8K tokens

CWE Coverage

  • 20
  • 22
  • 59
  • 78
  • 79
  • 88
  • 89
  • 95
  • 98
  • 113
  • 117
  • 187
  • 201
  • 203
  • 208
  • 209
  • 214
  • 250
  • 256
  • 295
  • 307
  • 319
  • 323
  • 327
  • 328
  • 338
  • 340
  • 352
  • 354
  • 362
  • 367
  • 377
  • 384
  • 390
  • 409
  • 434
  • 470
  • 502
  • 522
  • 532
  • 552
  • 601
  • 611
  • 613
  • 614
  • 627
  • 639
  • 674
  • 732
  • 759
  • 760
  • 770
  • 776
  • 778
  • 798
  • 807
  • 829
  • 862
  • 915
  • 916
  • 918
  • 940
  • 1004
  • 1021
  • 1275
  • 1333
  • 1395

Prompt Preview

Use these requirements for applications generated or reviewed for PHP 8.3, which is in security-fixes-only support through 2027-12-31.

Types, classes, and trusted state

  • Start application files with declare(strict_types=1); and give functions, methods, properties, and returns narrow types. Validate external values before conversion; strict types do not establish provenance, ranges, or authorization.
  • Translate accepted input into explicit DTOs or value objects. Never use extract(), broad setters, reflection, or arbitrary request keys to populate domain models.
  • Declare every property and avoid #[\AllowDynamicProperties]. Dynamic writes hide mistakes and make attacker-controlled field assignment difficult to audit.
  • Do not treat a readonly class or property as deep immutability or access control: objects it references remain mutable, and all constructor values still cross the normal validation boundary.
  • Use enums and fixed server-side maps for roles, workflow states, sort fields, handlers, templates, classes, and method names. Do not dispatch a callable or lifecycle hook named by an untrusted value.
  • Put PHP 8.3's #[\Override] on methods intended to implement or override authorization, validation, serialization, and lifecycle hooks so a misspelling fails at compile time. In PHP 8.3 it applies to methods, not properties. Apply it to __construct() only when implementing a constructor declared abstract or in an interface.
  • Mark secret-bearing parameters on each concrete implementation with #[\SensitiveParameter], while still redacting logs,