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 line ending sequence issue in checksums #86

Merged
merged 5 commits into from
Apr 9, 2022

Conversation

caendesilva
Copy link
Member

Fix line ending sequence issue in checksums by creating a wrapper for the checksum call to replace all (*most) line ending sequences with LFs to prevent the issue raised in #85.

When running comparisons for the file cache, use FileCacheService::unixsum instead of md5 and FileCacheService::unixsumFile instead of md5_file to ensure compatibility.

public static function unixsum(string $string): string
{
    $string = str_replace(["\r\n", "\r"], "\n", $string);
    return md5($string);
}

public static function unixsumFile(string $file): string
{
    return static::unixsum(file_get_contents($file));
}

@caendesilva caendesilva merged commit 68759ff into master Apr 9, 2022
@caendesilva caendesilva deleted the fix-checksum-line-ending-sequences branch April 9, 2022 11:50
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.

Tests failing, suspected cause being mismatching line ending sequences
1 participant