-
Notifications
You must be signed in to change notification settings - Fork 2
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
Force _fromSeqenceString result array values to int
#6
Force _fromSeqenceString result array values to int
#6
Conversation
int
I'm not sure about this. Are ids guaranteed to to be integers? |
That's a good question. The method itself only talks about indices in the comment, but it doesn't specify the type. RFC 3501 doesn't specify any formats either: I leave it up to you to decide - I personally woud be in favour of a consistent return type, but of cousre theroetically, UIDs could be strings as long as they're iterable - hex values come to mind. |
I think If you could add a test that would be awesome... something like the below might work: $this->assertSame(['1','2','3','4'], (new Ids('1,2,3,4'))->ids); |
K so a further googling lead me to page 91 of the RFC. I think the values are indeed meant to be non zero integers, but please correct me if I'm wrong. |
I believe you're correct, so please correct both cases and add a test |
as currently, the first value will be a string. The iteration with ++ will force the second loop to convert to int, but the first loop is using as a string leading to errors with strongly typed methods. Signed-off-by: Anna Larch <anna@nextcloud.com>
b5b1aa8
to
2687882
Compare
Let's see if the tests pass, unfortunately I have no way to run them locally at the moment. Also added a forced INT to the |
as currently, the first value will be a string.
Traced it down to the _fromSequenceString method:
The iteration with ++ will force the second loop to convert to int, but the first loop is using as a string leading to errors with strongly typed methods.
Seen in error logs like this:
Signed-off-by: Anna Larch anna@nextcloud.com