@@ -68,18 +68,50 @@ PHP_METHOD(MaxKey, __wakeup)
6868}
6969/* }}} */
7070
71+ /* {{{ proto string MaxKey::serialize()
72+ */
73+ PHP_METHOD (MaxKey , serialize )
74+ {
75+ PHONGO_RETURN_STRING ("" );
76+ }
77+ /* }}} */
78+
79+ /* {{{ proto string MaxKey::unserialize(string $serialized)
80+ */
81+ PHP_METHOD (MaxKey , 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\MaxKey */
7298
7399ZEND_BEGIN_ARG_INFO_EX (ai_MaxKey___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_MaxKey_unserialize , 0 , 0 , 1 )
104+ ZEND_ARG_INFO (0 , serialized )
105+ ZEND_END_ARG_INFO ()
106+
77107ZEND_BEGIN_ARG_INFO_EX (ai_MaxKey_void , 0 , 0 , 0 )
78108ZEND_END_ARG_INFO ()
79109
80110static zend_function_entry php_phongo_maxkey_me [] = {
81111 PHP_ME (MaxKey , __set_state , ai_MaxKey___set_state , ZEND_ACC_PUBLIC |ZEND_ACC_STATIC )
82112 PHP_ME (MaxKey , __wakeup , ai_MaxKey_void , ZEND_ACC_PUBLIC )
113+ PHP_ME (MaxKey , serialize , ai_MaxKey_void , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
114+ PHP_ME (MaxKey , unserialize , ai_MaxKey_unserialize , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
83115 PHP_FE_END
84116};
85117
@@ -135,6 +167,8 @@ PHP_MINIT_FUNCTION(MaxKey)
135167 PHONGO_CE_FINAL (php_phongo_maxkey_ce );
136168
137169 zend_class_implements (php_phongo_maxkey_ce TSRMLS_CC , 1 , php_phongo_type_ce );
170+ zend_class_implements (php_phongo_maxkey_ce TSRMLS_CC , 1 , zend_ce_serializable );
171+
138172 memcpy (& php_phongo_handler_maxkey , phongo_get_std_object_handlers (), sizeof (zend_object_handlers ));
139173#if PHP_VERSION_ID >= 70000
140174 php_phongo_handler_maxkey .free_obj = php_phongo_maxkey_free_object ;
0 commit comments