@@ -457,6 +457,32 @@ static phongo_create_object_retval php_phongo_utcdatetime_create_object(zend_cla
457
457
#endif
458
458
} /* }}} */
459
459
460
+ static phongo_create_object_retval php_phongo_utcdatetime_clone_object (zval * object TSRMLS_DC ) /* {{{ */
461
+ {
462
+ php_phongo_utcdatetime_t * intern ;
463
+ php_phongo_utcdatetime_t * new_intern ;
464
+ phongo_create_object_retval new_object ;
465
+
466
+ intern = Z_UTCDATETIME_OBJ_P (object );
467
+ new_object = php_phongo_utcdatetime_create_object (Z_OBJCE_P (object ) TSRMLS_CC );
468
+
469
+ #if PHP_VERSION_ID >= 70000
470
+ new_intern = Z_OBJ_UTCDATETIME (new_object );
471
+ zend_objects_clone_members (& new_intern -> std , & intern -> std TSRMLS_CC );
472
+ #else
473
+ {
474
+ zend_object_handle handle = Z_OBJ_HANDLE_P (object );
475
+
476
+ new_intern = (php_phongo_utcdatetime_t * ) zend_object_store_get_object_by_handle (new_object .handle TSRMLS_CC );
477
+ zend_objects_clone_members (& new_intern -> std , new_object , & intern -> std , handle TSRMLS_CC );
478
+ }
479
+ #endif
480
+
481
+ php_phongo_utcdatetime_init (new_intern , intern -> milliseconds );
482
+
483
+ return new_object ;
484
+ } /* }}} */
485
+
460
486
static int php_phongo_utcdatetime_compare_objects (zval * o1 , zval * o2 TSRMLS_DC ) /* {{{ */
461
487
{
462
488
php_phongo_utcdatetime_t * intern1 , * intern2 ;
@@ -543,6 +569,7 @@ void php_phongo_utcdatetime_init_ce(INIT_FUNC_ARGS) /* {{{ */
543
569
zend_class_implements (php_phongo_utcdatetime_ce TSRMLS_CC , 1 , zend_ce_serializable );
544
570
545
571
memcpy (& php_phongo_handler_utcdatetime , phongo_get_std_object_handlers (), sizeof (zend_object_handlers ));
572
+ php_phongo_handler_utcdatetime .clone_obj = php_phongo_utcdatetime_clone_object ;
546
573
php_phongo_handler_utcdatetime .compare_objects = php_phongo_utcdatetime_compare_objects ;
547
574
php_phongo_handler_utcdatetime .get_debug_info = php_phongo_utcdatetime_get_debug_info ;
548
575
php_phongo_handler_utcdatetime .get_gc = php_phongo_utcdatetime_get_gc ;
0 commit comments