U_CFUNC PHP_FUNCTION(intlgregcal_create_instance)
{
	intl_error_reset(NULL);

	object_init_ex(return_value, GregorianCalendar_ce_ptr);
	_php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
U_CFUNC PHP_METHOD(IntlGregorianCalendar, __construct)
{
	zend_error_handling error_handling;

	zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
	return_value = getThis();
	_php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
	zend_restore_error_handling(&error_handling);
}
U_CFUNC PHP_METHOD(IntlGregorianCalendar, __construct)
{
	zval	orig_this	= *getThis();
	intl_error_reset(NULL TSRMLS_CC);

	return_value = getThis();
	//changes this to IS_NULL (without first destroying) if there's an error
	_php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU);

	if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) {
		zend_object_store_ctor_failed(Z_OBJ(orig_this) TSRMLS_CC);
		zval_dtor(&orig_this);
		ZEND_CTOR_MAKE_NULL();
	}
}
U_CFUNC PHP_FUNCTION(intlgregcal_create_instance)
{
	zval orig;
	intl_error_reset(NULL TSRMLS_CC);

	object_init_ex(return_value, GregorianCalendar_ce_ptr);
	ZVAL_COPY_VALUE(&orig, return_value);

	_php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU);

	if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) {
		zval_dtor(&orig);
		RETURN_NULL();
	}
}
U_CFUNC PHP_METHOD(IntlGregorianCalendar, __construct)
{
	zend_error_handling error_handling;

	zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
	return_value = getThis();
	//changes this to IS_NULL (without first destroying) if there's an error
	_php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU);
	if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) {
		if (!EG(exception)) {
			zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
		}
	}
	zend_restore_error_handling(&error_handling);
}