@@ -58,12 +58,12 @@ static bool php_phongo_document_init_from_hash(php_phongo_document_t* intern, Ha
58
58
return false;
59
59
}
60
60
61
- static HashTable * php_phongo_document_get_properties_hash (phongo_compat_object_handler_type * object , bool is_temp , int size )
61
+ static HashTable * php_phongo_document_get_properties_hash (zend_object * object , bool is_temp , int size )
62
62
{
63
63
php_phongo_document_t * intern ;
64
64
HashTable * props ;
65
65
66
- intern = Z_OBJ_DOCUMENT (PHONGO_COMPAT_GET_OBJ ( object ) );
66
+ intern = Z_OBJ_DOCUMENT (object );
67
67
68
68
PHONGO_GET_PROPERTY_HASH_INIT_PROPS (is_temp , intern , props , size );
69
69
@@ -435,7 +435,7 @@ static PHP_METHOD(MongoDB_BSON_Document, __serialize)
435
435
{
436
436
PHONGO_PARSE_PARAMETERS_NONE ();
437
437
438
- RETURN_ARR (php_phongo_document_get_properties_hash (PHONGO_COMPAT_OBJ_P (getThis ()), true, 1 ));
438
+ RETURN_ARR (php_phongo_document_get_properties_hash (Z_OBJ_P (getThis ()), true, 1 ));
439
439
}
440
440
441
441
static PHP_METHOD (MongoDB_BSON_Document , __unserialize )
@@ -480,14 +480,14 @@ static zend_object* php_phongo_document_create_object(zend_class_entry* class_ty
480
480
return & intern -> std ;
481
481
}
482
482
483
- static zend_object * php_phongo_document_clone_object (phongo_compat_object_handler_type * object )
483
+ static zend_object * php_phongo_document_clone_object (zend_object * object )
484
484
{
485
485
php_phongo_document_t * intern ;
486
486
php_phongo_document_t * new_intern ;
487
487
zend_object * new_object ;
488
488
489
- intern = Z_OBJ_DOCUMENT (PHONGO_COMPAT_GET_OBJ ( object ) );
490
- new_object = php_phongo_document_create_object (PHONGO_COMPAT_GET_OBJ ( object ) -> ce );
489
+ intern = Z_OBJ_DOCUMENT (object );
490
+ new_object = php_phongo_document_create_object (object -> ce );
491
491
492
492
new_intern = Z_OBJ_DOCUMENT (new_object );
493
493
zend_objects_clone_members (& new_intern -> std , & intern -> std );
@@ -509,13 +509,13 @@ static int php_phongo_document_compare_objects(zval* o1, zval* o2)
509
509
return bson_compare (intern1 -> bson , intern2 -> bson );
510
510
}
511
511
512
- static HashTable * php_phongo_document_get_debug_info (phongo_compat_object_handler_type * object , int * is_temp )
512
+ static HashTable * php_phongo_document_get_debug_info (zend_object * object , int * is_temp )
513
513
{
514
514
php_phongo_document_t * intern ;
515
515
HashTable * props ;
516
516
517
517
* is_temp = 1 ;
518
- intern = Z_OBJ_DOCUMENT (PHONGO_COMPAT_GET_OBJ ( object ) );
518
+ intern = Z_OBJ_DOCUMENT (object );
519
519
520
520
/* This get_debug_info handler reports an additional property. This does not
521
521
* conflict with other uses of php_phongo_document_get_properties_hash since
@@ -543,20 +543,18 @@ static HashTable* php_phongo_document_get_debug_info(phongo_compat_object_handle
543
543
return NULL ;
544
544
}
545
545
546
- static HashTable * php_phongo_document_get_properties (phongo_compat_object_handler_type * object )
546
+ static HashTable * php_phongo_document_get_properties (zend_object * object )
547
547
{
548
548
return php_phongo_document_get_properties_hash (object , false, 1 );
549
549
}
550
550
551
- zval * php_phongo_document_read_property (phongo_compat_object_handler_type * object , phongo_compat_property_accessor_name_type * member , int type , void * * cache_slot , zval * rv )
551
+ zval * php_phongo_document_read_property (zend_object * object , zend_string * member , int type , void * * cache_slot , zval * rv )
552
552
{
553
553
php_phongo_document_t * intern ;
554
- char * key ;
555
- size_t key_len ;
556
-
557
- intern = Z_OBJ_DOCUMENT (PHONGO_COMPAT_GET_OBJ (object ));
554
+ char * key = ZSTR_VAL (member );
555
+ size_t key_len = ZSTR_LEN (member );
558
556
559
- PHONGO_COMPAT_PROPERTY_ACCESSOR_NAME_TO_STRING ( member , key , key_len );
557
+ intern = Z_OBJ_DOCUMENT ( object );
560
558
561
559
if (!php_phongo_document_get (intern , key , key_len , rv , type == BP_VAR_IS )) {
562
560
// Exception already thrown
@@ -566,35 +564,33 @@ zval* php_phongo_document_read_property(phongo_compat_object_handler_type* objec
566
564
return rv ;
567
565
}
568
566
569
- zval * php_phongo_document_write_property (phongo_compat_object_handler_type * object , phongo_compat_property_accessor_name_type * member , zval * value , void * * cache_slot )
567
+ zval * php_phongo_document_write_property (zend_object * object , zend_string * member , zval * value , void * * cache_slot )
570
568
{
571
569
phongo_throw_exception (PHONGO_ERROR_LOGIC , "Cannot write to %s property" , ZSTR_VAL (php_phongo_document_ce -> name ));
572
570
return value ;
573
571
}
574
572
575
- int php_phongo_document_has_property (phongo_compat_object_handler_type * object , phongo_compat_property_accessor_name_type * name , int has_set_exists , void * * cache_slot )
573
+ int php_phongo_document_has_property (zend_object * object , zend_string * name , int has_set_exists , void * * cache_slot )
576
574
{
577
575
php_phongo_document_t * intern ;
578
- char * key ;
579
- size_t key_len ;
580
-
581
- intern = Z_OBJ_DOCUMENT (PHONGO_COMPAT_GET_OBJ (object ));
576
+ char * key = ZSTR_VAL (name );
577
+ size_t key_len = ZSTR_LEN (name );
582
578
583
- PHONGO_COMPAT_PROPERTY_ACCESSOR_NAME_TO_STRING ( name , key , key_len );
579
+ intern = Z_OBJ_DOCUMENT ( object );
584
580
585
581
return php_phongo_document_has (intern , key , key_len );
586
582
}
587
583
588
- void php_phongo_document_unset_property (phongo_compat_object_handler_type * object , phongo_compat_property_accessor_name_type * member , void * * cache_slot )
584
+ void php_phongo_document_unset_property (zend_object * object , zend_string * member , void * * cache_slot )
589
585
{
590
586
phongo_throw_exception (PHONGO_ERROR_LOGIC , "Cannot unset %s property" , ZSTR_VAL (php_phongo_document_ce -> name ));
591
587
}
592
588
593
- zval * php_phongo_document_read_dimension (phongo_compat_object_handler_type * object , zval * offset , int type , zval * rv )
589
+ zval * php_phongo_document_read_dimension (zend_object * object , zval * offset , int type , zval * rv )
594
590
{
595
591
php_phongo_document_t * intern ;
596
592
597
- intern = Z_OBJ_DOCUMENT (PHONGO_COMPAT_GET_OBJ ( object ) );
593
+ intern = Z_OBJ_DOCUMENT (object );
598
594
599
595
if (Z_TYPE_P (offset ) != IS_STRING ) {
600
596
if (type == BP_VAR_IS ) {
@@ -614,16 +610,16 @@ zval* php_phongo_document_read_dimension(phongo_compat_object_handler_type* obje
614
610
return rv ;
615
611
}
616
612
617
- void php_phongo_document_write_dimension (phongo_compat_object_handler_type * object , zval * offset , zval * value )
613
+ void php_phongo_document_write_dimension (zend_object * object , zval * offset , zval * value )
618
614
{
619
615
phongo_throw_exception (PHONGO_ERROR_LOGIC , "Cannot write to %s property" , ZSTR_VAL (php_phongo_document_ce -> name ));
620
616
}
621
617
622
- int php_phongo_document_has_dimension (phongo_compat_object_handler_type * object , zval * member , int check_empty )
618
+ int php_phongo_document_has_dimension (zend_object * object , zval * member , int check_empty )
623
619
{
624
620
php_phongo_document_t * intern ;
625
621
626
- intern = Z_OBJ_DOCUMENT (PHONGO_COMPAT_GET_OBJ ( object ) );
622
+ intern = Z_OBJ_DOCUMENT (object );
627
623
628
624
if (Z_TYPE_P (member ) != IS_STRING ) {
629
625
return false;
@@ -632,7 +628,7 @@ int php_phongo_document_has_dimension(phongo_compat_object_handler_type* object,
632
628
return php_phongo_document_has (intern , Z_STRVAL_P (member ), Z_STRLEN_P (member ));
633
629
}
634
630
635
- void php_phongo_document_unset_dimension (phongo_compat_object_handler_type * object , zval * offset )
631
+ void php_phongo_document_unset_dimension (zend_object * object , zval * offset )
636
632
{
637
633
phongo_throw_exception (PHONGO_ERROR_LOGIC , "Cannot unset %s property" , ZSTR_VAL (php_phongo_document_ce -> name ));
638
634
}
@@ -647,7 +643,7 @@ void php_phongo_document_init_ce(INIT_FUNC_ARGS)
647
643
#endif
648
644
649
645
memcpy (& php_phongo_handler_document , phongo_get_std_object_handlers (), sizeof (zend_object_handlers ));
650
- PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER ( document ) ;
646
+ php_phongo_handler_document . compare = php_phongo_document_compare_objects ;
651
647
php_phongo_handler_document .clone_obj = php_phongo_document_clone_object ;
652
648
php_phongo_handler_document .get_debug_info = php_phongo_document_get_debug_info ;
653
649
php_phongo_handler_document .get_properties = php_phongo_document_get_properties ;
0 commit comments