Skip to main content

CodeIgniter 4.7.6

Release Date: November 1, 2026

CodeIgniter 4.7.6 landed on November 1, 2026, and unlike the patch releases that came before it, this one is almost entirely a security drop. Four advisories are fixed in a single update, including a SQL injection in named query bindings and a mass assignment hole in Model::replace(). If your application passes anything user-supplied into named binds or into replace(), this is a same-day upgrade.

Verdict First

Patch now. There are no new features to weigh, no deprecations to plan around, and no performance work to benchmark. The changelog lists four security fixes, fourteen bug fixes, and two internal refactors. The upgrade itself is a version bump plus a short read of the 4.7.5 to 4.7.6 upgrade notes.

The Four Security Fixes

  • SQL injection in named bindings (GHSA-25rf-99hr-7pmr). The most serious item. When a query mixed named binds (:name:) with a value that had already been escaped and rendered into the SQL string, a placeholder inside that value was replaced with the bind of the same name. That let an attacker break out of a string literal. Affected paths include subqueries passed to where(), union(), fromSubquery() and selectSubquery(), custom where() strings built with $db->escape(), the WHERE binds of deleteBatch(), and manually escaped fragments in $db->query(). Placeholders are now ignored inside quoted strings, quoted identifiers and SQL comments, and deleteBatch() substitutes its WHERE binds only after the batch data is rendered. Plain where(), like(), insert() and update() calls were never affected.
  • Mass assignment in Model::replace() (GHSA-jv74-fx4h-m63x). With field protection enabled, replace() now discards fields that are not listed in $allowedFields while keeping a supplied primary key. Input that gets filtered down to nothing, or down to only the primary key, now throws a DataException. Before this patch, untrusted input could write protected columns straight through replace().
  • Path traversal in sanitize_filename() (GHSA-9j59-qcxw-q7qm). Backslashes were only stripped by a final stripslashes() call, so with $relativePath set to true an input like .\./ collapsed into ../ on every platform. Repeated backslashes could also survive as Windows separators, and a \0 sequence could turn into a NUL byte. Backslashes are now removed during filtering, stripslashes() is gone, and forward slashes are still preserved in relative-path mode. The same change applies to Security::sanitizeFilename().
  • Cache handler file deletion (GHSA-9hf2-g3w9-pfmp). FileHandler::deleteMatching() matched its pattern against full paths, so a pattern such as ../* could delete files outside the cache directory. Matching is now limited to cache file names, patterns no longer reach into subdirectories, and characters like [ in the cache path are no longer treated as pattern syntax. Files living in subdirectories of the cache directory are no longer removed by a delete-matching call.

How I Upgraded

  1. Bumped the framework constraint: composer require codeigniter4/framework:^4.7.6.
  2. Read the Upgrading from 4.7.5 to 4.7.6 notes, which cover the three migration points: cache delete-matching, named binds, and replace() filtering.
  3. Grepped for ->replace( calls that pass request data. Anything writing a field outside $allowedFields now throws instead of silently persisting, so a model with a tight allow-list can start failing where it used to work. That is the intended behavior, but it needs a test.
  4. Grepped for deleteMatching( with wildcard patterns that expected to reach nested cache folders. Those patterns now do nothing.
  5. Ran the suite, then deployed. No configuration changes were needed.

Bug Fixes Worth Knowing

  • JSON bodies survive CSRF filtering. The request body is preserved when the CSRF token is not inside it, which unblocks JSON APIs sitting behind CSRF protection.
  • MySQL deadlocks no longer break transactional writes. Writes stay transactional after error 1213, and reconnect() clears transaction state when it swaps the socket.
  • Proxy detection is case-insensitive. isSecure() now detects X-Forwarded-Proto regardless of header casing.
  • Content Security Policy fixes. setDefaultSrc() handles arrays correctly, a new addDefaultSrc() method was added, addOption() normalizes string values and keys, and reportOnly() applies to config sources set after construction.
  • Uploads and request bodies. Requests are read correctly when post_max_size is unlimited, and CURLRequest no longer assigns an invalid string to CURLOPT_HTTPHEADER.
  • Negotiation edge cases. Media ranges without a subtype are ignored, and wildcards no longer select values excluded with q=0.
  • Smaller items. Unserializing Time restores timezone, locale and string format; route group callbacks keep subclass types; CLI::promptByMultipleKeys() rejects missing keys; CLI prompts stop looping when input ends; XMLFormatter handles invalid values and empty tag names; set_value() accepts a wider range of defaults; generated imports sort correctly with CRLF line endings; REQUEST is refreshed after URI GET normalization.

If You Are Still on 4.7.4

You get two security releases in one move. Version 4.7.5 (October 9, 2026) fixed a credential leak in CURLRequest where per-request headers, body and options survived a failed request, plus file validation gaps that let a GIF/PHP polyglot named like shell.php.gif pass is_image, mime_in and ext_in. Both are inside 4.7.6, so jumping straight there covers everything.

The full diff is on GitHub between tags v4.7.5 and v4.7.6, and each advisory has its own GHSA page with technical detail. Given the SQL injection fix, there is no good reason to sit this one out.

Other Versions

We use cookies for ads and analytics.