44
44
45
45
PHONGO_API zend_class_entry * php_phongo_utcdatetime_ce ;
46
46
47
+ zend_object_handlers php_phongo_handler_utcdatetime ;
48
+
47
49
/* {{{ proto BSON\UTCDateTime UTCDateTime::__construct(integer $milliseconds)
48
50
Construct a new UTCDateTime */
49
51
PHP_METHOD (UTCDateTime , __construct )
@@ -161,10 +163,35 @@ zend_object_value php_phongo_utcdatetime_create_object(zend_class_entry *class_t
161
163
object_properties_init (& intern -> std , class_type );
162
164
163
165
retval .handle = zend_objects_store_put (intern , (zend_objects_store_dtor_t ) zend_objects_destroy_object , php_phongo_utcdatetime_free_object , NULL TSRMLS_CC );
164
- retval .handlers = phongo_get_std_object_handlers () ;
166
+ retval .handlers = & php_phongo_handler_utcdatetime ;
165
167
166
168
return retval ;
167
169
} /* }}} */
170
+
171
+ HashTable * php_phongo_utcdatetime_get_debug_info (zval * object , int * is_temp TSRMLS_DC ) /* {{{ */
172
+ {
173
+ php_phongo_utcdatetime_t * intern ;
174
+ zval retval = zval_used_for_init ;
175
+
176
+ * is_temp = 1 ;
177
+ intern = (php_phongo_utcdatetime_t * )zend_object_store_get_object (object TSRMLS_CC );
178
+
179
+ array_init (& retval );
180
+
181
+ #if SIZEOF_LONG == 4
182
+ {
183
+ char * tmp ;
184
+ int tmp_len ;
185
+
186
+ tmp_len = spprintf (& tmp , 0 , "%" PRId64 , intern -> milliseconds );
187
+ add_assoc_stringl_ex (& retval , ZEND_STRS ("milliseconds" ), tmp , tmp_len , 0 );
188
+ }
189
+ #else
190
+ add_assoc_long_ex (& retval , ZEND_STRS ("milliseconds" ), intern -> milliseconds );
191
+ #endif
192
+
193
+ return Z_ARRVAL (retval );
194
+ } /* }}} */
168
195
/* }}} */
169
196
170
197
/* {{{ PHP_MINIT_FUNCTION */
@@ -179,6 +206,8 @@ PHP_MINIT_FUNCTION(UTCDateTime)
179
206
180
207
zend_class_implements (php_phongo_utcdatetime_ce TSRMLS_CC , 1 , php_phongo_type_ce );
181
208
209
+ memcpy (& php_phongo_handler_utcdatetime , phongo_get_std_object_handlers (), sizeof (zend_object_handlers ));
210
+ php_phongo_handler_utcdatetime .get_debug_info = php_phongo_utcdatetime_get_debug_info ;
182
211
183
212
return SUCCESS ;
184
213
}
0 commit comments