Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'Malformed UTF-8 characters, possibly incorrectly encoded' Error #2289

Closed
wants to merge 3 commits into from
Closed

Conversation

alessandroaussems
Copy link
Contributor

@alessandroaussems alessandroaussems commented Jan 28, 2022

Fix 'Malformed UTF-8 characters, possibly incorrectly encoded' Error On Sync Api

1. Why is this change necessary?

Currently when the error message on the Sync Api contains a UUID the error message "Malformed UTF-8 characters, possibly incorrectly encoded" is shown. Which is not very helpfull

2. What does this change do, exactly?

Adds the "JSON_INVALID_UTF8_SUBSTITUTE" option to the Sync API Json Response

3. Describe each step to reproduce the issue or behaviour.

For ex: upsert a product, try to link an non existing media entity to it. "Malformed UTF-8 characters, possibly incorrectly encoded" error will be shown.

4. Please link to the relevant issues (if any).

/

5. Checklist

  • I have written tests and verified that they fail without my change
  • I have squashed any insignificant commits
  • I have created a changelog file with all necessary information about my changes
  • I have written or adjusted the documentation according to my changes
  • This change has comments for package types, values, functions, and non-obvious lines of code
  • I have read the contribution requirements and fulfil them.

@alessandroaussems alessandroaussems marked this pull request as ready for review January 28, 2022 15:25
@CLAassistant
Copy link

CLAassistant commented Jan 28, 2022

CLA assistant check
All committers have signed the CLA.


private function createResponse(SyncResult $result, int $statusCode = 200): JsonResponse
{
$response = new JsonResponse(null, $statusCode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$response = new JsonResponse(null, $statusCode);
$response = new JsonResponse($result, $statusCode);
$response->setEncodingOptions(\JSON_INVALID_UTF8_SUBSTITUTE);
return $response;

@shopwareBot
Copy link

Hello,

thank you for creating this pull request.
I have opened an issue on our Issue Tracker for you. See the issue link: https://issues.shopware.com/issues/NEXT-19835

Please use this issue to track the state of your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants