-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 for queue numeric argument conversion #26967
Fix for queue numeric argument conversion #26967
Conversation
Hi @bartoszkubicki. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
5951404
to
cc49897
Compare
@@ -17,22 +22,25 @@ trait ArgumentProcessor | |||
* @param array $arguments | |||
* @return array | |||
*/ | |||
public function processArguments($arguments) | |||
public function processArguments($arguments): array | |||
{ | |||
$output = []; | |||
foreach ($arguments as $key => $value) { | |||
if (is_array($value)) { | |||
$output[$key] = ['A', $value]; | |||
} elseif (is_int($value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, using only is_numeric
will be enough.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean in scope of this PR is_int check should be removed, while keeping is_numeric check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bartoszkubicki Yes, you are right, is_int check can be removed.
@magento create issue |
@@ -17,22 +22,25 @@ trait ArgumentProcessor | |||
* @param array $arguments | |||
* @return array | |||
*/ | |||
public function processArguments($arguments) | |||
public function processArguments($arguments): array | |||
{ | |||
$output = []; | |||
foreach ($arguments as $key => $value) { | |||
if (is_array($value)) { | |||
$output[$key] = ['A', $value]; | |||
} elseif (is_int($value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bartoszkubicki Yes, you are right, is_int check can be removed.
cc49897
to
d60cbb9
Compare
@magento run all tests |
@bartoszkubicki could you please cover changes with automated tests? |
@@ -121,7 +132,7 @@ public function exchangeDataProvider() | |||
'arguments' => [ | |||
'argument1' => 'value', | |||
'argument2' => true, | |||
'argument3' => 150, | |||
'argument3' => '150', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to assert argument3 is a number.
c0fd215
to
8c8b9cf
Compare
@magento run all tests |
@magento run all tests |
QA passed. |
Hi @bartoszkubicki, thank you for your contribution! |
Please port it to Magento 2.3 |
Description (*)
If we want to declare queue (I bet this also occurs the same way for exchanges) with arguments and we use numeric type argument in
queue_topology.xml
it is casted to string and in corrected file it gets wrapped in incorrect type for rabbit. Example of configuration:Of course using string type doesn't help as we get also string. While creating such a queue we get error similar to:
PRECONDITION_FAILED - inequivalent arg 'x-message-ttl'for queue 'test_dead_letter' in vhost '\': received the value '36000' of type 'longstr' but current is none
.If PR will be accepted, please port to 2.3 as well.
Related Pull Requests
This one has to be fixed first, as for now we are not able to declare queue with ANY parameters
#26966
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)
Resolved issues: