Update Parser.php - #110
Conversation
in regex "[....]" denotes a list of chars, hence the pattern "[\r?\n]" is incorrect, as it will split on: '\r', '?' and '\n', while the intention was most likely: split on "\r\n" or "\n", which would have the regex pattern: "(\r?\n)"
|
We ran into this issue, because we have header-values with '\r' chars (no '\n' values), which was incorrectly interpreted as a delimiter of the header-value. |
|
A unit test would be great |
|
I'm sorry, I'm not a PHP developer - I ran into this issue when a Java application interfaced with a PHP application over Stomp. I cannot write a PHP unit-test in a reasonable timeframe, but I wrote a small snippet for you, that showcases the issue (albeit in java -- it should translate trivially to PHP) ` ` I hope this helps.... somewhat :) |
|
As a simple check, please verify that the PHP regex parser indeed splits on the '?' character with the current regex-pattern, as showcased in the java snippet. |
|
@riven8192 Sorry for the huge delay, I'll check your PR this evening and also try to add a test case. |
|
Thank you for the PR 👍 |
|
We released version 4.4.1 containing the fix. |
in regex "[....]" denotes a list of chars, hence the pattern "[\r?\n]" is incorrect, as it will split on: '\r', '?' and '\n', while the intention was most likely: split on "\r\n" or "\n", which would have the regex pattern: "(\r?\n)"