44
44
45
45
PHONGO_API zend_class_entry * php_phongo_cursorid_ce ;
46
46
47
+ zend_object_handlers php_phongo_handler_cursorid ;
48
+
47
49
/* {{{ proto MongoDB\Driver\CursorId CursorId::__construct(string $id)
48
50
Construct a new CursorId */
49
51
PHP_METHOD (CursorId , __construct )
@@ -52,6 +54,7 @@ PHP_METHOD(CursorId, __construct)
52
54
zend_error_handling error_handling ;
53
55
char * id ;
54
56
int id_len ;
57
+ (void )return_value ; (void )return_value_ptr ; (void )return_value_used ;
55
58
56
59
57
60
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
@@ -70,6 +73,7 @@ PHP_METHOD(CursorId, __toString)
70
73
{
71
74
php_phongo_cursorid_t * intern ;
72
75
zend_error_handling error_handling ;
76
+ (void )return_value_ptr ; (void )return_value_used ;
73
77
74
78
75
79
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
@@ -124,32 +128,50 @@ static void php_phongo_cursorid_free_object(void *object TSRMLS_DC) /* {{{ */
124
128
zend_object_value php_phongo_cursorid_create_object (zend_class_entry * class_type TSRMLS_DC ) /* {{{ */
125
129
{
126
130
zend_object_value retval ;
127
- php_phongo_cursorid_t * intern ;
131
+ php_phongo_cursorid_t * intern = NULL ;
128
132
129
- intern = (php_phongo_cursorid_t * )emalloc (sizeof (php_phongo_cursorid_t ));
130
- memset (intern , 0 , sizeof (php_phongo_cursorid_t ));
133
+ intern = (php_phongo_cursorid_t * )ecalloc (1 , sizeof * intern );
131
134
132
135
zend_object_std_init (& intern -> std , class_type TSRMLS_CC );
133
136
object_properties_init (& intern -> std , class_type );
134
137
135
138
retval .handle = zend_objects_store_put (intern , (zend_objects_store_dtor_t ) zend_objects_destroy_object , php_phongo_cursorid_free_object , NULL TSRMLS_CC );
136
- retval .handlers = phongo_get_std_object_handlers () ;
139
+ retval .handlers = & php_phongo_handler_cursorid ;
137
140
138
141
return retval ;
139
142
} /* }}} */
143
+
144
+ HashTable * php_phongo_cursorid_get_debug_info (zval * object , int * is_temp TSRMLS_DC ) /* {{{ */
145
+ {
146
+ php_phongo_cursorid_t * intern ;
147
+ zval retval = zval_used_for_init ;
148
+
149
+
150
+ * is_temp = 1 ;
151
+ intern = (php_phongo_cursorid_t * )zend_object_store_get_object (object TSRMLS_CC );
152
+
153
+ array_init (& retval );
154
+
155
+ add_assoc_long_ex (& retval , ZEND_STRS ("id" ), intern -> id );
156
+
157
+ return Z_ARRVAL (retval );
158
+
159
+ } /* }}} */
140
160
/* }}} */
141
161
142
162
/* {{{ PHP_MINIT_FUNCTION */
143
163
PHP_MINIT_FUNCTION (CursorId )
144
164
{
145
- (void )type ; /* We don't care if we are loaded via dl() or extension= */
165
+ (void )type ; ( void ) module_number ;
146
166
zend_class_entry ce ;
147
167
148
168
INIT_NS_CLASS_ENTRY (ce , "MongoDB\\Driver" , "CursorId" , php_phongo_cursorid_me );
149
- ce .create_object = php_phongo_cursorid_create_object ;
150
169
php_phongo_cursorid_ce = zend_register_internal_class (& ce TSRMLS_CC );
170
+ php_phongo_cursorid_ce -> create_object = php_phongo_cursorid_create_object ;
151
171
php_phongo_cursorid_ce -> ce_flags |= ZEND_ACC_FINAL_CLASS ;
152
172
173
+ memcpy (& php_phongo_handler_cursorid , phongo_get_std_object_handlers (), sizeof (zend_object_handlers ));
174
+ php_phongo_handler_cursorid .get_debug_info = php_phongo_cursorid_get_debug_info ;
153
175
154
176
return SUCCESS ;
155
177
}
0 commit comments