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

jms serialzier 2.0 Error in debug mode #1018

Closed
motia opened this issue Dec 6, 2018 · 9 comments
Closed

jms serialzier 2.0 Error in debug mode #1018

motia opened this issue Dec 6, 2018 · 9 comments
Labels

Comments

@motia
Copy link

motia commented Dec 6, 2018

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

Serialization results in an error after updating package from 1.8 to 2.0

Steps required to reproduce the problem

  1. Use version 2.0
  2. Enable debug mode

Expected Result

  • Worked with 1.8 version

Actual Result

  • An error occurs, here is the trace and the dump of ClassMetadata objects that trigger the error.
        {
            "file": "D:\\laragon\\www\\xxx\\server\\vendor\\jms\\metadata\\src\\ClassMetadata.php",
            "line": 65,
            "function": "file_exists"
        },
        {
            "file": "D:\\laragon\\www\\xxx\\server\\vendor\\jms\\metadata\\src\\MetadataFactory.php",
            "line": 96,
            "function": "isFresh",
            "class": "Metadata\\ClassMetadata",
            "type": "->"
        },
        {
            "file": "D:\\laragon\\www\\xxx\\server\\vendor\\jms\\serializer\\src\\GraphNavigator\\SerializationGraphNavigator.php",
            "line": 199,
            "function": "getMetadataForClass",
            "class": "Metadata\\MetadataFactory",
            "type": "->"
        },
        {
            "file": "D:\\laragon\\www\\xxx\\server\\vendor\\jms\\serializer\\src\\JsonSerializationVisitor.php",
            "line": 136,
            "function": "accept",
            "class": "JMS\\Serializer\\GraphNavigator\\SerializationGraphNavigator",
            "type": "->"
        },
       ...
.........JMS\Serializer\Metadata\ClassMetadata {#2499
  +preSerializeMethods: []
  +postSerializeMethods: []
  +postDeserializeMethods: []
  +xmlRootName: null
  +xmlRootNamespace: null
  +xmlRootPrefix: null
  +xmlNamespaces: []
  +accessorOrder: null
  +customOrder: null
  +usingExpression: false
  +isList: false
  +isMap: false
  +discriminatorDisabled: false
  +discriminatorBaseClass: null
  +discriminatorFieldName: null
  +discriminatorValue: null
  +discriminatorMap: []
  +discriminatorGroups: []
  +xmlDiscriminatorAttribute: false
  +xmlDiscriminatorCData: true
  +xmlDiscriminatorNamespace: null
  +name: "Closure"
  +methodMetadata: []
  +propertyMetadata: []
  +fileResources: array:1 [
    0 => false
  ]
  +createdAt: 1544094448
}
@goetas goetas added the bug label Dec 6, 2018
@goetas
Copy link
Collaborator

goetas commented Dec 9, 2018

Thanks for reporting this issue, but actually in your report is missing the error message you are getting...

@goetas
Copy link
Collaborator

goetas commented Dec 9, 2018

most probably related to #1013

@motia
Copy link
Author

motia commented Dec 9, 2018

My bad I omitted the message as it was clear, in my eyes in moment.

    "message": "file_exists() expects parameter 1 to be a valid path, bool given",
    "exception": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",
    "file": "D:\\laragon\\www\\clicktruck\\server\\vendor\\jms\\metadata\\src\\ClassMetadata.php",
    "line": 65,
    "trace": [

@goetas
Copy link
Collaborator

goetas commented Dec 9, 2018

I guess the underlying type was a internal class, right?

@motia
Copy link
Author

motia commented Dec 9, 2018

No, I don't use any of those.
I tried to dump the classes being processed. And it seems that most of them are processed correctly besides the one causing the error.
I will try to narrow the search.

@goetas
Copy link
Collaborator

goetas commented Dec 9, 2018

Do you mind trying it using jms/serializer:^2.0@dev in your composer json?

@motia
Copy link
Author

motia commented Dec 9, 2018

With jms/serializer:^2.0@dev, there is no error.
Your conclusion about inner classes was spot on. I found a factory closure I was passing instead of calling in the testing environment.

Thank you @goetas .

@goetas
Copy link
Collaborator

goetas commented Dec 9, 2018

👍

@goetas goetas closed this as completed Dec 9, 2018
@goetas
Copy link
Collaborator

goetas commented Dec 9, 2018

fixed by #1013

@goetas goetas reopened this Dec 9, 2018
@goetas goetas closed this as completed Dec 9, 2018
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