Skip to content

PHPC-2208: Fix fragile assertion on session IDs #1414

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

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Apr 26, 2023

PHPC-2208

A short investigation has led me to conclude that %c should definitely match the end-of-line character, as run-tests.php replaces it with a . in the regular expression, which is then matched using the PCRE_DOTALL modifier. However, since trying to figure this out is inconsequential and the previous fix (applied in #974 to work around PHPC-1345) doesn't work in this case, I replaced the sequence of %c with a single %a across the tests. While this may match more or fewer than 16 characters unlike the previous solution, as the debug output also contains string(16) any binary data that isn't 16 characters long would fail the checks based on that part, apart from being improbable due to the verification employed for BSON subtype 0x04 (UUID).

@alcaeus alcaeus requested a review from jmikola April 26, 2023 07:24
@alcaeus alcaeus self-assigned this Apr 26, 2023
@alcaeus alcaeus merged commit 3485bca into mongodb:v1.15 Apr 26, 2023
@alcaeus alcaeus deleted the phpc-2208-fix-assertions branch April 26, 2023 13:14
alcaeus added a commit that referenced this pull request Apr 26, 2023
* v1.15:
  PHPC-2208: Fix fragile assertion on session IDs (#1414)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants