-
Notifications
You must be signed in to change notification settings - Fork 208
PHPC-1774 Fix truncation of PHP_VERSION constant in handshake metadata #1202
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
Conversation
snprintf(php_version_string, 4 + php_version_string_len, "PHP %s", PHP_VERSION); | ||
php_version_string_len = strlen(PHP_VERSION) + PHONGO_METADATA_PHP_VERSION_PREFIX_LEN + 1; | ||
php_version_string = ecalloc(sizeof(char*), php_version_string_len); | ||
snprintf(php_version_string, php_version_string_len, "%s%s", PHONGO_METADATA_PHP_VERSION_PREFIX, PHP_VERSION); |
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.
I think you're still missing the space that goes after the PHONGO_METADATA_PHP_VERSION_PREFIX
+ PHP_VERSION
combo.
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 are indeed correct. This is an issue in libmongoc which seems to append platform data without a separating space. I'm working on a fix for that, but for the time being this PR will mitigate the issue.
[2021-02-17T13:57:57.155182+00:00] socket: TRACE > 00110: 2e 31 35 20 2f 20 6d 69 6e 65 20 63 66 67 3d 30 . 1 5 / m i n e c f g = 0 | ||
|
||
Since matching this is not trivial, we're happy matching the trailing space at | ||
the end of each handshake data item. |
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 trailing space will ultimately be removed once you address a related ticket in libmongoc, correct?
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.
Yes, it can be removed once we fix that.
PHPC-1774
@jmikola testing this is notoriously difficult, as I can't add the expected value of
PHP_VERSION
into theEXPECTF
block. If you have any suggestion how to prevent regressions against this, please let me know.