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

Serialization should not use internal codec #361

Merged
merged 1 commit into from
Aug 6, 2021
Merged

Serialization should not use internal codec #361

merged 1 commit into from
Aug 6, 2021

Conversation

janlanger
Copy link
Contributor

@janlanger janlanger commented Feb 5, 2021

The change in #318 is the root cause of issues #329 and ramsey/uuid-doctrine#152. This PR should fix that.

Description

The problem is, that call to getBytes and subsequently this->codec->encodeBytes returns invalid result when UUID is used with OrderedTimeCodec. When this combination is used, current master returns binary string with shuffled values (as OrderedTimeCodec does) and deserialization later returns invalid instance of UUID. Then new code is same as would StringCodec do.

Motivation and context

Fixed #329 and ramsey/uuid-doctrine#152

How has this been tested?

Unit test included

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have run composer run-script test locally, and there were no failures or errors. (I have, some fail, but unrelated to the issue)

@codecov
Copy link

codecov bot commented Feb 5, 2021

Codecov Report

Merging #361 (ef25479) into master (e5b3699) will increase coverage by 0.19%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #361      +/-   ##
============================================
+ Coverage     97.51%   97.71%   +0.19%     
  Complexity      567      567              
============================================
  Files            64       64              
  Lines          1532     1532              
============================================
+ Hits           1494     1497       +3     
+ Misses           38       35       -3     
Impacted Files Coverage Δ Complexity Δ
src/Uuid.php 96.38% <100.00%> (+3.61%) 43.00 <0.00> (ø)

@janlanger
Copy link
Contributor Author

PHPStan fail looks unrelated to the changes.

@ramsey
Copy link
Owner

ramsey commented Aug 6, 2021

Thank you for contributing! 🎉 (And I'm very sorry it's taken me so long to respond.)

@ramsey ramsey merged commit 06f8e67 into ramsey:main Aug 6, 2021
@ramsey
Copy link
Owner

ramsey commented Aug 6, 2021

I've released this in v4.2.0. Thanks!

@janlanger janlanger deleted the patch-1 branch August 9, 2021 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants