Keep legacy connector JSON valid on broken UTF-8 - #691
Open
Ibochkarev wants to merge 2 commits into
Open
Conversation
Legacy processors died with an empty body because xPDO::toJSON has no UTF-8 fallback. Install one connector response so every processor on connector.php shares the same sanitize-or-fail-closed path.
Superglobals always exist, so isset() on $_POST/$_GET/$_FILES is dead. json_encode does not return an empty string when it succeeds.
Ibochkarev
force-pushed
the
fix/issue-689-legacy-utf8
branch
from
September 9, 2026 13:34
938e807 to
fad2564
Compare
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.phpуходили вxPDO::toJSON()без UTF-8 fallback и при битой последовательности отдавали пустое тело с кодом 200.Решение: одна точка выхода.
connector.phpставитUtf8SafeConnectorResponseдоhandleRequest(). Все процессоры, в том числе новые, проходятResponse::encodeConnectorJson(): невалидный UTF-8 заменяется на U+FFFD, иначе ASCII-конверт 500. Процессоры поштучно не трогаем.Маршрутизируемый путь (
ProcessesManagerConnectorRouteTrait, #676) не убирали.Тип изменений
Связанные Issues
Closes #689
Как это было протестировано?
cd core/components/minishop3 php -l src/Router/Response.php php -l src/Router/Utf8SafeConnectorResponse.php php tests/ConnectorUtf8SafeResponseTest.php php tests/ProcessorPermissionsSmokeTest.php vendor/bin/phpunit tests/Unit/Router/ResponseJsonEncodeTest.php composer test:smokeВсе команды завершились с кодом 0. PHPUnit: 12 tests, 57 assertions.
composer test:smoke: 100 скриптов.composer ci:php/composer test,npm run lint:ci,composer stan/ GitHub Actions CI)Конфигурация тестирования:
fix/issue-689-legacy-utf8modConnectorResponseтолько в живом connector)Скриншоты (если применимо)
Чеклист
composer stan/ CI jobPHPStan)npm run lint:ciдля Vue)Дополнительные заметки
Конверт
success/message/total/data/objectсовпадает с тем, чтоmodConnectorResponseпередаёт вtoJSON().Не покрыто: живой
outputContentс ядром MODX (auth +runProcessor). Двойная sanitize на routed manager path (#676 + этот слой) идемпотентна.