PHP Security Release, July 2026: 8.2.33 to 8.5.9

PHP security release July 2026: patch to 8.2.33, 8.3.33, 8.4.24 or 8.5.9 now, then confirm the binary serving traffic is the new one.

Maysan Engineering Team · · 5 min read

Xin

PHP published security releases 8.2.33, 8.3.33, 8.4.24 and 8.5.9, closing two separate bugs: a high-severity SQL injection in ext-pgsql tracked as CVE-2026-17543, and an out-of-bounds write in bccomp() inside ext-bcmath tracked as CVE-2026-17544. You are in scope if your application passes user-supplied values to the pg_insert(), pg_update(), pg_select() or pg_delete() helpers, or passes untrusted operands and scales into bccomp(). The fix is to move each branch to its patched release, then confirm that the new binary — not the old one — is the thing serving requests.

What the July 2026 PHP security release actually contains

It is a security-only patch batch across four supported branches, and both advisories were published on 30 July 2026.

GHSA-7qpv-r5mr-78m4 in php/php-src covers the ext-pgsql injection and is rated high severity. GHSA-x692-q9x7-8c3f covers the ext-bcmath out-of-bounds write. Every php.net release note in this batch uses the same wording — this is a security release, and all users of that branch are encouraged to upgrade — which is the polite way of saying there is no feature work to weigh against the risk of waiting. PHP 8.6.0 Alpha 3 also appeared in the same window, for testing only; the release note explicitly says not to use it in production, so it is not the answer to this advisory.

Am I affected? Check two extensions, not your framework

Two extensions carry the fixes, and the release you need depends on your minor branch, so check what the hosts actually load rather than what your composer.json assumes.

  • ext-pgsql: patched in 8.2.33, 8.3.33, 8.4.24 and 8.5.9. Anything below the release matching your branch is in the vulnerable range.
  • ext-bcmath: patched in 8.4.24 and 8.5.9. The advisory does not list an 8.2 or 8.3 fix for this one.
  • Neither extension enabled: run php -m on the box. If neither is listed, neither advisory applies to that host.

The pgSQL advisory scopes the injection to the helpers that convert and escape user-provided parameters — pginsert(), pgupdate(), pgselect() and pgdelete() as the advisory names them. bccomp() is the bcmath comparison function, the kind of thing that quietly sits behind currency and quantity maths in billing and inventory code. If you run on a managed host or a panel that allows per-vhost PHP versions, check every version string, not just the account default.

What the pgSQL bug actually does

The injection comes from a mismatch between how a value is escaped and how it is then wrapped in an E'...' string constant.

phppgsqlconvert() escapes user-provided parameters using PQescapeStringConn(), and phppgsqladdquotes() then wraps that result in E'...'. With standard_conforming_strings on — the PostgreSQL default since 9.1 — PQescapeStringConn() does not escape the backslash, because a backslash is not special inside an ordinary string literal. Inside E'...' it is. The function does escape a single quote as two single quotes, so an attacker who supplies a backslash can break out of the first half of that doubled pair, terminate the string early and inject SQL. The advisory notes the same gap in pgselect(), which doubles the quote but leaves the backslash alone.

What to do in the next 24 hours

Upgrade every PHP runtime on the affected branch, then prove — rather than assume — that the patched binary is the one handling traffic.

  • Pin the patched release in your images and package pins: 8.2.33, 8.3.33, 8.4.24 or 8.5.9.
  • Upgrade the CLI binary and every FPM pool separately. They are frequently built from different sources on the same machine.
  • Restart php-fpm and the web server. Long-lived workers and a warm opcache will otherwise keep executing the old code.
  • Verify in three places: php -v on the host, phpversion() from a route your application actually serves, and the image tag recorded in your deploy manifest. The first two disagree more often than anyone expects.
  • Grep for pginsert, pgupdate, pgselect, pgdelete and bccomp, and trace whether request parameters reach them.
  • After the restart, watch PostgreSQL logs for syntax errors on statements that normally run clean, php-fpm error logs for new warnings, and WAF hits containing E'...' patterns in request bodies.

Where AI-assisted review changes this bug class

Neither advisory says how these bugs were found, so treat AI review as a workflow change rather than a detective story.

The pgSQL bug is taint flow plus a semantic mismatch: two functions that are each defensible and wrong in combination. An AI reviewer handed the path from request parameter to query can flag exactly that shape — an escaping routine that does not cover the literal syntax used downstream — which is hard to hold in a human head across four helper functions. The bcmath bug is arithmetic on lengths: scale truncates the number, trailing zeros get trimmed, strscale is decremented and fractionalend is not adjusted, and the string is later populated using both. Asking a model to walk bcstr2num() and list every place a length is changed against every place it is consumed is a cheap, useful first pass. The catch is that models invent function names and miss call sites, so pair the review with fuzzing of bccomp() scale and operand values, and with a test that asserts your generated SQL still parses.

Where to start

Run php -m first; that one command tells you whether this release is your problem at all. If both extensions are loaded, patch and verify before the weekend, and read the query-building code that wraps user input in pg_insert() and its siblings. When we take on this sort of hardening work, we start with the same inventory — if you want a second pair of eyes on the upgrade path or the database access layer, our team covers it under servers and infrastructure.

Buying software or a website?

Twelve questions to ask any vendor before you sign: price, your data, fit for an Indian business and support.

Get the free checklist

Written by Maysan Engineering Team at Maysan Labs, a software studio in Gurgaon, India. Follow us on LinkedIn