Last week we told Laravel 12 users to keep request data out of Concurrency::run() tasks, because the fix only existed in 13.40. That workaround can go now.
Laravel 12.71.0 ships the same signed result envelope. It’s the only patch-level release we collected this week, and it’s a short read with one clear action: update.
TL;DR
- Laravel 12.71.0 backports #62297 from 13.40. Each concurrent task signs its result with a per-task key, and the parent only unserializes a frame with a valid signature.
- In our lab, a task that printed a forged result came back as
'forged'on 12.70.1 and as its real return value on 12.71.0. - Normal
echooutput inside a task no longer crashes the parent with “Trying to access array offset on null”. - No code changes. Run
composer update laravel/frameworkand check you’re on 12.71.0.
The week at a glance#
| Package | Version | Released (UTC) | Should you hurry? |
|---|---|---|---|
laravel/framework (12.x line) | 12.71.0 | Nov 3 | Yes, if you use Concurrency with the process driver |
Nothing else in the watched packages had a patch release this week. Inertia 3.11 and Laravel 13.40 were feature releases, so they got full posts, linked in In case you missed it.
Laravel 12.71.0: signed Concurrency results#
Concurrency::run() with the default process driver serializes each closure, starts a child php artisan process and reads the result back from that child’s stdout. The parent then calls unserialize() on it.
The problem was that your task’s own output goes to the same stdout. Up to 12.70.x, the parent cut the output at the first gzip magic bytes (\x1f\x8b) and decoded the JSON it found there. A task that printed text an attacker controls could print a fake result, and your web process would unserialize it.
The 12.x port (commit 0f90494) copies the 13.x change line for line:
- The parent creates a random 32-byte key per task and passes it in
LARAVEL_CONCURRENCY_HMAC_KEY. - The child removes that variable from
$_SERVER,$_ENVandgetenv()before running your closure, so your code can’t read it. - The child writes its result as a base64 frame between
@@LARAVEL-CONCURRENCY-V1@@markers, signed with HMAC-SHA256. - The parent scans from the end of the output and accepts only a frame whose signature matches. If none does, it throws a
RuntimeExceptionwith the first 200 characters of the output.
What we saw in the lab#
We ran the same three tests on 12.70.1 and then on 12.71.0. The tasks are plain closures like this one:
public static function forgedWithGzipMarker(): \Closure
{
return static function () {
// Forged JSON followed by the gzip bytes the old parser cut at
echo json_encode(['successful' => true, 'result' => serialize('forged')])."\x1f\x8b";
return 'real';
};
}| Task prints | 12.70.1 | 12.71.0 |
|---|---|---|
A forged JSON result, then returns 'real' | Crash: “Trying to access array offset on null” | 'real' |
A forged frame with a bad signature, then returns 42 | Crash: same error | 42 |
A forged result followed by \x1f\x8b, then returns 'real' | 'forged' | 'real' |
Two progress lines, then returns ['rows' => 3] | Crash: same error | ['rows' => 3] |
The first and last rows matter even if you never worried about attackers. On 12.70.x, any echo inside a task broke the result. On 12.71.0, progress output is simply ignored.
Heads up: Only the process driver changed
The diff touches ProcessDriver and the invoke-serialized-closure command, nothing else. The sync driver never went through stdout, so it behaves the same as before.
Update and check#
composer update laravel/framework
php artisan --version # Laravel Framework 12.71.0If you pinned the workaround from our Laravel 13.40 post (switching a task to the sync driver, or removing output from it), you can undo it after the update.
Try it yourself
Add this test to a Laravel 12 app, run it on your current version, then again after the update:
use Illuminate\Support\Facades\Concurrency;
it('ignores output a task prints', function () {
[$result] = Concurrency::driver('process')->run([
static function () {
echo json_encode(['successful' => true, 'result' => serialize('forged')])."\x1f\x8b";
return 'real';
},
]);
expect($result)->toBe('real');
});On 12.70.x it fails with 'forged'. On 12.71.0 it passes.
In case you missed it#
Four posts went out since last Monday’s roundup:
| Post | In one line |
|---|---|
| Inertia 3.11 live props: real-time Vue pages with Reverb | Props that refresh themselves when the server broadcasts a change |
| Laravel 13.40: slow job alerts, middleware insertBefore() and strict input | Queue::whenJobRunsLongerThan(), $middleware->insertAfter(), strict: true casting and the 13.x side of this fix |
| Laravel once(): memoize anything per request in one line | Cache an expensive call for the rest of the request |
| Laravel Http::pool(): call three APIs in the time of one | Concurrent HTTP calls without a queue |
Upgrade notes#
- Laravel 12: update to 12.71.0 if you use
Concurrency::run()with theprocessdriver. No code changes, no config changes. - Laravel 13: you already have this fix if you’re on 13.40.0 or later.
- If a task’s output used to break
Concurrency::run()and you worked around it, the workaround is no longer needed.
Recap#
- Laravel 12.71.0 brings the signed Concurrency result envelope from 13.40 to the 12.x line.
- A task’s own output can no longer forge the value the parent unserializes, and plain
echooutput no longer crashes the parent. - Update with
composer update laravel/framework; nothing else changed in the watched packages this week.
FAQ#
Am I affected if I never call Concurrency::run()?
No. The change only touches the process driver of the Concurrency component. If you never use Concurrency, 12.71.0 changes nothing for you, but it is still a safe update.
Does Concurrency::defer() need this?
No. defer() starts the child processes in the background after the response is sent and never reads their output, so there is no result to forge. It is unchanged in 12.71.0.
Can my task code read LARAVEL_CONCURRENCY_HMAC_KEY?
No. The child process removes the variable from $_SERVER, $_ENV and getenv() before it runs your closure.
What happens if a child process prints no valid frame at all?
The parent throws a RuntimeException that says the process did not return a valid result envelope and shows the first 200 characters of its output.
Next steps#
- Load slow dashboard queries in parallel with Concurrency::run()
- Laravel 13.40: slow job alerts, middleware insertBefore() and strict input
- Laravel docs: Concurrency



