Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

[GH-36] Bugfix: TypedNoDefaultReflectionProperty::setValue NULL when null allowed #37

Merged
merged 3 commits into from
Mar 27, 2020

Conversation

beberlei
Copy link
Member

1.2 introduced a regression

Fixes #36

@beberlei beberlei added the Bug Something isn't working label Mar 23, 2020
@beberlei beberlei added this to the 1.2.1 milestone Mar 23, 2020
@beberlei
Copy link
Member Author

Scrutinizer and Travis-ci/push are false positives here.

@stof
Copy link
Member

stof commented Mar 23, 2020

To fix the issue on Scrutinizer and Travis, the solution would be to set the COMPOSER_ROOT_VERSION env variable, so that composer could know that the root package satisfies the doctrine/reflection requirement of doctrine/common, due to the circular dependency. The version guessing for the root is not enough here (and that's why this feature exists in composer)

@@ -31,7 +31,7 @@ public function getValue($object = null)
*/
public function setValue($object, $value = null)
{
if ($value === null) {
if ($value === null && ! $this->getType()->allowsNull()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of a non-typed property, ReflectionProperty::getType() will return null.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but its by definition a typed property here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, in that case this shouldn't be an issue if the class, that has to be used for a property, is determined elsewhere and will always result in TypedNoDefaultReflectionProperty for PHP 7.4 when typed properties are in use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SenseException i am not sure anymore, so i added a hasType() check inbetween.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I'd like to see a test where no property type is given.

@greg0ire
Copy link
Member

Shouldn't 1.2.x be the target? I can see that master is aliased to 1.2.x, weird…

@beberlei
Copy link
Member Author

@greg0ire we don't have version branches here, because usually nothing much would have to happen here anyways.

@alcaeus
Copy link
Member

alcaeus commented Mar 24, 2020

we don't have version branches here, because usually nothing much would have to happen here anyways.

Yes we do: they are needed to work with the release bot.

@beberlei beberlei changed the base branch from master to 1.2.x March 24, 2020 08:55
@beberlei
Copy link
Member Author

@alcaeus hm right, weird i remember working on master last week, maybe I misremembered or somebody fixed my mess without telling and slapping me :-D

@alcaeus
Copy link
Member

alcaeus commented Mar 24, 2020

hm right, weird i remember working on master last week, maybe I misremembered or somebody fixed my mess without telling and slapping me :-D

.0 releases are tagged from master, which is why the bot didn't complain. From now on, any 1.2 patch release is tagged from the 1.2.x branch, then the bot creates a PR to merge the branch up into master.

@greg0ire
Copy link
Member

Should we set 1.2.x as the default branch?

@greg0ire
Copy link
Member

BTW, I extracted your Composer related commit in another PR that makes it easier to work with Composer: #38

@alcaeus
Copy link
Member

alcaeus commented Mar 24, 2020

Should we set 1.2.x as the default branch?

No, as new features should still go to master. Setting a version branch as default only makes sense while we're preparing a new major release and want all new features to go into the last minor of the current major release number.

@beberlei beberlei merged commit 55e7191 into 1.2.x Mar 27, 2020
@beberlei beberlei deleted the GH-36-BugfixTypedNullable branch March 27, 2020 11:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug when deserializing ?string 7.4-hinted properties.
5 participants