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

XmlDriver: callback-method setup raises exception #1311

Closed
curzio-della-santa opened this issue Apr 8, 2021 · 1 comment
Closed

XmlDriver: callback-method setup raises exception #1311

curzio-della-santa opened this issue Apr 8, 2021 · 1 comment

Comments

@curzio-della-santa
Copy link
Contributor

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

Steps required to reproduce the problem

Deserialize class having a metadata described in a separate XML file, e.g:

<?xml version="1.0" encoding="UTF-8" ?>
<serializer>
    <class
            name="Foo"
            exclusion-policy="ALL"
            accessor-order="custom"
            custom-accessor-order="bar">
        <callback-method name="afterDeserialization" type="post-deserialize" />
        <property
                name="bar"
                type="integer"
                since-version="1.0"
                expose="true"
                access-type="property">
        </property>
    </class>
</serializer>

Expected Result

  • Correct deserializatio

Actual Result

Using PHP 7.4 I get a configuration exception (I've removed irrelevant stack and adapted for privacy):

{
    "trace": [
        {
            "file": "/app/vendor/jms/serializer/src/Metadata/Driver/XmlDriver.php",
            "line": 374,
            "function": "__construct",
            "class": "Metadata\\MethodMetadata",
            "type": "->",
            "args": [
                {
                    "0": "bar"
                },
                "afterDeserialization"
            ]
        },
        {
            "file": "/app/vendor/jms/metadata/src/Driver/AbstractFileDriver.php",
            "line": 32,
            "function": "loadMetadataFromFile",
            "class": "JMS\\Serializer\\Metadata\\Driver\\XmlDriver",
            "type": "->",
            "args": [
                {
                    "name": "Foo"
                },
                "some-path/Foo.xml"
            ]
        }
    ],
    "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
    "title": "Internal Server Error",
    "status": 500,
    "detail": "Argument 1 passed to Metadata\\MethodMetadata::__construct() must be of the type string, object given, called in /app/vendor/jms/serializer/src/Metadata/Driver/XmlDriver.php on line 374"
}

I've already written a PR for the needed fix: #1310

@goetas
Copy link
Collaborator

goetas commented Jul 1, 2021

fixed in #1310

@goetas goetas closed this as completed Jul 1, 2021
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

2 participants