ZEND_VM_HANDLER(142, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED, CACHE_SLOT)
{
	USE_OPLINE
	zend_function *func;
	zval *zfunc;
	zval *object;
	zend_class_entry *called_scope;

	func = CACHED_PTR(opline->extended_value);
	if (UNEXPECTED(func == NULL)) {
		zfunc = zend_hash_find_ex(EG(function_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
		ZEND_ASSERT(zfunc != NULL);
		func = Z_FUNC_P(zfunc);
		ZEND_ASSERT(func->type == ZEND_USER_FUNCTION);
		CACHE_PTR(opline->extended_value, func);
	}

	if (Z_TYPE(EX(This)) == IS_OBJECT) {
		called_scope = Z_OBJCE(EX(This));
		if (UNEXPECTED((func->common.fn_flags & ZEND_ACC_STATIC) ||
				(EX(func)->common.fn_flags & ZEND_ACC_STATIC))) {
			object = NULL;
		} else {
			object = &EX(This);
		}
	} else {
		called_scope = Z_CE(EX(This));
		object = NULL;
	}
	zend_create_closure(EX_VAR(opline->result.var), func,
		EX(func)->op_array.scope, called_scope, object);

	ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(142, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED, CACHE_SLOT)
{
	USE_OPLINE
	zend_function *func;
	zval *zfunc;
	zval *object;
	zend_class_entry *called_scope;

	func = CACHED_PTR(opline->extended_value);
	if (UNEXPECTED(func == NULL)) {
		zfunc = zend_hash_find_ex(EG(function_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
		ZEND_ASSERT(zfunc != NULL);
		func = Z_FUNC_P(zfunc);
		ZEND_ASSERT(func->type == ZEND_USER_FUNCTION);
		CACHE_PTR(opline->extended_value, func);
	}

	if (Z_TYPE(EX(This)) == IS_OBJECT) {
		called_scope = Z_OBJCE(EX(This));
		if (UNEXPECTED((func->common.fn_flags & ZEND_ACC_STATIC) ||
				(EX(func)->common.fn_flags & ZEND_ACC_STATIC))) {
			object = NULL;
		} else {
			object = &EX(This);
		}
	} else {
		called_scope = Z_CE(EX(This));
		object = NULL;
	}
	zend_create_closure(EX_VAR(opline->result.var), func,
		EX(func)->op_array.scope, called_scope, object);

	ZEND_VM_NEXT_OPCODE();
}