37
37
typedef struct _zend_closure {
38
38
zend_object std ;
39
39
zend_function func ;
40
- zval * this_ptr ;
41
40
} zend_closure ;
42
41
43
42
/* non-static since it needs to be referenced */
@@ -111,13 +110,6 @@ ZEND_API const zend_function *zend_get_closure_method_def(zval *obj TSRMLS_DC) /
111
110
}
112
111
/* }}} */
113
112
114
- ZEND_API zval * zend_get_closure_this_ptr (zval * obj TSRMLS_DC ) /* {{{ */
115
- {
116
- zend_closure * closure = (zend_closure * )zend_object_store_get_object (obj TSRMLS_CC );
117
- return closure -> this_ptr ;
118
- }
119
- /* }}} */
120
-
121
113
static zend_function * zend_closure_get_method (zval * * object_ptr , char * method_name , int method_len TSRMLS_DC ) /* {{{ */
122
114
{
123
115
char * lc_name ;
@@ -187,10 +179,6 @@ static void zend_closure_free_storage(void *object TSRMLS_DC) /* {{{ */
187
179
destroy_op_array (& closure -> func .op_array TSRMLS_CC );
188
180
}
189
181
190
- if (closure -> this_ptr ) {
191
- zval_ptr_dtor (& closure -> this_ptr );
192
- }
193
-
194
182
efree (closure );
195
183
}
196
184
/* }}} */
@@ -223,17 +211,10 @@ int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function
223
211
closure = (zend_closure * )zend_object_store_get_object (obj TSRMLS_CC );
224
212
* fptr_ptr = & closure -> func ;
225
213
226
- if (closure -> this_ptr ) {
227
- if (zobj_ptr ) {
228
- * zobj_ptr = closure -> this_ptr ;
229
- }
230
- * ce_ptr = Z_OBJCE_P (closure -> this_ptr );
231
- } else {
232
- if (zobj_ptr ) {
233
- * zobj_ptr = NULL ;
234
- }
235
- * ce_ptr = closure -> func .common .scope ;
214
+ if (zobj_ptr ) {
215
+ * zobj_ptr = NULL ;
236
216
}
217
+ * ce_ptr = NULL ;
237
218
return SUCCESS ;
238
219
}
239
220
/* }}} */
@@ -248,13 +229,6 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
248
229
* is_temp = 1 ;
249
230
ALLOC_HASHTABLE (rv );
250
231
zend_hash_init (rv , 1 , NULL , ZVAL_PTR_DTOR , 0 );
251
- val = closure -> this_ptr ;
252
- if (!val ) {
253
- ALLOC_INIT_ZVAL (val );
254
- } else {
255
- Z_ADDREF_P (val );
256
- }
257
- zend_symtable_update (rv , "this" , sizeof ("this" ), (void * ) & val , sizeof (zval * ), NULL );
258
232
if (closure -> func .type == ZEND_USER_FUNCTION && closure -> func .op_array .static_variables ) {
259
233
HashTable * static_variables = closure -> func .op_array .static_variables ;
260
234
MAKE_STD_ZVAL (val );
@@ -369,7 +343,7 @@ static int zval_copy_static_var(zval **p TSRMLS_DC, int num_args, va_list args,
369
343
}
370
344
/* }}} */
371
345
372
- ZEND_API void zend_create_closure (zval * res , zend_function * func , zend_class_entry * scope , zval * this_ptr TSRMLS_DC ) /* {{{ */
346
+ ZEND_API void zend_create_closure (zval * res , zend_function * func TSRMLS_DC ) /* {{{ */
373
347
{
374
348
zend_closure * closure ;
375
349
@@ -390,19 +364,7 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
390
364
(* closure -> func .op_array .refcount )++ ;
391
365
}
392
366
393
- closure -> func .common .scope = scope ;
394
- if (scope ) {
395
- closure -> func .common .fn_flags |= ZEND_ACC_PUBLIC ;
396
- if (this_ptr && (closure -> func .common .fn_flags & ZEND_ACC_STATIC ) == 0 ) {
397
- closure -> this_ptr = this_ptr ;
398
- Z_ADDREF_P (this_ptr );
399
- } else {
400
- closure -> func .common .fn_flags |= ZEND_ACC_STATIC ;
401
- closure -> this_ptr = NULL ;
402
- }
403
- } else {
404
- closure -> this_ptr = NULL ;
405
- }
367
+ closure -> func .common .scope = NULL ;
406
368
}
407
369
/* }}} */
408
370
0 commit comments