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 invalid char in SQS Headers #37038

Merged
merged 1 commit into from Jun 3, 2020
Merged

Fix invalid char in SQS Headers #37038

merged 1 commit into from Jun 3, 2020

Conversation

jderusse
Copy link
Member

@jderusse jderusse commented Jun 1, 2020

Q A
Branch? 5.1
Bug fix? yes
New feature? no
Deprecations? yes
Tickets #36525 (comment)
License MIT
Doc PR /

From Amazon documnetation header's name have constraints:

  • only a-zA-Z0-9_\.- + not start/end with a .
  • 256 char

This PR serialize ALL headers in a single SQS Attribute.

$headers = \json_decode($attributes[self::MESSAGE_ATTRIBUTE_NAME]->getStringValue(), true);
unset($attributes[self::MESSAGE_ATTRIBUTE_NAME]);
}
foreach ($attributes as $name => $attribute) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is need for BC compatibility for people that previously successfully encoded message without special char

'StringValue' => $value,
]);
}
$parameters['MessageAttributes'][self::MESSAGE_ATTRIBUTE_NAME] = new MessageAttributeValue([
Copy link
Member

Choose a reason for hiding this comment

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

This will make inter-operability harder with other tools publishing or reading with SQS. Wouldn't it be better to keep setting attributes directly when their name are valid SQS attribute names ?

Copy link
Member Author

Choose a reason for hiding this comment

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

good idea

@fabpot
Copy link
Member

fabpot commented Jun 3, 2020

Thank you @jderusse.

]);
}

dd($parameters);
Copy link
Contributor

Choose a reason for hiding this comment

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

nicolas-grekas added a commit that referenced this pull request Jun 7, 2020
…t (sstok)

This PR was merged into the 5.1 branch.

Discussion
----------

[Messenger/AmazonSqsBridge] Fixed left-over debug statement

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  |
| Deprecations? | no
| Tickets       | Related to #37038
| License       | MIT
| Doc PR        |

I noticed whats properly a left-over debugging statement that blocks the code from further execution. /cc @jderusse can you check this (thanks).

Commits
-------

8b827e4 Fixed left-over debug statement
@fabpot fabpot mentioned this pull request Jun 12, 2020
@jderusse jderusse deleted the fix-sqs branch October 15, 2020 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants