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 StringMatchesFormatDescription with \r\n #3059

Closed
wants to merge 1 commit into from

Commits on Apr 3, 2018

  1. Fix StringMatchesFormatDescription with \r\n

    This is a fix for sebastianbergmann#3040.
    
    There was a bug in that the following assertion would fail, even though
    it should pass:
    
        $this->assertStringMatchesFormat("\r\n", "\r\n");
    
    Obviously, we would expect a string to match itself. The bug was due to
    newline conversion - `\r\n` was being converted to `\n` on the pattern,
    but not on the string to be matched against.
    
    In order to be compatible with existing behavior, we need to continue
    converting `\r\n` to `\n` in the pattern. (Otherwise, users who expect
    this behavior may have tests fail that would have previously passed.)
    Therefore, the only option for fixing the bug is to also sanitize the
    string to be matched. This commit makes that change, and provides some
    additional tests to verify the behavior.
    mkasberg committed Apr 3, 2018
    Copy the full SHA
    b1e0d87 View commit details
    Browse the repository at this point in the history