You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So recently I've spent a few hours trying to figure out why I was having issues unserializing data that was serialized properly. It took awhile to figure it out. Here's an example.
``
class AbstractCommand
{
private $someVar;
public function getSomeVar(){ return $this->someVar; }
}
class ChildCommand extends AbstractCommand
{
}
``
If you serialize ChildCommand you get {"@type":"ChildCommand","someVar":{"@scalar":"integer","@value":19}}
but if you unserialize it, you get a ChildCommand object with a null someVar. The issue is that then on line 405 of your Serializer class, you get an exception because that var doesn't exist. Because the variable is private to AbstractCommand. So I'm not sure how to solve this, however it took hours to track down what's going on. So either the situation needs to be detected, or some other type of solution that I'm not aware of.
I don't know why it can get the variable but not set it.
If you need a PR of a failing test case I can probably do that as well.
The text was updated successfully, but these errors were encountered:
So recently I've spent a few hours trying to figure out why I was having issues unserializing data that was serialized properly. It took awhile to figure it out. Here's an example.
``
class AbstractCommand
{
private $someVar;
public function getSomeVar(){ return $this->someVar; }
}
class ChildCommand extends AbstractCommand
{
}
``
If you serialize ChildCommand you get
{"@type":"ChildCommand","someVar":{"@scalar":"integer","@value":19}}
but if you unserialize it, you get a ChildCommand object with a null someVar. The issue is that then on line 405 of your Serializer class, you get an exception because that var doesn't exist. Because the variable is private to AbstractCommand. So I'm not sure how to solve this, however it took hours to track down what's going on. So either the situation needs to be detected, or some other type of solution that I'm not aware of.
I don't know why it can get the variable but not set it.
If you need a PR of a failing test case I can probably do that as well.
The text was updated successfully, but these errors were encountered: