php-sdk/tests/Unit
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Dev 206aa9da52
[Schema] Fix Implementation::fromArray rejecting falsy-but-valid name/version (#393)
* [Schema] Fix Implementation::fromArray rejecting falsy-but-valid name/version

`empty()` treats the string "0" as empty, so a valid clientInfo/serverInfo
with `"version": "0"` (or `"name": "0"`) was rejected with an
InvalidArgumentException. During initialize this aborted request parsing and
surfaced as a misleading "A valid session id is REQUIRED" error.

Replace the `empty()` guards with explicit isset/is_string/empty-string checks
so genuinely missing, non-string, and empty values are still rejected while
"0" is accepted. Adds ImplementationTest covering the regression and the
existing validation paths.

Fixes #392

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* [Schema] Suppress PHPStan argument.type on invalid-input tests

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 23:41:51 +02:00
..
Capability [Server] Allow pre-built instance handlers in element registration (#375) 2026-07-06 01:13:41 +02:00
Fixtures/Enum Split testsuite for unit and inspector based tests (#82) 2025-09-25 22:27:41 +01:00
JsonRpc [Server] Harden JSON-RPC input parsing against malformed input and resource exhaustion (#383) 2026-07-06 00:10:13 +02:00
Schema [Schema] Fix Implementation::fromArray rejecting falsy-but-valid name/version (#393) 2026-07-14 23:41:51 +02:00
Server [Server] Allow pre-built instance handlers in element registration (#375) 2026-07-06 01:13:41 +02:00
ServerTest.php Update codestyle based on updated Symfony rules (#229) 2026-02-01 11:54:31 +01:00