PHP 7.1 → 8.5.12 Upgrade Solutions (Prioritized)

Of the changes listed in versions.html, the items to tackle first when jumping straight from 7.1 to 8.5.12 are prioritized here by necessity (how dangerous it is to leave them) and scope (how much of the codebase they touch). Sample code / configuration examples are shown on the right of each item. If time is limited, fix P0 then P1 first; postponing P2 and P3 is unlikely to cause fatal failures. Items whose behavior changed in patch releases up to 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35 (released October 22, 2026) are also included (the patch versions where the change applies are shown in the item name, e.g. "(8.4.27+/8.5.12+)").

How to jump straight to 8.5.12 when time is short
  1. Read through the 105 P0–P3 items first: these 105 items with sample code are a selection of changes that are "especially high-impact or easy to miss". They focus on design decisions that automated tools such as rector rarely catch (PDO error mode change, behavior changes of the @ operator, resource-to-object type checks, etc.). Grasping these ideas before checking all 535 items will help you judge the output of the later tools correctly.
  2. Check your real code mechanically with check-required-items.sh: it matches your code against a checklist generated automatically from the function names and keywords of the 535 quick-reference items (363 of them required), narrowing them down to the items that actually hit. Each item has a P0–P3 priority, so you can review the report starting from P0.
    Examples
    ./check-required-items.sh /path/to/your-project
    # Also check recommended (P3) items
    ./check-required-items.sh /path/to/your-project --include-recommended
    # Also show items with no hits and items without an automatic pattern
    ./check-required-items.sh /path/to/your-project --verbose
    # Also save the report as a Markdown / HTML file
    ./check-required-items.sh /path/to/your-project --output=report.md
    ./check-required-items.sh /path/to/your-project --output=report.html --include-recommended
    Hit item numbers (#n) correspond to the same numbers in the quick-reference table at the bottom of solution.html and in versions.html / 改修点-優先順.html. The patterns are simple ones generated automatically from function and constant names, so make the final decision by looking at the actual code. All hit files are listed without omission; with --output, the report is also saved to a file in the given format (detected from the extension) in addition to the terminal output. In case the window closes immediately (e.g. when run by double-click), the script pauses for the Enter key when it finishes.
  3. Use automated refactoring tools: rector/rector has upgrade rule sets for each PHP version (Php74, Php80 … Php84) that automate most mechanical fixes, such as unparenthesized ternaries, ${var} interpolation and making nullable parameters explicit. Run Rector in dry-run mode first and fix by hand only the differences it cannot fix automatically; this saves a lot of time.
  4. Find "silent behavior changes" with static analysis: run PHPStan/Psalm at the highest level to detect, in advance, the P1 items that "raise no error but change the result" (comparison operators, type conversions, etc.).
  5. Run staging on PHP 8.5.12 with full error display: when upgrading in one jump, the P0 fatal errors appear all at once at the start, so use the settings below to find them early.
    php.ini (test environment only)
    display_errors = On
    error_reporting = E_ALL
    log_errors = On
    error_log = /var/log/php_migration_errors.log
  6. Inventory your extensions: check the extensions currently loaded with php -m; if you use extensions removed from the core bundle in 8.0, such as xmlrpc, plan to reinstall them via PECL.
P0 Fatal error Processing stops with a fatal error (Fatal/TypeError/ValueError) if left as is. P1 Unstable result The result changes silently without any error. Hard to notice as a bug. P2 Other required Does not fit P0/P1, but officially listed as required (Backward Incompatible). P3 Recommended Deprecated. Still works today but scheduled for removal.

We recommend addressing every item in order starting from P0, rather than skipping by priority.

P0 — Fatal errors (will not run as is)

P1 — Unstable results (behavior changes silently)

P2 — Other required changes (required, but not P0/P1)

P3 — Recommended (deprecated, still works)

Reference: quick-reference table of all items (no sample code, 535 items)

The roughly 105 items above are a selection of "especially high-impact or easy to miss" changes. This table lists every item in versions.html, including ones that are low priority on their own such as compact(). If your code does not use the function or syntax in question, no action is needed.

P0 Fatal error — processing stops at runtime with a Fatal Error / uncaught exception (- items) P1 Unstable result — no error, but the result changes or becomes unstable (a breeding ground for hard-to-spot bugs) (- items) P2 Other required — does not fit the above, but officially listed as required (Backward Incompatible) (- items) P3 Recommended — deprecated. Still works today but scheduled for removal (- items)

* P0–P3 is a rough guide determined automatically from keywords in each item's (Japanese) description. The actual risk depends on how your code uses the feature, so treat it as a reference only. We recommend addressing every item starting from P0.

Filter by target version:
#VerPriorityTypeFeature / functionDetails