Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,15 @@ class PHPCPP_EXPORT Base
* is handled by the user-space implementation of Serializable::serialize()).
* @return Php::Value
*/
Php::Value __serialize();
Php::Value serialize();

/**
* Method that is called when an explicit call to $object->unserialize() is made
* Note that a call to unserialize($string) does not end up in this function, but
* is handled by the user-space implementation of Serializable::unserialize()).
* @param params The passed parameters
*/
void __unserialize(Php::Parameters &params);
void unserialize(Php::Parameters &params);

/**
* Method that is called when an explicit call to $object->count() is made
Expand Down
4 changes: 2 additions & 2 deletions zend/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ int Base::__compare(const Base &that) const
* is handled by the user-space implementation of Serializable::serialize()).
* @return Php::Value
*/
Php::Value Base::__serialize()
Php::Value Base::serialize()
{
// 'this' refers to a Php::Base class, but we expect that is also implements the Serializable
// interface (otherwise we would never have registered the __serialize function as a callback)
Expand All @@ -242,7 +242,7 @@ Php::Value Base::__serialize()
* is handled by the user-space implementation of Serializable::unserialize()).
* @param params The passed parameters
*/
void Base::__unserialize(Php::Parameters &params)
void Base::unserialize(Php::Parameters &params)
{
// 'this' refers to a Php::Base class, but we expect that is also implements the Serializable
// interface (otherwise we would never have registered the __serialize function as a callback)
Expand Down
12 changes: 2 additions & 10 deletions zend/classimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1464,8 +1464,8 @@ const struct _zend_function_entry *ClassImpl::entries()
{
// the method object need to stay in scope for the lifetime of the script (because the register a pointer
// to an internal string buffer) -- so we create them as static variables
static Method serialize("serialize", &Base::__serialize, 0, {});
static Method unserialize("unserialize", &Base::__unserialize, 0, { ByVal("input", Type::Undefined, true) });
static Method serialize("serialize", &Base::serialize, 0, {});
static Method unserialize("unserialize", &Base::unserialize, 0, { ByVal("input", Type::Undefined, true) });

// register the serialize and unserialize method in case this was not yet done in PHP user space
if (!hasMethod("serialize")) serialize.initialize(&_entries[i++], _name);
Expand Down Expand Up @@ -1544,14 +1544,6 @@ zend_class_entry *ClassImpl::initialize(ClassBase *base, const std::string &pref
#endif
}

// for serializable classes, we install callbacks for serializing and unserializing
if (_base->serializable())
{
// add handlers to serialize and unserialize
entry.serialize = &ClassImpl::serialize;
entry.unserialize = &ClassImpl::unserialize;
}

// do we have a base class?
if (_parent)
{
Expand Down