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

Unable to call method "getType" of non-object "object" on deserialization #1294

Open
vertisan opened this issue Mar 8, 2021 · 0 comments
Open

Comments

@vertisan
Copy link

vertisan commented Mar 8, 2021

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

Steps required to reproduce the problem

  1. Enable Expression Language exclusion strategy as per: https://jmsyst.com/libs/serializer/master/cookbook/exclusion_strategies#dynamic-exclusion-strategy
  2. Use the object variable in a expression within the Expose annotation on a class property, like so:
@JMS\Exclude(if="object.getType() === constant('\\App\\Model\\Resource\\ResourceObject::DIRECTORY_TYPE')")
  1. Call deserialize on a string using this class, like so:
$serializer->deserialize($requestBody, 'MyClass', 'json');
  1. Receive exception:
Unable to call method "getType" of non-object "object".

Expected Result

  • I expect a successful deserialization.

Actual Result

  • Deserialization failed with above exception message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant