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

Last version 1.3.11 is probably not minor upgrade :) #59

Closed
VitaliiIsaenko opened this issue May 4, 2020 · 5 comments
Closed

Last version 1.3.11 is probably not minor upgrade :) #59

VitaliiIsaenko opened this issue May 4, 2020 · 5 comments
Labels

Comments

@VitaliiIsaenko
Copy link

I experience a problem after composer updated the minor version of the amazing library you develop.
As far as I understood it's because we don't use typed variables yet. We are still sticking to the annotations.
A very nice change but I'd suggest you consider implementing backwards capability or upgrade a major version of the library.
I can't achieve proper formatting of the stack trace so I will provide it using screenshots, hope it helps
image
image
image
image
image
image
image
image
image
image

@VitaliiIsaenko VitaliiIsaenko changed the title Last version 1.3.11 is probably not minor :) Last version 1.3.11 is probably not minor upgrade :) May 4, 2020
@mark-gerarts
Copy link
Owner

Thanks for taking the time for the screenshots! I didn't expect this to be a BC breaking release, since all test from 7.1 to 7.4 were green. I'm guessing your code contains an edge case for which we don't have a test yet.

I'll investigate the problem and hopefully release a fix soon. In the meantime you'll have to stick to 1.3.10.

@VitaliiIsaenko
Copy link
Author

Sure, already rolled back. Let me know if any additional info would help you to identify this edge case and I can try to provide it.

@mark-gerarts
Copy link
Owner

Hi @VitaliiIsaenko, the fix was quite easy, but the hard part was trying to reproduce it. Is it possible that you use a custom constructor in your mapping that can sometimes return null?

I've pushed a fix for this scenario on hotfix/reflection-class-null. If you can confirm this fixes it for your use case, I'll merge it in master and tag a new release.

@VitaliiIsaenko
Copy link
Author

VitaliiIsaenko commented May 5, 2020

Yes, looks like it solves the problem, I don't have the issue with the fix 👍

I don't have any custom constructor in the company model but I use this trick quite often (though don't know if it is related)

$config->registerMapping(DataType::ARRAY, Company::class)
    ->beConstructedUsing(function (array $a) {
        return isset($a['id']) ? null : new Company();
    })

@mark-gerarts
Copy link
Owner

I think that's exactly what's causing this :)

Anyway, thanks for letting me know that it works. The new version (1.3.12) is pushed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants