-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
[4.1.0] UuidV1::fromString(...) is not instance of UuidV1 anymore - breaking change? #327
Comments
Thanks for the report, @jacekkarczmarczyk! You're correct. 4.1.0 should not include breaking changes. However, it does include performance improvements that might have some unexpected consequences, like what you're seeing here. @Ocramius, thoughts? |
As I mentioned in the original PR, the signature of No BC break, since no signatures changed. I can run |
As for how to do it in |
Can you elaborate? Uuid::fromString('...')->getFields() actually returns instance of EDIT: $x = new \Ramsey\Uuid\Rfc4122\Fields(Uuid::fromString('38e39072-3c2f-4f3a-a8ab-2f6be1ea3136')->getBytes());
print $x->getVersion(); |
Indeed, annoying: uuid/src/Fields/FieldsInterface.php Lines 26 to 32 in 69b3eb8
I think what you posted above makes sense, even if it is indeed a very ugly API: $x = new \Ramsey\Uuid\Rfc4122\Fields(Uuid::fromString('38e39072-3c2f-4f3a-a8ab-2f6be1ea3136')->getBytes());
print $x->getVersion(); |
|
Since the minimum version of the library is still on PHP 7.2, I'm unable to update the return values of the |
@ramsey yeah, I think there needs to be a bit of a harder split between the userland API ( |
Since last update to ramsey/uuid I've been having an oddissue using ramsey/uuid-doctrine in symfony My id is setup as
Since the last update the uuids generated have become version 2 - but then it validates agaisnt version 1 when i read them and fails Is this related or should i open a new issue? |
@537mfb I'd say you need a test case and a new issue for it :) |
This is a breaking change also if you have a Doctrine entity like this:
Now you get a
Should we change to |
Yup, also there, it is documented as |
Related to OP's issue, I'd like to point out that the page for upgrading version 3 to 4 claims that |
The documentation was correct before version 4.1. I need to decide how to address this. The original goal was that I implemented a lot of abstractions in version 4 that should help me implement some other identifier types in the (near) future, but these abstractions caused tremendous overhead in the library. @Ocramius provided some much-needed relief from the sluggishness of the implementation, but that broke users' expectations (though it didn't break the interface). In some ways, my rush to get 4.0 out was a disaster, but I would never have caught the performance issues on my own, so releasing it as GA was the best approach to get the community to find them. Now that we know about the issues and have benchmarking scripts in place (thanks again, @Ocramius!), I can make some revisions that will hopefully help accomplish my goal of improved abstractions while improving performance. |
@ramsey as per discussions in #324, if "advanced users" (people that care about the UUID details, rather than just passing around a Considering that Using That is a design flaw highlighted by the various uuid/src/Lazy/LazyUuidFromString.php Line 288 in e4562b0
I think we'll need a factory with a concrete union type, instead of |
Why is even |
|
This seems related to me: class Test
{
public function __construct(Ramsey\Uuid\Rfc4122\UuidInterface $userId)
{
}
}
new Test(Ramsey\Uuid\Uuid::uuid4()); throws: How can I use the Rfc4122 UuidInterface if the uuid functions don't return instances of it? I'd use the |
This should do: Lines 305 to 313 in fe665a0
|
from this thread ramsey/uuid#327 ramsey/uuid 4.1 introduced LazyUuidFromString object which is used over the original Uuid object this causes conversions issues when using the objects, but can simply use toString() from UuidInterface to convert to actual guid when inserting
Describe the bug
Using the following code I was able to check whether
$uuidString
is a v1 UUID,Now it returns false, so:
The text was updated successfully, but these errors were encountered: