Talk to an engineer

Backporting a fix without changing behavior

Why a patch that alters how your application behaves is an upgrade in disguise, and the rules we hold ourselves to.

SeaPHP engineering · March 11, 2026

When a vulnerability is disclosed against a PHP release we support, the fix already exists. Upstream wrote it, on a newer branch, against code that has moved on considerably from the version our customers run. The work is transplanting it without bringing anything else along.

The constraint

A customer on an end-of-life release chose that position because upgrading is expensive right now. If our patch changes behavior, we have handed them a smaller upgrade instead of a security fix. They still have to regression-test the application, still have to schedule a release, still have to take the risk. The value evaporates.

So the rule is simple to state and occasionally painful to follow: the observable behavior of correct code does not change. Only the vulnerable path does.

What that rules out

Upstream fixes are written for the current branch, where the surrounding code may have been refactored several times since our supported version. A direct cherry-pick often pulls in:

  • Refactors that touch adjacent code paths
  • New internal APIs the fix depends on
  • Stricter validation that also rejects input the old version accepted
  • Performance changes bundled into the same commit

The last one is the sneakiest. A fix that also makes something faster looks like a bonus until a customer's application depended on the old ordering.

How the work actually goes

Each backport gets analyzed down to the specific change that closes the vulnerability, separated from everything the commit brought with it. That minimal change is then re-implemented against the older code, which sometimes means writing it differently because the structures it assumed do not exist yet.

Then it is tested three ways: the upstream test case for the vulnerability, the full extension matrix for the release, and a regression suite built from the behaviors that the supported version guarantees.

When behavior has to change

Sometimes it cannot be avoided. If a vulnerability exists because the old version accepted input it should have rejected, then closing it means rejecting that input. There is no version of that fix which preserves the behavior.

In those cases the change is documented explicitly in the advisory, what changes, which inputs are affected, and what an application that depends on the old behavior should do instead. Customers can then decide when to apply it. That is a worse outcome than a transparent patch, and it is why we go to some trouble to make it rare.

Why the discipline matters

Support for an old release is only worth having if applying it is routine. The moment a security update becomes something that needs a testing cycle, customers start deferring them, and deferred security updates are the problem we were hired to solve.

Find out what your PHP estate needs

Tell us which versions you run and where. An engineer replies within one business day.