News

PHP 8.6 and ruby2shell: a new PHP, security fixes and an urgent Ruby update

PHP 8.6 adds partial function application, clamp() and a Duration class, while PHP and Ruby patch critical flaws. What it means if you are learning to code.

CodeWorlds Editorial
PHP 8.6 and ruby2shell: a new PHP, security fixes and an urgent Ruby update
  • Cloudflare
  • Claude
In this article5

On Thursday, November 19, the PHP team shipped PHP 8.6.0 together with 8.5.13, 8.4.28, 8.3.37 and 8.2.36, which fix a critical flaw called phpAfterShell. The same week Ruby got fixes for ruby2shell, a bug that default Rails apps hit before any login check runs. Saturday, November 21 was quiet, so this roundup covers the most important stories of the last three days.

PHP 8.6: partial function application, clamp() and Duration

The PHP 8.6 announcement describes a major language update. The headline feature is partial function application. You pass some of the arguments and put ? or ... where the rest should go. PHP then returns a Closure that waits for the missing values. Instead of writing fn ($v) => version_compare($v, '8.6', '>=') you can write version_compare(?, '8.6', '>=').

The feature you will probably use first is clamp(). It keeps a value inside a range: clamp(110, 0, 100) returns 100 and clamp(-10, 0, 100) returns 0. Until now people wrote max(0, min($x, 100)), and it was easy to get the order wrong.

The new \Time\Duration class represents elapsed time independently of any timezone, with nanosecond precision and a range of more than 250 years. It fits timeouts and benchmarks, where code today passes around integers in microseconds with a comment saying which unit they are in. There is also a SortDirection enum with Ascending and Descending cases, so libraries no longer need to invent their own constants for sort order.

Smaller changes worth knowing

  • Io\Poll watches many streams at once through epoll, kqueue, event ports or WSAPoll. The old stream_select() usually cannot handle more than 1024 connections. The new API is meant as a base for event loop libraries such as ReactPHP and AMPHP.
  • readonly properties can now declare a default value instead of setting it in the constructor.
  • Stream operations can throw a StreamException instead of emitting warnings that people used to silence with @.
  • A new mysqli::quote_string() method works like PDO::quote().

The deprecation list is short, but read it before upgrading: return inside a finally block is now deprecated, and so is returning a value from __construct(). The mb_ereg() and mb_split() functions are deprecated too, because the Oniguruma library behind them is no longer maintained.

phpAfterShell: why the upgrade is urgent

Versions 8.5.13, 8.4.28, 8.3.37 and 8.2.36 are security releases, and the PHP home page asks every user of those branches to upgrade. The most serious fix is for phpAfterShell (CVE-2026-126714), which the security company depthfirst disclosed on November 19. According to Cloudflare's analysis, it scores 9.2 out of 10 under CVSS 4.0, and the same releases fix 16 other vulnerabilities, six of them also critical.

The bug lives in the default file-based session handler. If a session write gets interrupted, the session file can hold the start of the new data followed by the end of the old data. On the next request PHP deserializes that mix, which under the wrong conditions leads to code execution. PHP's advisory says the problem has existed since PHP 4.1.0 and suggests turning off session.upload_progress.enabled as a stopgap if the application does not need it.

What this means if you are learning to code

PHP is not part of the CodeWorlds curriculum, but the ideas in 8.6 show up in other languages too. Partial application is the same idea as bind() and functions that return functions in JavaScript. If you want to understand it properly, work through the chapters on functions in the JavaScript and TypeScript course or check the JavaScript docs. JavaScript has no built-in clamp(), which makes it a nice exercise: write one yourself in three lines.

The bigger lesson this week is about security. PHP and Ruby shipped fixes in the same week, and both bugs sit in everyday features: sessions and changing the case of a string. You do not need to understand buffer overflows to take the point: update your runtime, not just your npm or Composer packages. If you write a backend, for example in the NestJS course, check which Node.js version your Docker image uses and when it was last rebuilt. Web application firewalls such as Cloudflare buy you some time, but they do not replace the upgrade.

Also today

  • ruby2shell in Ruby. CVE-2026-132825 is a one-byte heap overflow when Ruby changes the case of strings in older single-byte encodings (the German ß becomes SS). Rails and classic Sinatra reach it in their default setup before any authentication; the fixes are in Ruby 3.3.14, 3.4.13 and 4.0.10. Cloudflare
  • Seven Ruby flaws in one release. Ruby 4.0.10, 3.4.13 and 3.3.14 fix seven bugs in total, in the regular expression engine and in string case conversion. The Ruby team says it knows of working exploits for some of them. Ruby
  • GPGME 2.3.1 fixes a double free. An OpenPGP key with a very long user id can trigger CVE-2026-129975, and remote code execution cannot be ruled out. Disclosure moved from November 25 to November 20 because of ruby2shell. GnuPG
  • Inkling 2 Mini for coding on a laptop. Thinking Machines released open weights for a mixture-of-experts model with 26.4 billion parameters (3.4 billion active) that needs about 20 GB of memory. On the DeepSWE v1.1 agentic coding benchmark it solved 48.2% of tasks. Thinking Machines
  • Claude Code 2.1.330. The new version of the Claude Code agent can sign in to organizations managed in the Enterprise Admin Console and adds easel, a built-in mod that draws charts on request. GitHub
  • DreamCoder from the author of Mastering Emacs. After 15 months of work, Mickey Petersen released an AI coding tool that runs in the browser and tiles its windows, instead of keeping everything in a terminal. Mastering Emacs

Frequently asked questions

What is new in PHP 8.6?

The main additions are partial function application with ? and ... placeholders, the clamp() function, the \Time\Duration class, the SortDirection enum, the Io\Poll API and default values for readonly properties. The full list is in the release announcement on php.net.

Do I need to update PHP if I am not moving to 8.6?

Yes, if you run the 8.2, 8.3, 8.4 or 8.5 branch. Versions 8.2.36, 8.3.37, 8.4.28 and 8.5.13 fix phpAfterShell and other critical flaws, so updating within your branch is enough.

Which Ruby versions does ruby2shell affect?

Ruby 3.3.13 and earlier, 3.4.0 through 3.4.12, and 4.0.0 through 4.0.9. Ruby 3.2 and older have reached end of life and will not get the fix, so you need to move to a newer branch.

Sources


This article was prepared with the help of AI from primary sources and reviewed by the CodeWorlds editorial team.