@@ -68,18 +68,50 @@ PHP_METHOD(MinKey, __wakeup)
6868}
6969/* }}} */
7070
71+ /* {{{ proto string MinKey::serialize()
72+ */
73+ PHP_METHOD (MinKey , serialize )
74+ {
75+ PHONGO_RETURN_STRING ("" );
76+ }
77+ /* }}} */
78+
79+ /* {{{ proto string MinKey::unserialize(string $serialized)
80+ */
81+ PHP_METHOD (MinKey , unserialize )
82+ {
83+ zend_error_handling error_handling ;
84+ char * serialized ;
85+ phongo_zpp_char_len serialized_len ;
86+
87+ zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
88+
89+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s" , & serialized , & serialized_len ) == FAILURE ) {
90+ zend_restore_error_handling (& error_handling TSRMLS_CC );
91+ return ;
92+ }
93+ zend_restore_error_handling (& error_handling TSRMLS_CC );
94+ }
95+ /* }}} */
96+
7197/* {{{ BSON\MinKey */
7298
7399ZEND_BEGIN_ARG_INFO_EX (ai_MinKey___set_state , 0 , 0 , 1 )
74100 ZEND_ARG_ARRAY_INFO (0 , properties , 0 )
75101ZEND_END_ARG_INFO ()
76102
103+ ZEND_BEGIN_ARG_INFO_EX (ai_MinKey_unserialize , 0 , 0 , 1 )
104+ ZEND_ARG_INFO (0 , serialized )
105+ ZEND_END_ARG_INFO ()
106+
77107ZEND_BEGIN_ARG_INFO_EX (ai_MinKey_void , 0 , 0 , 0 )
78108ZEND_END_ARG_INFO ()
79109
80110static zend_function_entry php_phongo_minkey_me [] = {
81111 PHP_ME (MinKey , __set_state , ai_MinKey___set_state , ZEND_ACC_PUBLIC |ZEND_ACC_STATIC )
82112 PHP_ME (MinKey , __wakeup , ai_MinKey_void , ZEND_ACC_PUBLIC )
113+ PHP_ME (MinKey , serialize , ai_MinKey_void , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
114+ PHP_ME (MinKey , unserialize , ai_MinKey_unserialize , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
83115 PHP_FE_END
84116};
85117
@@ -136,6 +168,8 @@ PHP_MINIT_FUNCTION(MinKey)
136168 PHONGO_CE_FINAL (php_phongo_minkey_ce );
137169
138170 zend_class_implements (php_phongo_minkey_ce TSRMLS_CC , 1 , php_phongo_type_ce );
171+ zend_class_implements (php_phongo_minkey_ce TSRMLS_CC , 1 , zend_ce_serializable );
172+
139173 memcpy (& php_phongo_handler_minkey , phongo_get_std_object_handlers (), sizeof (zend_object_handlers ));
140174#if PHP_VERSION_ID >= 70000
141175 php_phongo_handler_minkey .free_obj = php_phongo_minkey_free_object ;
0 commit comments