Skip to content

Remove workarounds for PHP bugs in versions that are no longer supported #40244

@SilinMykola

Description

@SilinMykola

Summary

As discussed in issue #39362, we should remove legacy workarounds for PHP bugs that applied only to unsupported PHP versions. This follow-up was suggested by @ihor-sviziev in this comment
— “Maybe worth fixing them as well.”

Reference search for candidates: GitHub code search.

Scope

  • Identify code that references historical PHP engine bugs (e.g., links to bugs.php.net, comments like “PHP bug …”, conditional branches for old PHP versions, polyfills/workarounds that targeted those bugs).
  • Remove such workarounds only if they are relevant exclusively to PHP versions outside Magento’s currently supported matrix.
  • Keep behavior and public APIs intact for supported PHP versions.

Out of scope

  • Removing fixes that are still required for supported PHP versions.
  • Broad refactors unrelated to obsolete PHP bug workarounds.

Examples

Class lib/internal/Magento/Framework/Session/SaveHandler/Native.php was only created to fix the bug https://bugs.php.net/bug.php?id=71187
And this is actual for PHP Version 7.0.1

Proposed solution

  1. Use the search query above to compile a list of candidate classes/files.
  2. For each candidate:
    • Verify the original PHP bug and affected versions.
    • Confirm that the affected versions are not supported by current Magento releases.
    • Remove the workaround path or entire helper/polyfill if it existed solely for that bug.
  3. Add/adjust unit and integration tests to cover the code paths that remain.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions