#4932: the picker's two-character floor counts characters, not bytes

VERIFY #4932's named red — test_a_single_non_ascii_letter_is_still_a_one_
character_query — stood: searchUsers() guarded with strlen($q) < 2 under a
comment that calls the floor "two characters". A single Ł, É, ü or a CJK
surname is one letter and two or three bytes, so one keystroke cleared the
byte floor and answered with full chip rows — the directory spill the floor
exists to prevent, on exactly the names a school has the most trouble typing.

mb_strlen, matching admin.settings.users.search (the endpoint this picker's
row shape is keyed against), which answers [] for the same query. The
verifier's test is carried onto this branch so the fix lands with its proof.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
central-worker-3
2026-10-20 07:28:24 -07:00
parent a977aedc95
commit 8b4f788e43

View File

@@ -511,8 +511,12 @@ class TicketingSettingsController extends Controller
$q = trim((string) $request->input('q', '')); $q = trim((string) $request->input('q', ''));
// Two characters, like every other picker on the platform: one letter // Two characters, like every other picker on the platform: one letter
// is most of the directory, and the dropdown is ten rows. // is most of the directory, and the dropdown is ten rows. Counted in
if (strlen($q) < 2) { // CHARACTERS, like admin.settings.users.search, not bytes: an accented
// letter is two bytes and a CJK surname is three, so a byte floor lets
// a single keystroke answer with the directory on exactly the names a
// school has the most trouble typing.
if (mb_strlen($q) < 2) {
return response()->json([]); return response()->json([]);
} }