8 Commits
Author SHA1 Message Date
dualfroz 98e2fac9c1 fix: truncate URI Template prefix modifier by character, not byte (#192)
Operator::inject() applied the ":N" prefix modifier with the
byte-oriented substr(), splitting multibyte UTF-8 characters in half
and producing invalid percent-encoded output (e.g. the euro sign
truncated to its first byte only).

RFC 6570 Section 2.4.1 defines the prefix length as a count of
characters, so use mb_substr() with an explicit UTF-8 encoding
instead. ext-mbstring is already a hard dependency of this package.
2026-09-06 06:07:07 +02:00
upstream 0a2c361a43 Upstream thephpleague/uri-src state of the touched files before 3ad4f269f2 2026-09-06 06:07:07 +02:00
dualfroz 2f4f2d71c4 Percent encode the URI template literals as per RFC6570 section 3.1
Template::expandAll swapped every expression notation in the raw template
string with str_replace, so the literal text surrounding the expressions was
copied verbatim and never percent encoded. The expression detection pattern is
now used to split the template into an ordered list of parts: literals are
encoded once at construction, expressions stay Expression objects, and the
expansion simply concatenates them. Keeping the parts apart is what prevents
the already encoded expansion results from being encoded a second time.

Fixes the "Additional Examples 8: Literal Encoding" case of the vendored
uritemplate-test compliance suite.
2026-09-04 08:43:47 +02:00
upstream 432904515e Upstream thephpleague/uri-src state of the touched files before dc0df9e387 2026-09-04 08:43:47 +02:00
dualfroz e39d486924 Percent encode the URI template literals as per RFC6570 section 3.1
Template::expandAll swapped every expression notation in the raw template
string with str_replace, so the literal text surrounding the expressions was
copied verbatim and never percent encoded. The expression detection pattern is
now used to split the template into an ordered list of parts: literals are
encoded once at construction, expressions stay Expression objects, and the
expansion simply concatenates them. Keeping the parts apart is what prevents
the already encoded expansion results from being encoded a second time.

Fixes the "Additional Examples 8: Literal Encoding" case of the vendored
uritemplate-test compliance suite.
2026-09-06 00:58:45 +02:00
upstream cb44762108 Upstream thephpleague/uri-src state of the touched files before 6b1d90a020 2026-09-04 08:43:47 +02:00
dualfroz c0b6c4bc5f fix: truncate URI Template prefix modifier by character, not byte
Operator::inject() applied the ":N" prefix modifier with the
byte-oriented substr(), splitting multibyte UTF-8 characters in half
and producing invalid percent-encoded output (e.g. the euro sign
truncated to its first byte only).

RFC 6570 Section 2.4.1 defines the prefix length as a count of
characters, so use mb_substr() with an explicit UTF-8 encoding
instead. ext-mbstring is already a hard dependency of this package.
2026-09-04 08:23:31 +02:00
upstream 2c92ab421c Upstream thephpleague/uri-src state of the touched files before 11370c055f 2026-09-04 08:23:31 +02:00