php-sdk/tests/Unit
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Antoine Bluchet 9aa18f391a
Merge commit from fork
processInput() called fgets($this->input) with no length argument. PHP
fgets() reads until a newline or EOF, so a peer that streams bytes
without ever sending a newline forced the whole stream into a single
allocation and exhausted the process memory limit (GHSA-vm75-qjc7-xh6w).

Bound each read with fgets($this->input, $this->maxLineBytes) (default
4 MiB, configurable via the constructor). When a read fills the cap with
no trailing newline the line exceeds the limit: discard it and keep
discarding one bounded chunk per tick until its terminating newline,
rather than buffering it. The discard is stateful so the run loop keeps
servicing fibers and outgoing messages instead of blocking on a drain
loop, and the over-length line is logged once.

Reimplements tonghuaroot's advisory fix: makes the cap configurable
rather than a hardcoded constant, drains the over-length line without an
inner blocking loop (responsive run loop, single log line), and adds
regression tests.

Co-authored-by: tonghuaroot <23011166+tonghuaroot@users.noreply.github.com>
2026-07-27 11:50:31 +02:00
..
Capability [Server] Always emit items for array tool parameter schemas (#378) 2026-07-14 23:56:50 +02:00
Client Merge commit from fork 2026-07-27 11:16:14 +02:00
Fixtures/Enum Split testsuite for unit and inspector based tests (#82) 2025-09-25 22:27:41 +01:00
JsonRpc [Client] Add client-side elicitation support (#371) 2026-07-14 23:55:06 +02:00
Schema [Schema] Fix Implementation::fromArray rejecting falsy-but-valid name/version (#393) 2026-07-14 23:41:51 +02:00
Server Merge commit from fork 2026-07-27 11:50:31 +02:00
ServerTest.php Update codestyle based on updated Symfony rules (#229) 2026-02-01 11:54:31 +01:00