Skip to content

[Validator] Prevent infinite loop in PropertyMetadata #20146

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

Closed

Conversation

wesleylancel
Copy link
Contributor

Q A
Branch? 3.1
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

This commit fixes a possible infinite loop in PropertyMetadata when the PropertyMetadata class was constructed with an existing property of class and later used (after being serialized and cached) on that same class while that property no longer existing. get_parent_class will return false when there is no parent class and property_existing will then keeping return false causing the while loop to be infinite.

@wesleylancel wesleylancel changed the title Prevent infinite loop in PropertyMetadata [Validator] Prevent infinite loop in PropertyMetadata Oct 4, 2016
if (false === $objectOrClassName) {
throw new ValidatorException(
sprintf('Property "%s" does not exist in class "%s"', $this->getName(), $originalClass)
);
Copy link
Member

Choose a reason for hiding this comment

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

Should be on one line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fabpot Fixed.

@wesleylancel wesleylancel force-pushed the property-metadata-bugfix branch from c7f8063 to 9f7c2d5 Compare October 5, 2016 06:12
@xabbuh
Copy link
Member

xabbuh commented Oct 13, 2016

👍

@fabpot
Copy link
Member

fabpot commented Oct 13, 2016

Thank you @wesleylancel.

fabpot added a commit that referenced this pull request Oct 13, 2016
…leylancel)

This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #20146).

Discussion
----------

[Validator] Prevent infinite loop in PropertyMetadata

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |n/a
| License       | MIT
| Doc PR        | n/a

This commit fixes a possible infinite loop in PropertyMetadata when the PropertyMetadata class was constructed with an existing property of class and later used (after being serialized and cached) on that same class while that property no longer existing. `get_parent_class` will return false when there is no parent class and `property_existing` will then keeping return false causing the `while` loop to be infinite.

Commits
-------

c1ae7b6 Prevent infinite loop in PropertyMetadata
@fabpot fabpot closed this Oct 13, 2016
This was referenced Oct 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants