Skip to content

Conversation

rutgerkool
Copy link

Problem

When PxCDMWebTrackerSessionIdentifier was serialized, PHP's serialize() function used serialization handlers instead of the PHP class's serialize() method, producing incompatible data:

C:32:"PxCDMWebTrackerSessionIdentifier":39:{aeebaqaabqqcabaqeeaaacadaqbidvunnkeucjq}

During deserialization, this caused:

TypeError: Argument 1 passed to PxCDMWebTrackerSessionIdentifier::fromArray() 
must be of the type array, bool given

When PHP's serialize() was called, it found and used handlers (ClassImpl::serialize and ClassImpl::unserialize), bypassing the PHP method table. These handlers directly called Serializable::serialize() and produced binary data that was incompatible with what the PHP class's unserialize() method expected to receive.

Solution

In this project, we remove the use of serialization handlers from classimpl.cpp and changed the PHP method names. By removing the use of these handlers and updating the method names, PHP's serialize() now correctly uses the methods registered in the PHP function table. These methods call Base::serialize which bridges to the C++ Serializable interface, allowing the PHP class's serialize() method to execute and produce the expected serialized format that its unserialize() method can correctly parse.

@EmielBruijntjes
Copy link
Member

I don't think that this is backwards compatible

@EmielBruijntjes
Copy link
Member

This has been fixed in #553

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

Successfully merging this pull request may close these issues.

2 participants