Repository navigation
fix(api): не отдавать пустое тело менеджерского API при битом UTF-8 - #676
Merged
Merged
Conversation
Prevent empty connector bodies when xPDO::toJSON hits invalid UTF-8 by reusing Response substitute/logging before success()/failure().
5 tasks
5 of 16 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Описание
Менеджерский connector путь (
ProcessesManagerConnectorRouteTrait→success()/failure()→xPDO::toJSON) при невалидном UTF-8 отдавал пустое тело:json_encodeбез флагов возвращалfalse,die(false)печатал пустую строку.До передачи в процессор данные проходят через
Response::sanitizeUtf8ForJson()(тот же log +JSON_INVALID_UTF8_SUBSTITUTE, что у витринного#662). При невозможности кодирования (например NAN) — fail-closed 500 с непустым JSON.Тип изменений
Связанные Issues
Closes #671
Связано: #654, #662, #618, #619
Как это было протестировано?
Покрыто: substitute битого UTF-8, identity для валидных данных, null на NAN, путь
respondFromRouter→ barejson_encodeкак уxPDO::toJSON, fail-closed 500.composer ci:php/composer test,npm run lint:ci,composer stan/ GitHub Actions CI)Конфигурация тестирования:
fix/issue-671-manager-utf8-jsonСкриншоты (если применимо)
Чеклист
composer stan/ CI jobPHPStan)npm run lint:ciдля Vue)Дополнительные заметки
Лексиконы и Vue не затронуты. CHANGELOG оставляем на релиз. Витринный путь (
encodeJsonBody/api.php) без изменений контракта, общая логика вынесена вencodeJsonSubstitutingUtf8.