Skip to content

[ReadListener] Get an object with custom clone function leads to fatal #3062

Description

Hello there,

My previous version was 2.4.3 so I tried the 2.4.6

Now I have fatals when I try to GET an object with custom clone function. Here a simplified example:

class Guide
{
   /** attributes **/
   ...

   public function __clone()
   {
      $this->setId(null);
      /** other modifications **/
      ...
   }

   /** other functions **/
   ...
}

In ReadListener.php, this line:
$request->attributes->set('previous_data', $this->clone($data));
will clone my Guide object but when the function getIriFromItem() in IriConverter.php is called, it will fail when trying to create an IRI because the id is null and raise an Exception.

Should I nullify the id outside of the clone function? Is there a way to disable previous_data on GET because I don't need it? Or is it a bug?

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions