Exemple #1
0
/**
 * Returns whether the given variable is a valid JSON string.
 *
 * @param string
 * @return boolean
 */
PHP_METHOD(Xpl_Json, validate) {

	zend_bool _0;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *str_param = NULL, *_1, *_2 = NULL;
	zval *str = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &str_param);

	zephir_get_strval(str, str_param);


	if (ZEPHIR_IS_EMPTY(str)) {
		RETURN_MM_BOOL(0);
	}
	_0 = ZEPHIR_IS_STRING_IDENTICAL(str, "{}");
	if (!(_0)) {
		_0 = ZEPHIR_IS_STRING_IDENTICAL(str, "[]");
	}
	if (_0) {
		RETURN_MM_BOOL(1);
	}
	ZEPHIR_INIT_VAR(_1);
	zephir_json_decode(_1, &(_1), str, 0  TSRMLS_CC);
	ZEPHIR_CALL_FUNCTION(&_2, "json_last_error", NULL, 112);
	zephir_check_call_status();
	RETURN_MM_BOOL(ZEPHIR_IS_LONG_IDENTICAL(_2, 0));

}
Exemple #2
0
/**
 * Starts the session (if headers are already sent the session will not be started)
 */
PHP_METHOD(Phalcon_Session_Adapter, start) {

	zend_bool _2$$3;
	zval *_0 = NULL, *_1$$3, *_3$$3 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_CALL_FUNCTION(&_0, "headers_sent", NULL, 27);
	zephir_check_call_status();
	if (!(zephir_is_true(_0))) {
		_1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_started"), PH_NOISY_CC);
		_2$$3 = !zephir_is_true(_1$$3);
		if (_2$$3) {
			ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "status", NULL, 0);
			zephir_check_call_status();
			_2$$3 = !ZEPHIR_IS_LONG_IDENTICAL(_3$$3, 2);
		}
		if (_2$$3) {
			ZEPHIR_CALL_FUNCTION(NULL, "session_start", NULL, 28);
			zephir_check_call_status();
			if (1) {
				zephir_update_property_this(this_ptr, SL("_started"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC);
			} else {
				zephir_update_property_this(this_ptr, SL("_started"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
			}
			RETURN_MM_BOOL(1);
		}
	}
	RETURN_MM_BOOL(0);

}
PHP_METHOD(Xs_FieldMeta, hasCustomTokenizer) {

	zval *_0;


	_0 = zephir_fetch_nproperty_this(this_ptr, SL("tokenizer"), PH_NOISY_CC);
	RETURN_BOOL(!ZEPHIR_IS_LONG_IDENTICAL(_0, 0));

}
Exemple #4
0
/**
 * Returns true if sort order is high to low.
 *
 * @return boolean True if sort order is high-to-low, otherwise false.
 */
PHP_METHOD(Xpl_Event_Manager, isHighToLow) {

	zval *_0;


	_0 = zephir_fetch_nproperty_this(this_ptr, SL("sortOrder"), PH_NOISY_CC);
	RETURN_BOOL(ZEPHIR_IS_LONG_IDENTICAL(_0, 1));

}
/**
 * Returns a cached content
 */
PHP_METHOD(Phalcon_Cache_Backend_Libmemcached, get) {

	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *keyName_param = NULL, *lifetime = NULL, lifetime_sub, __$null, memcache, prefixedKey, cachedContent, _0, _1, _2;
	zval keyName;
	zval *this_ptr = getThis();

	ZVAL_UNDEF(&keyName);
	ZVAL_UNDEF(&lifetime_sub);
	ZVAL_NULL(&__$null);
	ZVAL_UNDEF(&memcache);
	ZVAL_UNDEF(&prefixedKey);
	ZVAL_UNDEF(&cachedContent);
	ZVAL_UNDEF(&_0);
	ZVAL_UNDEF(&_1);
	ZVAL_UNDEF(&_2);

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &keyName_param, &lifetime);

	zephir_get_strval(&keyName, keyName_param);
	if (!lifetime) {
		lifetime = &lifetime_sub;
		lifetime = &__$null;
	}


	ZEPHIR_OBS_VAR(&memcache);
	zephir_read_property(&memcache, this_ptr, SL("_memcache"), PH_NOISY_CC);
	if (Z_TYPE_P(&memcache) != IS_OBJECT) {
		ZEPHIR_CALL_METHOD(NULL, this_ptr, "_connect", NULL, 0);
		zephir_check_call_status();
		ZEPHIR_OBS_NVAR(&memcache);
		zephir_read_property(&memcache, this_ptr, SL("_memcache"), PH_NOISY_CC);
	}
	zephir_read_property(&_0, this_ptr, SL("_prefix"), PH_NOISY_CC | PH_READONLY);
	ZEPHIR_INIT_VAR(&prefixedKey);
	ZEPHIR_CONCAT_VV(&prefixedKey, &_0, &keyName);
	zephir_update_property_zval(this_ptr, SL("_lastKey"), &prefixedKey);
	ZEPHIR_CALL_METHOD(&cachedContent, &memcache, "get", NULL, 0, &prefixedKey);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&_1, &memcache, "getresultcode", NULL, 0);
	zephir_check_call_status();
	if (ZEPHIR_IS_LONG_IDENTICAL(&_1, 16)) {
		RETURN_MM_NULL();
	}
	if (zephir_is_numeric(&cachedContent)) {
		RETURN_CCTOR(&cachedContent);
	}
	zephir_read_property(&_2, this_ptr, SL("_frontend"), PH_NOISY_CC | PH_READONLY);
	ZEPHIR_RETURN_CALL_METHOD(&_2, "afterretrieve", NULL, 0, &cachedContent);
	zephir_check_call_status();
	RETURN_MM();

}
Exemple #6
0
PHP_METHOD(Xpl_Collection_ObjectSet, isEmpty) {

	zval *_0 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_CALL_METHOD(&_0, this_ptr, "count", NULL, 0);
	zephir_check_call_status();
	RETURN_MM_BOOL(ZEPHIR_IS_LONG_IDENTICAL(_0, 0));

}
Exemple #7
0
PHP_METHOD(Test_Statements, test544Issue) {

	zephir_fcall_cache_entry *_8 = NULL;
	zval *step_param = NULL, *_0, *_1, *_2, *_3, *_4, *_5, _6 = zval_used_for_init, *_7 = NULL, *_9, *_10, *_11 = NULL;
	int step, filledWidth, unfilledWidth, ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &step_param);

	if (unlikely(Z_TYPE_P(step_param) != IS_LONG)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'step' must be a long/integer") TSRMLS_CC);
		RETURN_MM_NULL();
	}

	step = Z_LVAL_P(step_param);


	_0 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC);
	_1 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC);
	if (ZEPHIR_GT_LONG(_0, step)) {
		_2 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		_3 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC);
		filledWidth = (long) ((zephir_safe_div_long_zval(((zephir_get_numberval(_2) - 1)), _3 TSRMLS_CC) * step));
		_4 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		unfilledWidth = (((zephir_get_numberval(_4) - 1)) - filledWidth);
		_5 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC);
		ZEPHIR_SINIT_VAR(_6);
		ZVAL_LONG(&_6, filledWidth);
		ZEPHIR_CALL_FUNCTION(&_7, "str_repeat", &_8, 17, _5, &_6);
		zephir_check_call_status();
		_9 = zephir_fetch_nproperty_this(this_ptr, SL("arrow"), PH_NOISY_CC);
		_10 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC);
		ZEPHIR_SINIT_NVAR(_6);
		ZVAL_LONG(&_6, unfilledWidth);
		ZEPHIR_CALL_FUNCTION(&_11, "str_repeat", &_8, 17, _10, &_6);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VVV(return_value, _7, _9, _11);
		RETURN_MM();
	} else if (ZEPHIR_IS_LONG_IDENTICAL(_1, step)) {
		_2 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC);
		_3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, _2, _3);
		zephir_check_call_status();
		RETURN_MM();
	} else {
		_2 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC);
		_3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, _2, _3);
		zephir_check_call_status();
		RETURN_MM();
	}

}
PHP_METHOD(Test_BranchPrediction, testUnlikely2) {

	zval *a;

	zephir_fetch_params(0, 1, 0, &a);



	if (likely(ZEPHIR_IS_LONG_IDENTICAL(a, 1))) {
		RETURN_BOOL(1);
	} else {
		RETURN_BOOL(0);
	}

}
Exemple #9
0
/**
 * Check on empty
 */
PHP_METHOD(Phalcon_Validation_Validator_File, isAllowEmpty) {

	zend_bool _0, _1;
	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval field;
	zval *validation, validation_sub, *field_param = NULL, value, _2;
	zval *this_ptr = getThis();

	ZVAL_UNDEF(&validation_sub);
	ZVAL_UNDEF(&value);
	ZVAL_UNDEF(&_2);
	ZVAL_UNDEF(&field);

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &validation, &field_param);

	if (UNEXPECTED(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be of the type string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (EXPECTED(Z_TYPE_P(field_param) == IS_STRING)) {
		zephir_get_strval(&field, field_param);
	} else {
		ZEPHIR_INIT_VAR(&field);
		ZVAL_EMPTY_STRING(&field);
	}


	ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, &field);
	zephir_check_call_status();
	_0 = ZEPHIR_IS_EMPTY(&value);
	if (!(_0)) {
		_1 = zephir_array_isset_string(&value, SL("error"));
		if (_1) {
			zephir_array_fetch_string(&_2, &value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 299 TSRMLS_CC);
			_1 = ZEPHIR_IS_LONG_IDENTICAL(&_2, 4);
		}
		_0 = _1;
	}
	RETURN_MM_BOOL(_0);

}
PHP_METHOD(Xs_FieldMeta, isBoolIndex) {

	zend_bool _2;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *_0, *_1 = NULL, *_3;

	ZEPHIR_MM_GROW();

	_0 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
	if (((int) (zephir_get_numberval(_0)) & 0x80)) {
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_CALL_METHOD(&_1, this_ptr, "hasindex", NULL, 0);
	zephir_check_call_status();
	_2 = !zephir_is_true(_1);
	if (!(_2)) {
		_3 = zephir_fetch_nproperty_this(this_ptr, SL("tokenizer"), PH_NOISY_CC);
		_2 = !ZEPHIR_IS_LONG_IDENTICAL(_3, 0);
	}
	RETURN_MM_BOOL(_2);

}
Exemple #11
0
/**
 * Sets the listener priority sort order.
 *
 * Tip: you can also use PHP's SORT_ASC and SORT_DESC
 *
 * @param int order One of self::LOW_TO_HIGH or self::HIGH_TO_LOW
 * @return \Xpl\Event\Manager
 *
 * @throws \DomainException if order is not one of the class constants.
 */
PHP_METHOD(Xpl_Event_Manager, setSortOrder) {

	zend_bool _0;
	zval *order_param = NULL, *_1, *_2 = NULL, *_3;
	int order;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &order_param);

	order = zephir_get_intval(order_param);


	_0 = order != 0;
	if (_0) {
		_0 = order != 1;
	}
	if (_0) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_DomainException, "Invalid sort order.", "xpl/event/manager.zep", 317);
		return;
	}
	ZEPHIR_INIT_ZVAL_NREF(_1);
	ZVAL_LONG(_1, order);
	zephir_update_property_this(this_ptr, SL("sortOrder"), _1 TSRMLS_CC);
	ZEPHIR_INIT_VAR(_2);
	_1 = zephir_fetch_nproperty_this(this_ptr, SL("sortOrder"), PH_NOISY_CC);
	if (ZEPHIR_IS_LONG_IDENTICAL(_1, 0)) {
		ZEPHIR_INIT_NVAR(_2);
		ZVAL_STRING(_2, "Asc", 1);
	} else {
		ZEPHIR_INIT_NVAR(_2);
		ZVAL_STRING(_2, "Desc", 1);
	}
	ZEPHIR_INIT_VAR(_3);
	ZEPHIR_CONCAT_SV(_3, "sortListeners", _2);
	zephir_update_property_this(this_ptr, SL("sortFunction"), _3 TSRMLS_CC);
	RETURN_THIS();

}
Exemple #12
0
/**
 * Check on empty
 */
PHP_METHOD(Phalcon_Validation_Validator_File, isAllowEmpty) {

	zend_bool _0, _1;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *field = NULL;
	zval *validation, *field_param = NULL, *value = NULL, *_2;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &validation, &field_param);

	if (unlikely(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(field_param) == IS_STRING)) {
		zephir_get_strval(field, field_param);
	} else {
		ZEPHIR_INIT_VAR(field);
		ZVAL_EMPTY_STRING(field);
	}


	ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
	zephir_check_call_status();
	_0 = ZEPHIR_IS_EMPTY(value);
	if (!(_0)) {
		_1 = zephir_array_isset_string(value, SS("error"));
		if (_1) {
			zephir_array_fetch_string(&_2, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 319 TSRMLS_CC);
			_1 = ZEPHIR_IS_LONG_IDENTICAL(_2, 4);
		}
		_0 = _1;
	}
	RETURN_MM_BOOL(_0);

}
/**
 * Changes internal pointer to a specific position in the resultset
 * Set new position if required and set this->_row
 */
PHP_METHOD(Phalcon_Mvc_Model_Resultset, seek) {

	zend_bool _1, _7$$3;
	zephir_fcall_cache_entry *_16 = NULL;
	zval *position_param = NULL, *result = NULL, *row = NULL, *_0, *_2, *_3$$3, *_6$$3, *_8$$3, *_10$$3, *_14$$3, *_17$$3, *_4$$4, *_5$$4, *_9$$6 = NULL, *_11$$7, *_12$$7 = NULL, *_13$$7, *_15$$8 = NULL;
	int position, ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &position_param);

	position = zephir_get_intval(position_param);


	_0 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
	_1 = !ZEPHIR_IS_LONG(_0, position);
	if (!(_1)) {
		_2 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC);
		_1 = Z_TYPE_P(_2) == IS_NULL;
	}
	if (_1) {
		ZEPHIR_OBS_VAR(_3$$3);
		zephir_read_property_this(&_3$$3, this_ptr, SL("_rows"), PH_NOISY_CC);
		if (Z_TYPE_P(_3$$3) == IS_ARRAY) {
			ZEPHIR_OBS_VAR(row);
			_4$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_rows"), PH_NOISY_CC);
			if (zephir_array_isset_long_fetch(&row, _4$$4, position, 0 TSRMLS_CC)) {
				zephir_update_property_this(this_ptr, SL("_row"), row TSRMLS_CC);
			}
			ZEPHIR_INIT_ZVAL_NREF(_5$$4);
			ZVAL_LONG(_5$$4, position);
			zephir_update_property_this(this_ptr, SL("_pointer"), _5$$4 TSRMLS_CC);
			zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC);
			RETURN_MM_NULL();
		}
		ZEPHIR_OBS_VAR(result);
		zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
		_6$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC);
		_7$$3 = Z_TYPE_P(_6$$3) == IS_NULL;
		if (_7$$3) {
			_8$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
			_7$$3 = ZEPHIR_IS_LONG_IDENTICAL(_8$$3, 0);
		}
		if (_7$$3) {
			ZEPHIR_CALL_METHOD(&_9$$6, result, "fetch", NULL, 0);
			zephir_check_call_status();
			zephir_update_property_this(this_ptr, SL("_row"), _9$$6 TSRMLS_CC);
		}
		_10$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
		if (ZEPHIR_GT_LONG(_10$$3, position)) {
			ZEPHIR_INIT_VAR(_11$$7);
			ZVAL_LONG(_11$$7, position);
			ZEPHIR_CALL_METHOD(NULL, result, "dataseek", NULL, 0, _11$$7);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_12$$7, result, "fetch", NULL, 0);
			zephir_check_call_status();
			zephir_update_property_this(this_ptr, SL("_row"), _12$$7 TSRMLS_CC);
			ZEPHIR_INIT_ZVAL_NREF(_13$$7);
			ZVAL_LONG(_13$$7, position);
			zephir_update_property_this(this_ptr, SL("_pointer"), _13$$7 TSRMLS_CC);
		}
		while (1) {
			_14$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
			if (!(ZEPHIR_LT_LONG(_14$$3, position))) {
				break;
			}
			ZEPHIR_CALL_METHOD(&_15$$8, result, "fetch", &_16, 0);
			zephir_check_call_status();
			zephir_update_property_this(this_ptr, SL("_row"), _15$$8 TSRMLS_CC);
			RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_pointer") TSRMLS_CC));
		}
		ZEPHIR_INIT_ZVAL_NREF(_17$$3);
		ZVAL_LONG(_17$$3, position);
		zephir_update_property_this(this_ptr, SL("_pointer"), _17$$3 TSRMLS_CC);
		zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC);
	}
	ZEPHIR_MM_RESTORE();

}
Exemple #14
0
/**
 * Executes the validation
 */
PHP_METHOD(Phalcon_Validation_Validator_File, validate) {

	zend_bool _1, _2, _3, _5, _6, _13, _14, _16, _22, _23, _53, _60$$16, _67$$21;
	zephir_fcall_cache_entry *_11 = NULL, *_12 = NULL, *_36 = NULL;
	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *field = NULL;
	zval *validation, *field_param = NULL, *_SERVER, *_POST, *_FILES, *value = NULL, *message = NULL, *label = NULL, *replacePairs = NULL, *types = NULL, *byteUnits = NULL, *unit = NULL, *maxSize = NULL, *matches = NULL, *bytes = NULL, *mime = NULL, *tmp = NULL, *width = NULL, *height = NULL, *minResolution = NULL, *maxResolution = NULL, *minWidth = NULL, *maxWidth = NULL, *minHeight = NULL, *maxHeight = NULL, *fieldTypes = NULL, *code = NULL, *minResolutionArray = NULL, *maxResolutionArray = NULL, *_0, *_4, *_7, *_15, *_17, *_18 = NULL, *_27 = NULL, *_28 = NULL, *_45 = NULL, *_52 = NULL, *_54 = NULL, *_8$$3 = NULL, *_9$$3 = NULL, *_10$$3 = NULL, *_19$$4 = NULL, *_20$$4 = NULL, *_21$$4 = NULL, *_24$$5 = NULL, *_25$$5 = NULL, *_26$$5 = NULL, *_29$$6 = NULL, *_31$$6, *_32$$6, *_33$$6, *_34$$6, *_35$$6 = NULL, *_37$$6, *_38$$6, _39$$6, *_40$$6, *_41$$6 = NULL, *_30$$7, *_42$$9 = NULL, *_43$$9 = NULL, *_44$$9 = NULL, *_46$$10, _47$$13, *_48$$13, *_49$$15 = NULL, *_50$$15 = NULL, *_51$$15 = NULL, *_55$$16, *_56$$16 = NULL, *_57$$16 = NULL, *_64$$16 = NULL, *_58$$17, *_59$$18, *_61$$20 = NULL, *_62$$20 = NULL, *_63$$20 = NULL, *_65$$21, *_66$$22, *_68$$23 = NULL, *_69$$23 = NULL, *_70$$23 = NULL;

	ZEPHIR_MM_GROW();
	zephir_get_global(&_FILES, SS("_FILES") TSRMLS_CC);
	zephir_get_global(&_POST, SS("_POST") TSRMLS_CC);
	zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);
	zephir_fetch_params(1, 2, 0, &validation, &field_param);

	if (UNEXPECTED(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (EXPECTED(Z_TYPE_P(field_param) == IS_STRING)) {
		zephir_get_strval(field, field_param);
	} else {
		ZEPHIR_INIT_VAR(field);
		ZVAL_EMPTY_STRING(field);
	}


	ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&label, this_ptr, "preparelabel", NULL, 0, validation, field);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&code, this_ptr, "preparecode", NULL, 0, field);
	zephir_check_call_status();
	zephir_array_fetch_string(&_0, _SERVER, SL("REQUEST_METHOD"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 109 TSRMLS_CC);
	_1 = ZEPHIR_IS_STRING(_0, "POST");
	if (_1) {
		_1 = ZEPHIR_IS_EMPTY(_POST);
	}
	_2 = _1;
	if (_2) {
		_2 = ZEPHIR_IS_EMPTY(_FILES);
	}
	_3 = _2;
	if (_3) {
		zephir_array_fetch_string(&_4, _SERVER, SL("CONTENT_LENGTH"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 109 TSRMLS_CC);
		_3 = ZEPHIR_GT_LONG(_4, 0);
	}
	_5 = _3;
	if (!(_5)) {
		_6 = zephir_array_isset_string(value, SS("error"));
		if (_6) {
			zephir_array_fetch_string(&_7, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 109 TSRMLS_CC);
			_6 = ZEPHIR_IS_LONG_IDENTICAL(_7, 1);
		}
		_5 = _6;
	}
	if (_5) {
		ZEPHIR_INIT_VAR(_8$$3);
		ZVAL_STRING(_8$$3, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_INIT_VAR(_9$$3);
		ZVAL_STRING(_9$$3, "messageIniSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _8$$3, _9$$3);
		zephir_check_temp_parameter(_8$$3);
		zephir_check_temp_parameter(_9$$3);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(_8$$3);
		object_init_ex(_8$$3, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_10$$3, "strtr", &_11, 27, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(_9$$3);
		ZVAL_STRING(_9$$3, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _8$$3, "__construct", &_12, 475, _10$$3, field, _9$$3, code);
		zephir_check_temp_parameter(_9$$3);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _8$$3);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	_13 = !(zephir_array_isset_string(value, SS("error")));
	if (!(_13)) {
		_13 = !(zephir_array_isset_string(value, SS("tmp_name")));
	}
	_14 = _13;
	if (!(_14)) {
		zephir_array_fetch_string(&_15, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 124 TSRMLS_CC);
		_14 = !ZEPHIR_IS_LONG_IDENTICAL(_15, 0);
	}
	_16 = _14;
	if (!(_16)) {
		zephir_array_fetch_string(&_17, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 124 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_18, "is_uploaded_file", NULL, 253, _17);
		zephir_check_call_status();
		_16 = !zephir_is_true(_18);
	}
	if (_16) {
		ZEPHIR_INIT_VAR(_19$$4);
		ZVAL_STRING(_19$$4, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_INIT_VAR(_20$$4);
		ZVAL_STRING(_20$$4, "messageEmpty", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _19$$4, _20$$4);
		zephir_check_temp_parameter(_19$$4);
		zephir_check_temp_parameter(_20$$4);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(_19$$4);
		object_init_ex(_19$$4, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_21$$4, "strtr", &_11, 27, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(_20$$4);
		ZVAL_STRING(_20$$4, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _19$$4, "__construct", &_12, 475, _21$$4, field, _20$$4, code);
		zephir_check_temp_parameter(_20$$4);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _19$$4);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	_22 = !(zephir_array_isset_string(value, SS("name")));
	if (!(_22)) {
		_22 = !(zephir_array_isset_string(value, SS("type")));
	}
	_23 = _22;
	if (!(_23)) {
		_23 = !(zephir_array_isset_string(value, SS("size")));
	}
	if (_23) {
		ZEPHIR_INIT_VAR(_24$$5);
		ZVAL_STRING(_24$$5, "FileValid", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_INIT_VAR(_25$$5);
		ZVAL_STRING(_25$$5, "messageValid", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _24$$5, _25$$5);
		zephir_check_temp_parameter(_24$$5);
		zephir_check_temp_parameter(_25$$5);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(_24$$5);
		object_init_ex(_24$$5, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_26$$5, "strtr", &_11, 27, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(_25$$5);
		ZVAL_STRING(_25$$5, "FileValid", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _24$$5, "__construct", &_12, 475, _26$$5, field, _25$$5, code);
		zephir_check_temp_parameter(_25$$5);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _24$$5);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_INIT_VAR(_28);
	ZVAL_STRING(_28, "maxSize", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_27, this_ptr, "hasoption", NULL, 0, _28);
	zephir_check_temp_parameter(_28);
	zephir_check_call_status();
	if (zephir_is_true(_27)) {
		ZEPHIR_INIT_VAR(byteUnits);
		zephir_create_array(byteUnits, 9, 0 TSRMLS_CC);
		add_assoc_long_ex(byteUnits, SS("B"), 0);
		add_assoc_long_ex(byteUnits, SS("K"), 10);
		add_assoc_long_ex(byteUnits, SS("M"), 20);
		add_assoc_long_ex(byteUnits, SS("G"), 30);
		add_assoc_long_ex(byteUnits, SS("T"), 40);
		add_assoc_long_ex(byteUnits, SS("KB"), 10);
		add_assoc_long_ex(byteUnits, SS("MB"), 20);
		add_assoc_long_ex(byteUnits, SS("GB"), 30);
		add_assoc_long_ex(byteUnits, SS("TB"), 40);
		ZEPHIR_INIT_VAR(_29$$6);
		ZVAL_STRING(_29$$6, "maxSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&maxSize, this_ptr, "getoption", NULL, 0, _29$$6);
		zephir_check_temp_parameter(_29$$6);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(matches);
		ZVAL_NULL(matches);
		ZEPHIR_INIT_VAR(unit);
		ZVAL_STRING(unit, "B", 1);
		if (Z_TYPE_P(maxSize) == IS_ARRAY) {
			zephir_array_fetch(&_30$$7, maxSize, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 162 TSRMLS_CC);
			ZEPHIR_CPY_WRT(maxSize, _30$$7);
		}
		ZEPHIR_INIT_NVAR(_29$$6);
		ZEPHIR_INIT_VAR(_31$$6);
		ZEPHIR_INIT_VAR(_32$$6);
		zephir_array_keys(_32$$6, byteUnits TSRMLS_CC);
		zephir_fast_join_str(_31$$6, SL("|"), _32$$6 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_33$$6);
		ZEPHIR_CONCAT_SVS(_33$$6, "/^([0-9]+(?:\\.[0-9]+)?)(", _31$$6, ")?$/Di");
		zephir_preg_match(_29$$6, _33$$6, maxSize, matches, 0, 0 , 0  TSRMLS_CC);
		if (zephir_array_isset_long(matches, 2)) {
			ZEPHIR_OBS_NVAR(unit);
			zephir_array_fetch_long(&unit, matches, 2, PH_NOISY, "phalcon/validation/validator/file.zep", 168 TSRMLS_CC);
		}
		zephir_array_fetch_long(&_34$$6, matches, 1, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 171 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_35$$6, "floatval", &_36, 328, _34$$6);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_37$$6);
		zephir_array_fetch(&_38$$6, byteUnits, unit, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 171 TSRMLS_CC);
		ZEPHIR_SINIT_VAR(_39$$6);
		ZVAL_LONG(&_39$$6, 2);
		zephir_pow_function(_37$$6, &_39$$6, _38$$6);
		ZEPHIR_INIT_VAR(bytes);
		mul_function(bytes, _35$$6, _37$$6 TSRMLS_CC);
		zephir_array_fetch_string(&_40$$6, value, SL("size"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 173 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_35$$6, "floatval", &_36, 328, _40$$6);
		zephir_check_call_status();
		ZEPHIR_CALL_FUNCTION(&_41$$6, "floatval", &_36, 328, bytes);
		zephir_check_call_status();
		if (ZEPHIR_GT(_35$$6, _41$$6)) {
			ZEPHIR_INIT_VAR(_42$$9);
			ZVAL_STRING(_42$$9, "FileSize", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_INIT_VAR(_43$$9);
			ZVAL_STRING(_43$$9, "messageSize", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _42$$9, _43$$9);
			zephir_check_temp_parameter(_42$$9);
			zephir_check_temp_parameter(_43$$9);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_42$$9);
			object_init_ex(_42$$9, phalcon_validation_message_ce);
			ZEPHIR_CALL_FUNCTION(&_44$$9, "strtr", &_11, 27, message, replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_43$$9);
			ZVAL_STRING(_43$$9, "FileSize", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(NULL, _42$$9, "__construct", &_12, 475, _44$$9, field, _43$$9, code);
			zephir_check_temp_parameter(_43$$9);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _42$$9);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
	}
	ZEPHIR_INIT_NVAR(_28);
	ZVAL_STRING(_28, "allowedTypes", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_45, this_ptr, "hasoption", NULL, 0, _28);
	zephir_check_temp_parameter(_28);
	zephir_check_call_status();
	if (zephir_is_true(_45)) {
		ZEPHIR_INIT_VAR(_46$$10);
		ZVAL_STRING(_46$$10, "allowedTypes", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&types, this_ptr, "getoption", NULL, 0, _46$$10);
		zephir_check_temp_parameter(_46$$10);
		zephir_check_call_status();
		ZEPHIR_OBS_VAR(fieldTypes);
		if (zephir_array_isset_fetch(&fieldTypes, types, field, 0 TSRMLS_CC)) {
			ZEPHIR_CPY_WRT(types, fieldTypes);
		}
		if (Z_TYPE_P(types) != IS_ARRAY) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Option 'allowedTypes' must be an array", "phalcon/validation/validator/file.zep", 198);
			return;
		}
		if ((zephir_function_exists_ex(SS("finfo_open") TSRMLS_CC) == SUCCESS)) {
			ZEPHIR_SINIT_VAR(_47$$13);
			ZVAL_LONG(&_47$$13, 16);
			ZEPHIR_CALL_FUNCTION(&tmp, "finfo_open", NULL, 250, &_47$$13);
			zephir_check_call_status();
			zephir_array_fetch_string(&_48$$13, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 203 TSRMLS_CC);
			ZEPHIR_CALL_FUNCTION(&mime, "finfo_file", NULL, 251, tmp, _48$$13);
			zephir_check_call_status();
			ZEPHIR_CALL_FUNCTION(NULL, "finfo_close", NULL, 252, tmp);
			zephir_check_call_status();
		} else {
			ZEPHIR_OBS_NVAR(mime);
			zephir_array_fetch_string(&mime, value, SL("type"), PH_NOISY, "phalcon/validation/validator/file.zep", 207 TSRMLS_CC);
		}
		if (!(zephir_fast_in_array(mime, types TSRMLS_CC))) {
			ZEPHIR_INIT_VAR(_49$$15);
			ZVAL_STRING(_49$$15, "FileType", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_INIT_VAR(_50$$15);
			ZVAL_STRING(_50$$15, "messageType", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _49$$15, _50$$15);
			zephir_check_temp_parameter(_49$$15);
			zephir_check_temp_parameter(_50$$15);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(replacePairs);
			zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			ZEPHIR_INIT_NVAR(_49$$15);
			zephir_fast_join_str(_49$$15, SL(", "), types TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":types"), &_49$$15, PH_COPY | PH_SEPARATE);
			ZEPHIR_INIT_NVAR(_49$$15);
			object_init_ex(_49$$15, phalcon_validation_message_ce);
			ZEPHIR_CALL_FUNCTION(&_51$$15, "strtr", &_11, 27, message, replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_50$$15);
			ZVAL_STRING(_50$$15, "FileType", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(NULL, _49$$15, "__construct", &_12, 475, _51$$15, field, _50$$15, code);
			zephir_check_temp_parameter(_50$$15);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _49$$15);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
	}
	ZEPHIR_INIT_NVAR(_28);
	ZVAL_STRING(_28, "minResolution", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_52, this_ptr, "hasoption", NULL, 0, _28);
	zephir_check_temp_parameter(_28);
	zephir_check_call_status();
	_53 = zephir_is_true(_52);
	if (!(_53)) {
		ZEPHIR_INIT_NVAR(_28);
		ZVAL_STRING(_28, "maxResolution", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_54, this_ptr, "hasoption", NULL, 0, _28);
		zephir_check_temp_parameter(_28);
		zephir_check_call_status();
		_53 = zephir_is_true(_54);
	}
	if (_53) {
		zephir_array_fetch_string(&_55$$16, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 228 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 261, _55$$16);
		zephir_check_call_status();
		ZEPHIR_OBS_VAR(width);
		zephir_array_fetch_long(&width, tmp, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 229 TSRMLS_CC);
		ZEPHIR_OBS_VAR(height);
		zephir_array_fetch_long(&height, tmp, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 230 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_57$$16);
		ZVAL_STRING(_57$$16, "minResolution", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_56$$16, this_ptr, "hasoption", NULL, 0, _57$$16);
		zephir_check_temp_parameter(_57$$16);
		zephir_check_call_status();
		if (zephir_is_true(_56$$16)) {
			ZEPHIR_INIT_VAR(_58$$17);
			ZVAL_STRING(_58$$17, "minResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&minResolution, this_ptr, "getoption", NULL, 0, _58$$17);
			zephir_check_temp_parameter(_58$$17);
			zephir_check_call_status();
			if (Z_TYPE_P(minResolution) == IS_ARRAY) {
				zephir_array_fetch(&_59$$18, minResolution, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 235 TSRMLS_CC);
				ZEPHIR_CPY_WRT(minResolution, _59$$18);
			}
			ZEPHIR_INIT_VAR(minResolutionArray);
			zephir_fast_explode_str(minResolutionArray, SL("x"), minResolution, LONG_MAX TSRMLS_CC);
			ZEPHIR_OBS_VAR(minWidth);
			zephir_array_fetch_long(&minWidth, minResolutionArray, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 238 TSRMLS_CC);
			ZEPHIR_OBS_VAR(minHeight);
			zephir_array_fetch_long(&minHeight, minResolutionArray, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 239 TSRMLS_CC);
		} else {
			ZEPHIR_INIT_NVAR(minWidth);
			ZVAL_LONG(minWidth, 1);
			ZEPHIR_INIT_NVAR(minHeight);
			ZVAL_LONG(minHeight, 1);
		}
		_60$$16 = ZEPHIR_LT(width, minWidth);
		if (!(_60$$16)) {
			_60$$16 = ZEPHIR_LT(height, minHeight);
		}
		if (_60$$16) {
			ZEPHIR_INIT_VAR(_61$$20);
			ZVAL_STRING(_61$$20, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_INIT_VAR(_62$$20);
			ZVAL_STRING(_62$$20, "messageMinResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _61$$20, _62$$20);
			zephir_check_temp_parameter(_61$$20);
			zephir_check_temp_parameter(_62$$20);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(replacePairs);
			zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			zephir_array_update_string(&replacePairs, SL(":min"), &minResolution, PH_COPY | PH_SEPARATE);
			ZEPHIR_INIT_NVAR(_61$$20);
			object_init_ex(_61$$20, phalcon_validation_message_ce);
			ZEPHIR_CALL_FUNCTION(&_63$$20, "strtr", &_11, 27, message, replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_62$$20);
			ZVAL_STRING(_62$$20, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(NULL, _61$$20, "__construct", &_12, 475, _63$$20, field, _62$$20, code);
			zephir_check_temp_parameter(_62$$20);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _61$$20);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
		ZEPHIR_INIT_NVAR(_57$$16);
		ZVAL_STRING(_57$$16, "maxResolution", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_64$$16, this_ptr, "hasoption", NULL, 0, _57$$16);
		zephir_check_temp_parameter(_57$$16);
		zephir_check_call_status();
		if (zephir_is_true(_64$$16)) {
			ZEPHIR_INIT_VAR(_65$$21);
			ZVAL_STRING(_65$$21, "maxResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&maxResolution, this_ptr, "getoption", NULL, 0, _65$$21);
			zephir_check_temp_parameter(_65$$21);
			zephir_check_call_status();
			if (Z_TYPE_P(maxResolution) == IS_ARRAY) {
				zephir_array_fetch(&_66$$22, maxResolution, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 265 TSRMLS_CC);
				ZEPHIR_CPY_WRT(maxResolution, _66$$22);
			}
			ZEPHIR_INIT_VAR(maxResolutionArray);
			zephir_fast_explode_str(maxResolutionArray, SL("x"), maxResolution, LONG_MAX TSRMLS_CC);
			ZEPHIR_OBS_VAR(maxWidth);
			zephir_array_fetch_long(&maxWidth, maxResolutionArray, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 268 TSRMLS_CC);
			ZEPHIR_OBS_VAR(maxHeight);
			zephir_array_fetch_long(&maxHeight, maxResolutionArray, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 269 TSRMLS_CC);
			_67$$21 = ZEPHIR_GT(width, maxWidth);
			if (!(_67$$21)) {
				_67$$21 = ZEPHIR_GT(height, maxHeight);
			}
			if (_67$$21) {
				ZEPHIR_INIT_VAR(_68$$23);
				ZVAL_STRING(_68$$23, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_INIT_VAR(_69$$23);
				ZVAL_STRING(_69$$23, "messageMaxResolution", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _68$$23, _69$$23);
				zephir_check_temp_parameter(_68$$23);
				zephir_check_temp_parameter(_69$$23);
				zephir_check_call_status();
				ZEPHIR_INIT_NVAR(replacePairs);
				zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
				zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
				zephir_array_update_string(&replacePairs, SL(":max"), &maxResolution, PH_COPY | PH_SEPARATE);
				ZEPHIR_INIT_NVAR(_68$$23);
				object_init_ex(_68$$23, phalcon_validation_message_ce);
				ZEPHIR_CALL_FUNCTION(&_70$$23, "strtr", &_11, 27, message, replacePairs);
				zephir_check_call_status();
				ZEPHIR_INIT_NVAR(_69$$23);
				ZVAL_STRING(_69$$23, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(NULL, _68$$23, "__construct", &_12, 475, _70$$23, field, _69$$23, code);
				zephir_check_temp_parameter(_69$$23);
				zephir_check_call_status();
				ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _68$$23);
				zephir_check_call_status();
				RETURN_MM_BOOL(0);
			}
		}
	}
	RETURN_MM_BOOL(1);

}
Exemple #15
0
PHP_METHOD(Test_Statements, test544Issue) {

	zephir_fcall_cache_entry *_8 = NULL;
	zval *step_param = NULL, _0, _1, _2$$3, _3$$3, _4$$3, _5$$3, _6$$3, _7$$3, _9$$3, _10$$3, _11$$3, _12$$4, _13$$4, _14$$5, _15$$5;
	int step, ZEPHIR_LAST_CALL_STATUS, filledWidth = 0, unfilledWidth = 0;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&_0);
	ZVAL_UNDEF(&_1);
	ZVAL_UNDEF(&_2$$3);
	ZVAL_UNDEF(&_3$$3);
	ZVAL_UNDEF(&_4$$3);
	ZVAL_UNDEF(&_5$$3);
	ZVAL_UNDEF(&_6$$3);
	ZVAL_UNDEF(&_7$$3);
	ZVAL_UNDEF(&_9$$3);
	ZVAL_UNDEF(&_10$$3);
	ZVAL_UNDEF(&_11$$3);
	ZVAL_UNDEF(&_12$$4);
	ZVAL_UNDEF(&_13$$4);
	ZVAL_UNDEF(&_14$$5);
	ZVAL_UNDEF(&_15$$5);

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &step_param);

	if (unlikely(Z_TYPE_P(step_param) != IS_LONG)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'step' must be a int") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	step = Z_LVAL_P(step_param);


	zephir_read_property(&_0, this_ptr, SL("totalSteps"), PH_NOISY_CC | PH_READONLY);
	zephir_read_property(&_1, this_ptr, SL("totalSteps"), PH_NOISY_CC | PH_READONLY);
	if (ZEPHIR_GT_LONG(&_0, step)) {
		zephir_read_property(&_2$$3, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY);
		zephir_read_property(&_3$$3, this_ptr, SL("totalSteps"), PH_NOISY_CC | PH_READONLY);
		filledWidth = (long) ((zephir_safe_div_long_zval(((zephir_get_numberval(&_2$$3) - 1)), &_3$$3 TSRMLS_CC) * step));
		zephir_read_property(&_4$$3, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY);
		unfilledWidth = (((zephir_get_numberval(&_4$$3) - 1)) - filledWidth);
		zephir_read_property(&_5$$3, this_ptr, SL("filledChar"), PH_NOISY_CC | PH_READONLY);
		ZVAL_LONG(&_6$$3, filledWidth);
		ZEPHIR_CALL_FUNCTION(&_7$$3, "str_repeat", &_8, 17, &_5$$3, &_6$$3);
		zephir_check_call_status();
		zephir_read_property(&_6$$3, this_ptr, SL("arrow"), PH_NOISY_CC | PH_READONLY);
		zephir_read_property(&_9$$3, this_ptr, SL("unfilledChar"), PH_NOISY_CC | PH_READONLY);
		ZVAL_LONG(&_10$$3, unfilledWidth);
		ZEPHIR_CALL_FUNCTION(&_11$$3, "str_repeat", &_8, 17, &_9$$3, &_10$$3);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VVV(return_value, &_7$$3, &_6$$3, &_11$$3);
		RETURN_MM();
	} else if (ZEPHIR_IS_LONG_IDENTICAL(&_1, step)) {
		zephir_read_property(&_12$$4, this_ptr, SL("filledChar"), PH_NOISY_CC | PH_READONLY);
		zephir_read_property(&_13$$4, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY);
		ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, &_12$$4, &_13$$4);
		zephir_check_call_status();
		RETURN_MM();
	} else {
		zephir_read_property(&_14$$5, this_ptr, SL("unfilledChar"), PH_NOISY_CC | PH_READONLY);
		zephir_read_property(&_15$$5, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY);
		ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, &_14$$5, &_15$$5);
		zephir_check_call_status();
		RETURN_MM();
	}

}
Exemple #16
0
/**
 * Executes the validation
 */
PHP_METHOD(Phalcon_Validation_Validator_File, validate) {

	zephir_fcall_cache_entry *_10 = NULL, *_12 = NULL, *_29 = NULL;
	zend_bool _2, _3, _4, _6, _7, _13, _14, _15, _17, _18, _20, _24, _25, _37, _38, _40;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *field = NULL;
	zval *validation, *field_param = NULL, *value = NULL, *message = NULL, *label = NULL, *replacePairs = NULL, *types = NULL, *byteUnits, *unit = NULL, *maxSize = NULL, *matches, *bytes, *mime = NULL, *tmp = NULL, *width, *height, *minResolution, *maxResolution, *minWidth = NULL, *maxWidth, *minHeight = NULL, *maxHeight, *_0 = NULL, *_SERVER, *_1, *_POST, *_FILES, *_5, *_8, *_9 = NULL, *_11 = NULL, *_16, *_19, *_21, *_22 = NULL, *_23 = NULL, *_26 = NULL, *_27, *_28, *_30 = NULL, *_31, _32 = zval_used_for_init, *_33, *_34 = NULL, *_35 = NULL, *_36, *_39 = NULL, *_41 = NULL;

	ZEPHIR_MM_GROW();
	zephir_get_global(&_FILES, SS("_FILES") TSRMLS_CC);
	zephir_get_global(&_POST, SS("_POST") TSRMLS_CC);
	zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);
	zephir_fetch_params(1, 2, 0, &validation, &field_param);

	if (unlikely(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}

	if (likely(Z_TYPE_P(field_param) == IS_STRING)) {
		zephir_get_strval(field, field_param);
	} else {
		ZEPHIR_INIT_VAR(field);
		ZVAL_EMPTY_STRING(field);
	}


	ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_0);
	ZVAL_STRING(_0, "label", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _0);
	zephir_check_temp_parameter(_0);
	zephir_check_call_status();
	if (ZEPHIR_IS_EMPTY(label)) {
		ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field);
		zephir_check_call_status();
	}
	zephir_array_fetch_string(&_1, _SERVER, SL("REQUEST_METHOD"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 62 TSRMLS_CC);
	_2 = ZEPHIR_IS_STRING(_1, "POST");
	if (_2) {
		_2 = ZEPHIR_IS_EMPTY(_POST);
	}
	_3 = _2;
	if (_3) {
		_3 = ZEPHIR_IS_EMPTY(_FILES);
	}
	_4 = _3;
	if (_4) {
		zephir_array_fetch_string(&_5, _SERVER, SL("CONTENT_LENGTH"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 62 TSRMLS_CC);
		_4 = ZEPHIR_GT_LONG(_5, 0);
	}
	_6 = _4;
	if (!(_6)) {
		_7 = zephir_array_isset_string(value, SS("error"));
		if (_7) {
			zephir_array_fetch_string(&_8, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 62 TSRMLS_CC);
			_7 = ZEPHIR_IS_LONG_IDENTICAL(_8, 1);
		}
		_6 = _7;
	}
	if (_6) {
		ZEPHIR_INIT_NVAR(_0);
		ZVAL_STRING(_0, "messageIniSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _0);
		zephir_check_temp_parameter(_0);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(replacePairs);
		zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		if (ZEPHIR_IS_EMPTY(message)) {
			ZEPHIR_INIT_NVAR(_0);
			ZVAL_STRING(_0, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _0);
			zephir_check_temp_parameter(_0);
			zephir_check_call_status();
		}
		ZEPHIR_INIT_NVAR(_0);
		object_init_ex(_0, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_9, "strtr", &_10, 53, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_11);
		ZVAL_STRING(_11, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_12, 436, _9, field, _11);
		zephir_check_temp_parameter(_11);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _0);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_INIT_NVAR(_11);
	ZVAL_STRING(_11, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_9, this_ptr, "issetoption", NULL, 0, _11);
	zephir_check_temp_parameter(_11);
	zephir_check_call_status();
	_13 = zephir_is_true(_9);
	if (_13) {
		_14 = ZEPHIR_IS_EMPTY(value);
		if (!(_14)) {
			_15 = zephir_array_isset_string(value, SS("error"));
			if (_15) {
				zephir_array_fetch_string(&_16, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 75 TSRMLS_CC);
				_15 = ZEPHIR_IS_LONG_IDENTICAL(_16, 4);
			}
			_14 = _15;
		}
		_13 = _14;
	}
	if (_13) {
		RETURN_MM_BOOL(1);
	}
	_17 = !(zephir_array_isset_string(value, SS("error")));
	if (!(_17)) {
		_17 = !(zephir_array_isset_string(value, SS("tmp_name")));
	}
	_18 = _17;
	if (!(_18)) {
		zephir_array_fetch_string(&_19, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 79 TSRMLS_CC);
		_18 = !ZEPHIR_IS_LONG_IDENTICAL(_19, 0);
	}
	_20 = _18;
	if (!(_20)) {
		zephir_array_fetch_string(&_21, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 79 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_9, "is_uploaded_file", NULL, 232, _21);
		zephir_check_call_status();
		_20 = !zephir_is_true(_9);
	}
	if (_20) {
		ZEPHIR_INIT_NVAR(_11);
		ZVAL_STRING(_11, "messageEmpty", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _11);
		zephir_check_temp_parameter(_11);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(replacePairs);
		zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		if (ZEPHIR_IS_EMPTY(message)) {
			ZEPHIR_INIT_NVAR(_11);
			ZVAL_STRING(_11, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _11);
			zephir_check_temp_parameter(_11);
			zephir_check_call_status();
		}
		ZEPHIR_INIT_NVAR(_11);
		object_init_ex(_11, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_22, "strtr", &_10, 53, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_23);
		ZVAL_STRING(_23, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _11, "__construct", &_12, 436, _22, field, _23);
		zephir_check_temp_parameter(_23);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _11);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	_24 = !(zephir_array_isset_string(value, SS("name")));
	if (!(_24)) {
		_24 = !(zephir_array_isset_string(value, SS("type")));
	}
	_25 = _24;
	if (!(_25)) {
		_25 = !(zephir_array_isset_string(value, SS("size")));
	}
	if (_25) {
		ZEPHIR_INIT_NVAR(_11);
		ZVAL_STRING(_11, "messageValid", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _11);
		zephir_check_temp_parameter(_11);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(replacePairs);
		zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		if (ZEPHIR_IS_EMPTY(message)) {
			ZEPHIR_INIT_NVAR(_11);
			ZVAL_STRING(_11, "FileValid", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _11);
			zephir_check_temp_parameter(_11);
			zephir_check_call_status();
		}
		ZEPHIR_INIT_NVAR(_11);
		object_init_ex(_11, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_9, "strtr", &_10, 53, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(_23);
		ZVAL_STRING(_23, "FileValid", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _11, "__construct", &_12, 436, _9, field, _23);
		zephir_check_temp_parameter(_23);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _11);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_INIT_NVAR(_11);
	ZVAL_STRING(_11, "maxSize", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_9, this_ptr, "issetoption", NULL, 0, _11);
	zephir_check_temp_parameter(_11);
	zephir_check_call_status();
	if (zephir_is_true(_9)) {
		ZEPHIR_INIT_VAR(byteUnits);
		zephir_create_array(byteUnits, 9, 0 TSRMLS_CC);
		add_assoc_long_ex(byteUnits, SS("B"), 0);
		add_assoc_long_ex(byteUnits, SS("K"), 10);
		add_assoc_long_ex(byteUnits, SS("M"), 20);
		add_assoc_long_ex(byteUnits, SS("G"), 30);
		add_assoc_long_ex(byteUnits, SS("T"), 40);
		add_assoc_long_ex(byteUnits, SS("KB"), 10);
		add_assoc_long_ex(byteUnits, SS("MB"), 20);
		add_assoc_long_ex(byteUnits, SS("GB"), 30);
		add_assoc_long_ex(byteUnits, SS("TB"), 40);
		ZEPHIR_INIT_NVAR(_11);
		ZVAL_STRING(_11, "maxSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&maxSize, this_ptr, "getoption", NULL, 0, _11);
		zephir_check_temp_parameter(_11);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(matches);
		ZVAL_NULL(matches);
		ZEPHIR_INIT_VAR(unit);
		ZVAL_STRING(unit, "B", 1);
		ZEPHIR_INIT_NVAR(_11);
		ZEPHIR_INIT_NVAR(_23);
		ZEPHIR_INIT_VAR(_26);
		zephir_array_keys(_26, byteUnits TSRMLS_CC);
		zephir_fast_join_str(_23, SL("|"), _26 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_27);
		ZEPHIR_CONCAT_SVS(_27, "/^([0-9]+(?:\\.[0-9]+)?)(", _23, ")?$/Di");
		zephir_preg_match(_11, _27, maxSize, matches, 0, 0 , 0  TSRMLS_CC);
		if (zephir_array_isset_long(matches, 2)) {
			ZEPHIR_OBS_NVAR(unit);
			zephir_array_fetch_long(&unit, matches, 2, PH_NOISY, "phalcon/validation/validator/file.zep", 115 TSRMLS_CC);
		}
		zephir_array_fetch_long(&_28, matches, 1, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 118 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_22, "floatval", &_29, 311, _28);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_30);
		zephir_array_fetch(&_31, byteUnits, unit, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 118 TSRMLS_CC);
		ZEPHIR_SINIT_VAR(_32);
		ZVAL_LONG(&_32, 2);
		zephir_pow_function(_30, &_32, _31);
		ZEPHIR_INIT_VAR(bytes);
		mul_function(bytes, _22, _30 TSRMLS_CC);
		zephir_array_fetch_string(&_33, value, SL("size"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 120 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_22, "floatval", &_29, 311, _33);
		zephir_check_call_status();
		ZEPHIR_CALL_FUNCTION(&_34, "floatval", &_29, 311, bytes);
		zephir_check_call_status();
		if (ZEPHIR_GT(_22, _34)) {
			ZEPHIR_INIT_NVAR(_30);
			ZVAL_STRING(_30, "messageSize", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _30);
			zephir_check_temp_parameter(_30);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(replacePairs);
			zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			zephir_array_update_string(&replacePairs, SL(":max"), &maxSize, PH_COPY | PH_SEPARATE);
			if (ZEPHIR_IS_EMPTY(message)) {
				ZEPHIR_INIT_NVAR(_30);
				ZVAL_STRING(_30, "FileSize", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _30);
				zephir_check_temp_parameter(_30);
				zephir_check_call_status();
			}
			ZEPHIR_INIT_NVAR(_30);
			object_init_ex(_30, phalcon_validation_message_ce);
			ZEPHIR_CALL_FUNCTION(&_35, "strtr", &_10, 53, message, replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_36);
			ZVAL_STRING(_36, "FileSize", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(NULL, _30, "__construct", &_12, 436, _35, field, _36);
			zephir_check_temp_parameter(_36);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _30);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
	}
	ZEPHIR_INIT_NVAR(_11);
	ZVAL_STRING(_11, "allowedTypes", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_9, this_ptr, "issetoption", NULL, 0, _11);
	zephir_check_temp_parameter(_11);
	zephir_check_call_status();
	if (zephir_is_true(_9)) {
		ZEPHIR_INIT_NVAR(_11);
		ZVAL_STRING(_11, "allowedTypes", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&types, this_ptr, "getoption", NULL, 0, _11);
		zephir_check_temp_parameter(_11);
		zephir_check_call_status();
		if (Z_TYPE_P(types) != IS_ARRAY) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Option 'allowedTypes' must be an array", "phalcon/validation/validator/file.zep", 138);
			return;
		}
		if ((zephir_function_exists_ex(SS("finfo_open") TSRMLS_CC) == SUCCESS)) {
			ZEPHIR_SINIT_NVAR(_32);
			ZVAL_LONG(&_32, 16);
			ZEPHIR_CALL_FUNCTION(&tmp, "finfo_open", NULL, 229, &_32);
			zephir_check_call_status();
			zephir_array_fetch_string(&_28, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 143 TSRMLS_CC);
			ZEPHIR_CALL_FUNCTION(&mime, "finfo_file", NULL, 230, tmp, _28);
			zephir_check_call_status();
			ZEPHIR_CALL_FUNCTION(NULL, "finfo_close", NULL, 231, tmp);
			zephir_check_call_status();
		} else {
			ZEPHIR_OBS_NVAR(mime);
			zephir_array_fetch_string(&mime, value, SL("type"), PH_NOISY, "phalcon/validation/validator/file.zep", 147 TSRMLS_CC);
		}
		if (!(zephir_fast_in_array(mime, types TSRMLS_CC))) {
			ZEPHIR_INIT_NVAR(_11);
			ZVAL_STRING(_11, "messageType", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _11);
			zephir_check_temp_parameter(_11);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(replacePairs);
			zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			ZEPHIR_INIT_NVAR(_11);
			zephir_fast_join_str(_11, SL(", "), types TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":types"), &_11, PH_COPY | PH_SEPARATE);
			if (ZEPHIR_IS_EMPTY(message)) {
				ZEPHIR_INIT_NVAR(_11);
				ZVAL_STRING(_11, "FileType", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _11);
				zephir_check_temp_parameter(_11);
				zephir_check_call_status();
			}
			ZEPHIR_INIT_NVAR(_11);
			object_init_ex(_11, phalcon_validation_message_ce);
			ZEPHIR_CALL_FUNCTION(&_22, "strtr", &_10, 53, message, replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_23);
			ZVAL_STRING(_23, "FileType", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(NULL, _11, "__construct", &_12, 436, _22, field, _23);
			zephir_check_temp_parameter(_23);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _11);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
	}
	ZEPHIR_INIT_NVAR(_11);
	ZVAL_STRING(_11, "minResolution", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_9, this_ptr, "issetoption", NULL, 0, _11);
	zephir_check_temp_parameter(_11);
	zephir_check_call_status();
	_37 = zephir_is_true(_9);
	if (!(_37)) {
		ZEPHIR_INIT_NVAR(_11);
		ZVAL_STRING(_11, "maxResolution", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_22, this_ptr, "issetoption", NULL, 0, _11);
		zephir_check_temp_parameter(_11);
		zephir_check_call_status();
		_37 = zephir_is_true(_22);
	}
	if (_37) {
		zephir_array_fetch_string(&_28, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 164 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 249, _28);
		zephir_check_call_status();
		ZEPHIR_OBS_VAR(width);
		zephir_array_fetch_long(&width, tmp, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 165 TSRMLS_CC);
		ZEPHIR_OBS_VAR(height);
		zephir_array_fetch_long(&height, tmp, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 166 TSRMLS_CC);
		ZEPHIR_INIT_NVAR(_11);
		ZVAL_STRING(_11, "minResolution", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_34, this_ptr, "issetoption", NULL, 0, _11);
		zephir_check_temp_parameter(_11);
		zephir_check_call_status();
		if (zephir_is_true(_34)) {
			ZEPHIR_INIT_NVAR(_11);
			ZVAL_STRING(_11, "minResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&_35, this_ptr, "getoption", NULL, 0, _11);
			zephir_check_temp_parameter(_11);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(minResolution);
			zephir_fast_explode_str(minResolution, SL("x"), _35, LONG_MAX TSRMLS_CC);
			ZEPHIR_OBS_VAR(minWidth);
			zephir_array_fetch_long(&minWidth, minResolution, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 170 TSRMLS_CC);
			ZEPHIR_OBS_VAR(minHeight);
			zephir_array_fetch_long(&minHeight, minResolution, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 171 TSRMLS_CC);
		} else {
			ZEPHIR_INIT_NVAR(minWidth);
			ZVAL_LONG(minWidth, 1);
			ZEPHIR_INIT_NVAR(minHeight);
			ZVAL_LONG(minHeight, 1);
		}
		_38 = ZEPHIR_LT(width, minWidth);
		if (!(_38)) {
			_38 = ZEPHIR_LT(height, minHeight);
		}
		if (_38) {
			ZEPHIR_INIT_NVAR(_11);
			ZVAL_STRING(_11, "messageMinResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _11);
			zephir_check_temp_parameter(_11);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(replacePairs);
			zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			ZEPHIR_INIT_NVAR(_11);
			ZVAL_STRING(_11, "minResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&_35, this_ptr, "getoption", NULL, 0, _11);
			zephir_check_temp_parameter(_11);
			zephir_check_call_status();
			zephir_array_update_string(&replacePairs, SL(":min"), &_35, PH_COPY | PH_SEPARATE);
			if (ZEPHIR_IS_EMPTY(message)) {
				ZEPHIR_INIT_NVAR(_11);
				ZVAL_STRING(_11, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _11);
				zephir_check_temp_parameter(_11);
				zephir_check_call_status();
			}
			ZEPHIR_INIT_NVAR(_11);
			object_init_ex(_11, phalcon_validation_message_ce);
			ZEPHIR_CALL_FUNCTION(&_35, "strtr", &_10, 53, message, replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_23);
			ZVAL_STRING(_23, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(NULL, _11, "__construct", &_12, 436, _35, field, _23);
			zephir_check_temp_parameter(_23);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _11);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
		ZEPHIR_INIT_NVAR(_23);
		ZVAL_STRING(_23, "maxResolution", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_35, this_ptr, "issetoption", NULL, 0, _23);
		zephir_check_temp_parameter(_23);
		zephir_check_call_status();
		if (zephir_is_true(_35)) {
			ZEPHIR_INIT_NVAR(_23);
			ZVAL_STRING(_23, "maxResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&_39, this_ptr, "getoption", NULL, 0, _23);
			zephir_check_temp_parameter(_23);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(maxResolution);
			zephir_fast_explode_str(maxResolution, SL("x"), _39, LONG_MAX TSRMLS_CC);
			ZEPHIR_OBS_VAR(maxWidth);
			zephir_array_fetch_long(&maxWidth, maxResolution, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 192 TSRMLS_CC);
			ZEPHIR_OBS_VAR(maxHeight);
			zephir_array_fetch_long(&maxHeight, maxResolution, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 193 TSRMLS_CC);
			_40 = ZEPHIR_GT(width, maxWidth);
			if (!(_40)) {
				_40 = ZEPHIR_GT(height, maxHeight);
			}
			if (_40) {
				ZEPHIR_INIT_NVAR(_23);
				ZVAL_STRING(_23, "messageMaxResolution", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _23);
				zephir_check_temp_parameter(_23);
				zephir_check_call_status();
				ZEPHIR_INIT_NVAR(replacePairs);
				zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
				zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
				ZEPHIR_INIT_NVAR(_23);
				ZVAL_STRING(_23, "maxResolution", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&_41, this_ptr, "getoption", NULL, 0, _23);
				zephir_check_temp_parameter(_23);
				zephir_check_call_status();
				zephir_array_update_string(&replacePairs, SL(":max"), &_41, PH_COPY | PH_SEPARATE);
				if (ZEPHIR_IS_EMPTY(message)) {
					ZEPHIR_INIT_NVAR(_23);
					ZVAL_STRING(_23, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY);
					ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _23);
					zephir_check_temp_parameter(_23);
					zephir_check_call_status();
				}
				ZEPHIR_INIT_NVAR(_23);
				object_init_ex(_23, phalcon_validation_message_ce);
				ZEPHIR_CALL_FUNCTION(&_41, "strtr", &_10, 53, message, replacePairs);
				zephir_check_call_status();
				ZEPHIR_INIT_NVAR(_26);
				ZVAL_STRING(_26, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(NULL, _23, "__construct", &_12, 436, _41, field, _26);
				zephir_check_temp_parameter(_26);
				zephir_check_call_status();
				ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _23);
				zephir_check_call_status();
				RETURN_MM_BOOL(0);
			}
		}
	}
	RETURN_MM_BOOL(1);

}
PHP_METHOD(Xs_FieldMeta, toConfig) {

	zend_bool _6, _9, _10, _13, _14, _16;
	zval *s;
	zval index, *_0, *_1, *_2, *_3, *_4, *_5, *_7, *_8 = NULL, *_11, *_12, *_15;

	ZEPHIR_MM_GROW();
	ZEPHIR_INIT_VAR(s);
	ZVAL_STRING(s, "", 1);

	_0 = zephir_fetch_nproperty_this(this_ptr, SL("name"), PH_NOISY_CC);
	ZEPHIR_INIT_VAR(_1);
	ZEPHIR_CONCAT_SVS(_1, "[", _0, "]\n");
	zephir_concat_self(&s, _1 TSRMLS_CC);
	_2 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
	do {
		if (ZEPHIR_IS_LONG(_2, 1)) {
			zephir_concat_self_str(&s, "type = numeric\n", sizeof("type = numeric\n")-1 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(_2, 10)) {
			zephir_concat_self_str(&s, "type = id\n", sizeof("type = id\n")-1 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(_2, 11)) {
			zephir_concat_self_str(&s, "type = title\n", sizeof("type = title\n")-1 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(_2, 12)) {
			zephir_concat_self_str(&s, "type = body\n", sizeof("type = body\n")-1 TSRMLS_CC);
			break;
		}
	} while(0);

	_3 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
	if (!ZEPHIR_IS_LONG_IDENTICAL(_3, 12)) {
		_4 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
		ZEPHIR_SINIT_VAR(index);
		ZVAL_LONG(&index, ((int) (zephir_get_numberval(_4)) & 0x03));
		if (zephir_is_true(&index)) {
			do {
				if (ZEPHIR_IS_LONG(&index, 0x03)) {
					_5 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
					if (!ZEPHIR_IS_LONG_IDENTICAL(_5, 11)) {
						zephir_concat_self_str(&s, "index = both\n", sizeof("index = both\n")-1 TSRMLS_CC);
					}
					break;
				}
				if (ZEPHIR_IS_LONG(&index, 0x02)) {
					zephir_concat_self_str(&s, "index = mixed\n", sizeof("index = mixed\n")-1 TSRMLS_CC);
					break;
				}
				_5 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
				if (!ZEPHIR_IS_LONG_IDENTICAL(_5, 10)) {
					zephir_concat_self_str(&s, "index = self\n", sizeof("index = self\n")-1 TSRMLS_CC);
				}
				break;
			} while(0);

		}
	}
	_4 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
	_6 = !ZEPHIR_IS_LONG_IDENTICAL(_4, 10);
	if (_6) {
		_5 = zephir_fetch_nproperty_this(this_ptr, SL("tokenizer"), PH_NOISY_CC);
		_6 = !ZEPHIR_IS_LONG_IDENTICAL(_5, 0);
	}
	if (_6) {
		_7 = zephir_fetch_nproperty_this(this_ptr, SL("tokenizer"), PH_NOISY_CC);
		ZEPHIR_INIT_VAR(_8);
		ZEPHIR_CONCAT_SVS(_8, "tokenizer = ", _7, "\n");
		zephir_concat_self(&s, _8 TSRMLS_CC);
	}
	_4 = zephir_fetch_nproperty_this(this_ptr, SL("cutlen"), PH_NOISY_CC);
	_9 = ZEPHIR_GT_LONG(_4, 0);
	if (_9) {
		_7 = zephir_fetch_nproperty_this(this_ptr, SL("cutlen"), PH_NOISY_CC);
		_10 = ZEPHIR_IS_LONG_IDENTICAL(_7, 300);
		if (_10) {
			_11 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
			_10 = ZEPHIR_IS_LONG_IDENTICAL(_11, 12);
		}
		_9 = !(_10);
	}
	if (_9) {
		_12 = zephir_fetch_nproperty_this(this_ptr, SL("cutlen"), PH_NOISY_CC);
		ZEPHIR_INIT_LNVAR(_8);
		ZEPHIR_CONCAT_SVS(_8, "cutlen = ", _12, "\n");
		zephir_concat_self(&s, _8 TSRMLS_CC);
	}
	_4 = zephir_fetch_nproperty_this(this_ptr, SL("weight"), PH_NOISY_CC);
	_13 = !ZEPHIR_IS_LONG_IDENTICAL(_4, 1);
	if (_13) {
		_7 = zephir_fetch_nproperty_this(this_ptr, SL("weight"), PH_NOISY_CC);
		_14 = ZEPHIR_IS_LONG_IDENTICAL(_7, 5);
		if (_14) {
			_12 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
			_14 = ZEPHIR_IS_LONG_IDENTICAL(_12, 11);
		}
		_13 = !(_14);
	}
	if (_13) {
		_15 = zephir_fetch_nproperty_this(this_ptr, SL("weight"), PH_NOISY_CC);
		ZEPHIR_INIT_LNVAR(_8);
		ZEPHIR_CONCAT_SVS(_8, "weight = ", _15, "\n");
		zephir_concat_self(&s, _8 TSRMLS_CC);
	}
	_4 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
	if (((int) (zephir_get_numberval(_4)) & 0x10)) {
		_7 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
		_16 = !ZEPHIR_IS_LONG_IDENTICAL(_7, 12);
		if (_16) {
			_12 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
			_16 = !ZEPHIR_IS_LONG_IDENTICAL(_12, 11);
		}
		if (_16) {
			zephir_concat_self_str(&s, "phrase = yes\n", sizeof("phrase = yes\n")-1 TSRMLS_CC);
		}
	} else {
		_4 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
		_16 = ZEPHIR_IS_LONG_IDENTICAL(_4, 12);
		if (!(_16)) {
			_7 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
			_16 = ZEPHIR_IS_LONG_IDENTICAL(_7, 11);
		}
		if (_16) {
			zephir_concat_self_str(&s, "phrase = no\n", sizeof("phrase = no\n")-1 TSRMLS_CC);
		}
	}
	_4 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
	if (((int) (zephir_get_numberval(_4)) & 0x80)) {
		zephir_concat_self_str(&s, "non_bool = yes\n", sizeof("non_bool = yes\n")-1 TSRMLS_CC);
	}
	RETURN_CTOR(s);

}
Exemple #18
0
/**
 * Executes the validation
 */
PHP_METHOD(Phalcon_Validation_Validator_File, validate) {

	zend_bool _4, _5, _6, _8, _9, _18, _19, _21, _29, _30, _65, _72$$29, _81$$36;
	zephir_fcall_cache_entry *_15 = NULL, *_17 = NULL, *_44 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *field = NULL;
	zval *validation, *field_param = NULL, *_SERVER, *_POST, *_FILES, *value = NULL, *message = NULL, *label = NULL, *replacePairs = NULL, *types = NULL, *byteUnits = NULL, *unit = NULL, *maxSize = NULL, *matches = NULL, *bytes = NULL, *mime = NULL, *tmp = NULL, *width = NULL, *height = NULL, *minResolution = NULL, *maxResolution = NULL, *minWidth = NULL, *maxWidth = NULL, *minHeight = NULL, *maxHeight = NULL, *fieldTypes = NULL, *code = NULL, *minResolutionArray = NULL, *maxResolutionArray = NULL, *_0 = NULL, *_3, *_7, *_10, *_20, *_22, *_23 = NULL, *_36 = NULL, *_55 = NULL, *_64 = NULL, *_66 = NULL, *_1$$3, *_2$$5, *_11$$6 = NULL, *_14$$6 = NULL, *_16$$6, *_12$$7, *_13$$8, *_24$$9 = NULL, *_27$$9 = NULL, *_28$$9, *_25$$10, *_26$$11, *_31$$12 = NULL, *_34$$12 = NULL, *_35$$12, *_32$$13, *_33$$14, *_37$$15 = NULL, *_39$$15, *_40$$15, *_41$$15, *_42$$15, *_43$$15 = NULL, *_45$$15, *_46$$15, _47$$15, *_48$$15, *_49$$15 = NULL, *_38$$16, *_50$$18 = NULL, *_53$$18 = NULL, *_54$$18, *_51$$19, *_52$$20, *_56$$21, _57$$24, *_58$$24, *_59$$26 = NULL, *_62$$26 = NULL, *_63$$26, *_60$$27, *_61$$28, *_67$$29, *_68$$29 = NULL, *_69$$29 = NULL, *_78$$29 = NULL, *_70$$30, *_71$$31, *_73$$33 = NULL, *_76$$33 = NULL, *_77$$33, *_74$$34, *_75$$35, *_79$$36, *_80$$37, *_82$$38 = NULL, *_85$$38 = NULL, *_86$$38, *_83$$39, *_84$$40;

	ZEPHIR_MM_GROW();
	zephir_get_global(&_FILES, SS("_FILES") TSRMLS_CC);
	zephir_get_global(&_POST, SS("_POST") TSRMLS_CC);
	zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);
	zephir_fetch_params(1, 2, 0, &validation, &field_param);

	if (unlikely(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(field_param) == IS_STRING)) {
		zephir_get_strval(field, field_param);
	} else {
		ZEPHIR_INIT_VAR(field);
		ZVAL_EMPTY_STRING(field);
	}


	ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_0);
	ZVAL_STRING(_0, "label", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _0);
	zephir_check_temp_parameter(_0);
	zephir_check_call_status();
	if (Z_TYPE_P(label) == IS_ARRAY) {
		zephir_array_fetch(&_1$$3, label, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 108 TSRMLS_CC);
		ZEPHIR_CPY_WRT(label, _1$$3);
	}
	if (ZEPHIR_IS_EMPTY(label)) {
		ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field);
		zephir_check_call_status();
	}
	ZEPHIR_INIT_NVAR(_0);
	ZVAL_STRING(_0, "code", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&code, this_ptr, "getoption", NULL, 0, _0);
	zephir_check_temp_parameter(_0);
	zephir_check_call_status();
	if (Z_TYPE_P(code) == IS_ARRAY) {
		zephir_array_fetch(&_2$$5, code, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 117 TSRMLS_CC);
		ZEPHIR_CPY_WRT(code, _2$$5);
	}
	zephir_array_fetch_string(&_3, _SERVER, SL("REQUEST_METHOD"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 121 TSRMLS_CC);
	_4 = ZEPHIR_IS_STRING(_3, "POST");
	if (_4) {
		_4 = ZEPHIR_IS_EMPTY(_POST);
	}
	_5 = _4;
	if (_5) {
		_5 = ZEPHIR_IS_EMPTY(_FILES);
	}
	_6 = _5;
	if (_6) {
		zephir_array_fetch_string(&_7, _SERVER, SL("CONTENT_LENGTH"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 121 TSRMLS_CC);
		_6 = ZEPHIR_GT_LONG(_7, 0);
	}
	_8 = _6;
	if (!(_8)) {
		_9 = zephir_array_isset_string(value, SS("error"));
		if (_9) {
			zephir_array_fetch_string(&_10, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 121 TSRMLS_CC);
			_9 = ZEPHIR_IS_LONG_IDENTICAL(_10, 1);
		}
		_8 = _9;
	}
	if (_8) {
		ZEPHIR_INIT_VAR(_11$$6);
		ZVAL_STRING(_11$$6, "messageIniSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _11$$6);
		zephir_check_temp_parameter(_11$$6);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(replacePairs);
		zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		if (Z_TYPE_P(message) == IS_ARRAY) {
			zephir_array_fetch(&_12$$7, message, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 127 TSRMLS_CC);
			ZEPHIR_CPY_WRT(message, _12$$7);
		}
		if (ZEPHIR_IS_EMPTY(message)) {
			ZEPHIR_INIT_VAR(_13$$8);
			ZVAL_STRING(_13$$8, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _13$$8);
			zephir_check_temp_parameter(_13$$8);
			zephir_check_call_status();
		}
		ZEPHIR_INIT_NVAR(_11$$6);
		object_init_ex(_11$$6, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_14$$6, "strtr", &_15, 26, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_16$$6);
		ZVAL_STRING(_16$$6, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _11$$6, "__construct", &_17, 466, _14$$6, field, _16$$6, code);
		zephir_check_temp_parameter(_16$$6);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _11$$6);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	_18 = !(zephir_array_isset_string(value, SS("error")));
	if (!(_18)) {
		_18 = !(zephir_array_isset_string(value, SS("tmp_name")));
	}
	_19 = _18;
	if (!(_19)) {
		zephir_array_fetch_string(&_20, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 138 TSRMLS_CC);
		_19 = !ZEPHIR_IS_LONG_IDENTICAL(_20, 0);
	}
	_21 = _19;
	if (!(_21)) {
		zephir_array_fetch_string(&_22, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 138 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_23, "is_uploaded_file", NULL, 246, _22);
		zephir_check_call_status();
		_21 = !zephir_is_true(_23);
	}
	if (_21) {
		ZEPHIR_INIT_VAR(_24$$9);
		ZVAL_STRING(_24$$9, "messageEmpty", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _24$$9);
		zephir_check_temp_parameter(_24$$9);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(replacePairs);
		zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		if (Z_TYPE_P(message) == IS_ARRAY) {
			zephir_array_fetch(&_25$$10, message, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 144 TSRMLS_CC);
			ZEPHIR_CPY_WRT(message, _25$$10);
		}
		if (ZEPHIR_IS_EMPTY(message)) {
			ZEPHIR_INIT_VAR(_26$$11);
			ZVAL_STRING(_26$$11, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _26$$11);
			zephir_check_temp_parameter(_26$$11);
			zephir_check_call_status();
		}
		ZEPHIR_INIT_NVAR(_24$$9);
		object_init_ex(_24$$9, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_27$$9, "strtr", &_15, 26, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_28$$9);
		ZVAL_STRING(_28$$9, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _24$$9, "__construct", &_17, 466, _27$$9, field, _28$$9, code);
		zephir_check_temp_parameter(_28$$9);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _24$$9);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	_29 = !(zephir_array_isset_string(value, SS("name")));
	if (!(_29)) {
		_29 = !(zephir_array_isset_string(value, SS("type")));
	}
	_30 = _29;
	if (!(_30)) {
		_30 = !(zephir_array_isset_string(value, SS("size")));
	}
	if (_30) {
		ZEPHIR_INIT_VAR(_31$$12);
		ZVAL_STRING(_31$$12, "messageValid", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _31$$12);
		zephir_check_temp_parameter(_31$$12);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(replacePairs);
		zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		if (Z_TYPE_P(message) == IS_ARRAY) {
			zephir_array_fetch(&_32$$13, message, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 161 TSRMLS_CC);
			ZEPHIR_CPY_WRT(message, _32$$13);
		}
		if (ZEPHIR_IS_EMPTY(message)) {
			ZEPHIR_INIT_VAR(_33$$14);
			ZVAL_STRING(_33$$14, "FileValid", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _33$$14);
			zephir_check_temp_parameter(_33$$14);
			zephir_check_call_status();
		}
		ZEPHIR_INIT_NVAR(_31$$12);
		object_init_ex(_31$$12, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_34$$12, "strtr", &_15, 26, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_35$$12);
		ZVAL_STRING(_35$$12, "FileValid", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _31$$12, "__construct", &_17, 466, _34$$12, field, _35$$12, code);
		zephir_check_temp_parameter(_35$$12);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _31$$12);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_INIT_NVAR(_0);
	ZVAL_STRING(_0, "maxSize", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_36, this_ptr, "hasoption", NULL, 0, _0);
	zephir_check_temp_parameter(_0);
	zephir_check_call_status();
	if (zephir_is_true(_36)) {
		ZEPHIR_INIT_VAR(byteUnits);
		zephir_create_array(byteUnits, 9, 0 TSRMLS_CC);
		add_assoc_long_ex(byteUnits, SS("B"), 0);
		add_assoc_long_ex(byteUnits, SS("K"), 10);
		add_assoc_long_ex(byteUnits, SS("M"), 20);
		add_assoc_long_ex(byteUnits, SS("G"), 30);
		add_assoc_long_ex(byteUnits, SS("T"), 40);
		add_assoc_long_ex(byteUnits, SS("KB"), 10);
		add_assoc_long_ex(byteUnits, SS("MB"), 20);
		add_assoc_long_ex(byteUnits, SS("GB"), 30);
		add_assoc_long_ex(byteUnits, SS("TB"), 40);
		ZEPHIR_INIT_VAR(_37$$15);
		ZVAL_STRING(_37$$15, "maxSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&maxSize, this_ptr, "getoption", NULL, 0, _37$$15);
		zephir_check_temp_parameter(_37$$15);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(matches);
		ZVAL_NULL(matches);
		ZEPHIR_INIT_VAR(unit);
		ZVAL_STRING(unit, "B", 1);
		if (Z_TYPE_P(maxSize) == IS_ARRAY) {
			zephir_array_fetch(&_38$$16, maxSize, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 180 TSRMLS_CC);
			ZEPHIR_CPY_WRT(maxSize, _38$$16);
		}
		ZEPHIR_INIT_NVAR(_37$$15);
		ZEPHIR_INIT_VAR(_39$$15);
		ZEPHIR_INIT_VAR(_40$$15);
		zephir_array_keys(_40$$15, byteUnits TSRMLS_CC);
		zephir_fast_join_str(_39$$15, SL("|"), _40$$15 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_41$$15);
		ZEPHIR_CONCAT_SVS(_41$$15, "/^([0-9]+(?:\\.[0-9]+)?)(", _39$$15, ")?$/Di");
		zephir_preg_match(_37$$15, _41$$15, maxSize, matches, 0, 0 , 0  TSRMLS_CC);
		if (zephir_array_isset_long(matches, 2)) {
			ZEPHIR_OBS_NVAR(unit);
			zephir_array_fetch_long(&unit, matches, 2, PH_NOISY, "phalcon/validation/validator/file.zep", 186 TSRMLS_CC);
		}
		zephir_array_fetch_long(&_42$$15, matches, 1, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 189 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_43$$15, "floatval", &_44, 322, _42$$15);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_45$$15);
		zephir_array_fetch(&_46$$15, byteUnits, unit, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 189 TSRMLS_CC);
		ZEPHIR_SINIT_VAR(_47$$15);
		ZVAL_LONG(&_47$$15, 2);
		zephir_pow_function(_45$$15, &_47$$15, _46$$15);
		ZEPHIR_INIT_VAR(bytes);
		mul_function(bytes, _43$$15, _45$$15 TSRMLS_CC);
		zephir_array_fetch_string(&_48$$15, value, SL("size"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 191 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_43$$15, "floatval", &_44, 322, _48$$15);
		zephir_check_call_status();
		ZEPHIR_CALL_FUNCTION(&_49$$15, "floatval", &_44, 322, bytes);
		zephir_check_call_status();
		if (ZEPHIR_GT(_43$$15, _49$$15)) {
			ZEPHIR_INIT_VAR(_50$$18);
			ZVAL_STRING(_50$$18, "messageSize", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _50$$18);
			zephir_check_temp_parameter(_50$$18);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(replacePairs);
			zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			zephir_array_update_string(&replacePairs, SL(":max"), &maxSize, PH_COPY | PH_SEPARATE);
			if (Z_TYPE_P(message) == IS_ARRAY) {
				zephir_array_fetch(&_51$$19, message, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 196 TSRMLS_CC);
				ZEPHIR_CPY_WRT(message, _51$$19);
			}
			if (ZEPHIR_IS_EMPTY(message)) {
				ZEPHIR_INIT_VAR(_52$$20);
				ZVAL_STRING(_52$$20, "FileSize", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _52$$20);
				zephir_check_temp_parameter(_52$$20);
				zephir_check_call_status();
			}
			ZEPHIR_INIT_NVAR(_50$$18);
			object_init_ex(_50$$18, phalcon_validation_message_ce);
			ZEPHIR_CALL_FUNCTION(&_53$$18, "strtr", &_15, 26, message, replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_54$$18);
			ZVAL_STRING(_54$$18, "FileSize", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(NULL, _50$$18, "__construct", &_17, 466, _53$$18, field, _54$$18, code);
			zephir_check_temp_parameter(_54$$18);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _50$$18);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
	}
	ZEPHIR_INIT_NVAR(_0);
	ZVAL_STRING(_0, "allowedTypes", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_55, this_ptr, "hasoption", NULL, 0, _0);
	zephir_check_temp_parameter(_0);
	zephir_check_call_status();
	if (zephir_is_true(_55)) {
		ZEPHIR_INIT_VAR(_56$$21);
		ZVAL_STRING(_56$$21, "allowedTypes", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&types, this_ptr, "getoption", NULL, 0, _56$$21);
		zephir_check_temp_parameter(_56$$21);
		zephir_check_call_status();
		ZEPHIR_OBS_VAR(fieldTypes);
		if (zephir_array_isset_fetch(&fieldTypes, types, field, 0 TSRMLS_CC)) {
			ZEPHIR_CPY_WRT(types, fieldTypes);
		}
		if (Z_TYPE_P(types) != IS_ARRAY) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Option 'allowedTypes' must be an array", "phalcon/validation/validator/file.zep", 217);
			return;
		}
		if ((zephir_function_exists_ex(SS("finfo_open") TSRMLS_CC) == SUCCESS)) {
			ZEPHIR_SINIT_VAR(_57$$24);
			ZVAL_LONG(&_57$$24, 16);
			ZEPHIR_CALL_FUNCTION(&tmp, "finfo_open", NULL, 243, &_57$$24);
			zephir_check_call_status();
			zephir_array_fetch_string(&_58$$24, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 222 TSRMLS_CC);
			ZEPHIR_CALL_FUNCTION(&mime, "finfo_file", NULL, 244, tmp, _58$$24);
			zephir_check_call_status();
			ZEPHIR_CALL_FUNCTION(NULL, "finfo_close", NULL, 245, tmp);
			zephir_check_call_status();
		} else {
			ZEPHIR_OBS_NVAR(mime);
			zephir_array_fetch_string(&mime, value, SL("type"), PH_NOISY, "phalcon/validation/validator/file.zep", 226 TSRMLS_CC);
		}
		if (!(zephir_fast_in_array(mime, types TSRMLS_CC))) {
			ZEPHIR_INIT_VAR(_59$$26);
			ZVAL_STRING(_59$$26, "messageType", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _59$$26);
			zephir_check_temp_parameter(_59$$26);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(replacePairs);
			zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			ZEPHIR_INIT_NVAR(_59$$26);
			zephir_fast_join_str(_59$$26, SL(", "), types TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":types"), &_59$$26, PH_COPY | PH_SEPARATE);
			if (Z_TYPE_P(message) == IS_ARRAY) {
				zephir_array_fetch(&_60$$27, message, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 234 TSRMLS_CC);
				ZEPHIR_CPY_WRT(message, _60$$27);
			}
			if (ZEPHIR_IS_EMPTY(message)) {
				ZEPHIR_INIT_VAR(_61$$28);
				ZVAL_STRING(_61$$28, "FileType", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _61$$28);
				zephir_check_temp_parameter(_61$$28);
				zephir_check_call_status();
			}
			ZEPHIR_INIT_NVAR(_59$$26);
			object_init_ex(_59$$26, phalcon_validation_message_ce);
			ZEPHIR_CALL_FUNCTION(&_62$$26, "strtr", &_15, 26, message, replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_63$$26);
			ZVAL_STRING(_63$$26, "FileType", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(NULL, _59$$26, "__construct", &_17, 466, _62$$26, field, _63$$26, code);
			zephir_check_temp_parameter(_63$$26);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _59$$26);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
	}
	ZEPHIR_INIT_NVAR(_0);
	ZVAL_STRING(_0, "minResolution", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_64, this_ptr, "hasoption", NULL, 0, _0);
	zephir_check_temp_parameter(_0);
	zephir_check_call_status();
	_65 = zephir_is_true(_64);
	if (!(_65)) {
		ZEPHIR_INIT_NVAR(_0);
		ZVAL_STRING(_0, "maxResolution", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_66, this_ptr, "hasoption", NULL, 0, _0);
		zephir_check_temp_parameter(_0);
		zephir_check_call_status();
		_65 = zephir_is_true(_66);
	}
	if (_65) {
		zephir_array_fetch_string(&_67$$29, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 247 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 254, _67$$29);
		zephir_check_call_status();
		ZEPHIR_OBS_VAR(width);
		zephir_array_fetch_long(&width, tmp, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 248 TSRMLS_CC);
		ZEPHIR_OBS_VAR(height);
		zephir_array_fetch_long(&height, tmp, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 249 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_69$$29);
		ZVAL_STRING(_69$$29, "minResolution", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_68$$29, this_ptr, "hasoption", NULL, 0, _69$$29);
		zephir_check_temp_parameter(_69$$29);
		zephir_check_call_status();
		if (zephir_is_true(_68$$29)) {
			ZEPHIR_INIT_VAR(_70$$30);
			ZVAL_STRING(_70$$30, "minResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&minResolution, this_ptr, "getoption", NULL, 0, _70$$30);
			zephir_check_temp_parameter(_70$$30);
			zephir_check_call_status();
			if (Z_TYPE_P(minResolution) == IS_ARRAY) {
				zephir_array_fetch(&_71$$31, minResolution, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 254 TSRMLS_CC);
				ZEPHIR_CPY_WRT(minResolution, _71$$31);
			}
			ZEPHIR_INIT_VAR(minResolutionArray);
			zephir_fast_explode_str(minResolutionArray, SL("x"), minResolution, LONG_MAX TSRMLS_CC);
			ZEPHIR_OBS_VAR(minWidth);
			zephir_array_fetch_long(&minWidth, minResolutionArray, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 257 TSRMLS_CC);
			ZEPHIR_OBS_VAR(minHeight);
			zephir_array_fetch_long(&minHeight, minResolutionArray, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 258 TSRMLS_CC);
		} else {
			ZEPHIR_INIT_NVAR(minWidth);
			ZVAL_LONG(minWidth, 1);
			ZEPHIR_INIT_NVAR(minHeight);
			ZVAL_LONG(minHeight, 1);
		}
		_72$$29 = ZEPHIR_LT(width, minWidth);
		if (!(_72$$29)) {
			_72$$29 = ZEPHIR_LT(height, minHeight);
		}
		if (_72$$29) {
			ZEPHIR_INIT_VAR(_73$$33);
			ZVAL_STRING(_73$$33, "messageMinResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _73$$33);
			zephir_check_temp_parameter(_73$$33);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(replacePairs);
			zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			zephir_array_update_string(&replacePairs, SL(":min"), &minResolution, PH_COPY | PH_SEPARATE);
			if (Z_TYPE_P(message) == IS_ARRAY) {
				zephir_array_fetch(&_74$$34, message, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 269 TSRMLS_CC);
				ZEPHIR_CPY_WRT(message, _74$$34);
			}
			if (ZEPHIR_IS_EMPTY(message)) {
				ZEPHIR_INIT_VAR(_75$$35);
				ZVAL_STRING(_75$$35, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _75$$35);
				zephir_check_temp_parameter(_75$$35);
				zephir_check_call_status();
			}
			ZEPHIR_INIT_NVAR(_73$$33);
			object_init_ex(_73$$33, phalcon_validation_message_ce);
			ZEPHIR_CALL_FUNCTION(&_76$$33, "strtr", &_15, 26, message, replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_77$$33);
			ZVAL_STRING(_77$$33, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(NULL, _73$$33, "__construct", &_17, 466, _76$$33, field, _77$$33, code);
			zephir_check_temp_parameter(_77$$33);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _73$$33);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
		ZEPHIR_INIT_NVAR(_69$$29);
		ZVAL_STRING(_69$$29, "maxResolution", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_78$$29, this_ptr, "hasoption", NULL, 0, _69$$29);
		zephir_check_temp_parameter(_69$$29);
		zephir_check_call_status();
		if (zephir_is_true(_78$$29)) {
			ZEPHIR_INIT_VAR(_79$$36);
			ZVAL_STRING(_79$$36, "maxResolution", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&maxResolution, this_ptr, "getoption", NULL, 0, _79$$36);
			zephir_check_temp_parameter(_79$$36);
			zephir_check_call_status();
			if (Z_TYPE_P(maxResolution) == IS_ARRAY) {
				zephir_array_fetch(&_80$$37, maxResolution, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 284 TSRMLS_CC);
				ZEPHIR_CPY_WRT(maxResolution, _80$$37);
			}
			ZEPHIR_INIT_VAR(maxResolutionArray);
			zephir_fast_explode_str(maxResolutionArray, SL("x"), maxResolution, LONG_MAX TSRMLS_CC);
			ZEPHIR_OBS_VAR(maxWidth);
			zephir_array_fetch_long(&maxWidth, maxResolutionArray, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 287 TSRMLS_CC);
			ZEPHIR_OBS_VAR(maxHeight);
			zephir_array_fetch_long(&maxHeight, maxResolutionArray, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 288 TSRMLS_CC);
			_81$$36 = ZEPHIR_GT(width, maxWidth);
			if (!(_81$$36)) {
				_81$$36 = ZEPHIR_GT(height, maxHeight);
			}
			if (_81$$36) {
				ZEPHIR_INIT_VAR(_82$$38);
				ZVAL_STRING(_82$$38, "messageMaxResolution", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _82$$38);
				zephir_check_temp_parameter(_82$$38);
				zephir_check_call_status();
				ZEPHIR_INIT_NVAR(replacePairs);
				zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
				zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
				zephir_array_update_string(&replacePairs, SL(":max"), &maxResolution, PH_COPY | PH_SEPARATE);
				if (Z_TYPE_P(message) == IS_ARRAY) {
					zephir_array_fetch(&_83$$39, message, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 295 TSRMLS_CC);
					ZEPHIR_CPY_WRT(message, _83$$39);
				}
				if (ZEPHIR_IS_EMPTY(message)) {
					ZEPHIR_INIT_VAR(_84$$40);
					ZVAL_STRING(_84$$40, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY);
					ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _84$$40);
					zephir_check_temp_parameter(_84$$40);
					zephir_check_call_status();
				}
				ZEPHIR_INIT_NVAR(_82$$38);
				object_init_ex(_82$$38, phalcon_validation_message_ce);
				ZEPHIR_CALL_FUNCTION(&_85$$38, "strtr", &_15, 26, message, replacePairs);
				zephir_check_call_status();
				ZEPHIR_INIT_VAR(_86$$38);
				ZVAL_STRING(_86$$38, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(NULL, _82$$38, "__construct", &_17, 466, _85$$38, field, _86$$38, code);
				zephir_check_temp_parameter(_86$$38);
				zephir_check_call_status();
				ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _82$$38);
				zephir_check_call_status();
				RETURN_MM_BOOL(0);
			}
		}
	}
	RETURN_MM_BOOL(1);

}
Exemple #19
0
/**
 * Check whether a role is allowed to access an action from a resource
 *
 * <code>
 * //Does andres have access to the customers resource to create?
 * $acl->isAllowed("andres", "Products", "create");
 *
 * //Do guests have access to any resource to edit?
 * $acl->isAllowed("guests", "*", "edit");
 * </code>
 */
PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) {

	zend_bool _15$$31, _20$$33, _22$$33, _24$$33, _26$$33, _40$$40, _42$$39, _44$$41;
	HashTable *_5$$13, *_8$$19, *_11$$25, *_18$$30;
	HashPosition _4$$13, _7$$19, _10$$25, _17$$30;
	zephir_fcall_cache_entry *_34 = NULL, *_38 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *parameters = NULL;
	zval *access = NULL;
	zval *roleName = NULL, *resourceName = NULL, *access_param = NULL, *parameters_param = NULL, *eventsManager = NULL, *accessList = NULL, *accessKey = NULL, *haveAccess = NULL, *roleInherits = NULL, *inheritedRole = NULL, *rolesNames = NULL, *inheritedRoles = NULL, *funcAccess = NULL, *resourceObject = NULL, *roleObject = NULL, *funcList = NULL, *reflectionFunction = NULL, *reflectionParameters = NULL, *parameterNumber = NULL, *parametersForFunction = NULL, *numberOfRequiredParameters = NULL, *userParametersSizeShouldBe = NULL, *reflectionClass = NULL, *parameterToCheck = NULL, *reflectionParameter = NULL, *_0, *_1$$7 = NULL, *_2$$7, *_3$$9, **_6$$13, **_9$$19, **_12$$25, *_13$$28, *_14$$29, *_16$$31, **_19$$30, *_46$$30, *_47$$30, *_21$$33 = NULL, *_23$$33 = NULL, *_25$$33 = NULL, *_27$$33 = NULL, *_28$$33, *_29$$36 = NULL, *_30$$36 = NULL, *_31$$36, *_32$$36 = NULL, *_33$$36 = NULL, *_35$$37, *_36$$38, _37$$38, *_39$$40, *_41$$40, *_43$$39, *_45$$41;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 3, 1, &roleName, &resourceName, &access_param, &parameters_param);

	ZEPHIR_SEPARATE_PARAM(roleName);
	ZEPHIR_SEPARATE_PARAM(resourceName);
	zephir_get_strval(access, access_param);
	if (!parameters_param) {
		ZEPHIR_INIT_VAR(parameters);
		array_init(parameters);
	} else {
		zephir_get_arrval(parameters, parameters_param);
	}


	ZEPHIR_INIT_VAR(haveAccess);
	ZVAL_NULL(haveAccess);
	ZEPHIR_INIT_VAR(funcAccess);
	ZVAL_NULL(funcAccess);
	ZEPHIR_INIT_VAR(resourceObject);
	ZVAL_NULL(resourceObject);
	ZEPHIR_INIT_VAR(roleObject);
	ZVAL_NULL(roleObject);
	if (Z_TYPE_P(roleName) == IS_OBJECT) {
		if (!(zephir_instance_of_ev(roleName, phalcon_acl_roleaware_ce TSRMLS_CC))) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_acl_exception_ce, "Object passed as roleName must implement RoleAware", "phalcon/acl/adapter/memory.zep", 545);
			return;
		}
		ZEPHIR_CPY_WRT(roleObject, roleName);
		ZEPHIR_CALL_METHOD(&roleName, roleObject, "getrolename", NULL, 0);
		zephir_check_call_status();
	}
	if (Z_TYPE_P(resourceName) == IS_OBJECT) {
		if (!(zephir_instance_of_ev(resourceName, phalcon_acl_resourceaware_ce TSRMLS_CC))) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_acl_exception_ce, "Object passed as resourceName must implement ResourceAware", "phalcon/acl/adapter/memory.zep", 553);
			return;
		}
		ZEPHIR_CPY_WRT(resourceObject, resourceName);
		ZEPHIR_CALL_METHOD(&resourceName, resourceObject, "getresourcename", NULL, 0);
		zephir_check_call_status();
	}
	zephir_update_property_this(this_ptr, SL("_activeRole"), roleName TSRMLS_CC);
	zephir_update_property_this(this_ptr, SL("_activeResource"), resourceName TSRMLS_CC);
	zephir_update_property_this(this_ptr, SL("_activeAccess"), access TSRMLS_CC);
	ZEPHIR_OBS_VAR(accessList);
	zephir_read_property_this(&accessList, this_ptr, SL("_access"), PH_NOISY_CC);
	_0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC);
	ZEPHIR_CPY_WRT(eventsManager, _0);
	ZEPHIR_OBS_VAR(funcList);
	zephir_read_property_this(&funcList, this_ptr, SL("_func"), PH_NOISY_CC);
	if (Z_TYPE_P(eventsManager) == IS_OBJECT) {
		ZEPHIR_INIT_VAR(_2$$7);
		ZVAL_STRING(_2$$7, "acl:beforeCheckAccess", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_1$$7, eventsManager, "fire", NULL, 0, _2$$7, this_ptr);
		zephir_check_temp_parameter(_2$$7);
		zephir_check_call_status();
		if (ZEPHIR_IS_FALSE_IDENTICAL(_1$$7)) {
			RETURN_MM_BOOL(0);
		}
	}
	ZEPHIR_OBS_VAR(rolesNames);
	zephir_read_property_this(&rolesNames, this_ptr, SL("_rolesNames"), PH_NOISY_CC);
	if (!(zephir_array_isset(rolesNames, roleName))) {
		_3$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAccess"), PH_NOISY_CC);
		RETURN_MM_BOOL((ZEPHIR_IS_LONG(_3$$9, 1)));
	}
	ZEPHIR_INIT_VAR(accessKey);
	ZEPHIR_CONCAT_VSVSV(accessKey, roleName, "!", resourceName, "!", access);
	if (zephir_array_isset(accessList, accessKey)) {
		ZEPHIR_OBS_NVAR(haveAccess);
		zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 586 TSRMLS_CC);
	}
	ZEPHIR_OBS_NVAR(funcAccess);
	zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC);
	if (Z_TYPE_P(haveAccess) == IS_NULL) {
		ZEPHIR_OBS_VAR(roleInherits);
		zephir_read_property_this(&roleInherits, this_ptr, SL("_roleInherits"), PH_NOISY_CC);
		ZEPHIR_OBS_VAR(inheritedRoles);
		if (zephir_array_isset_fetch(&inheritedRoles, roleInherits, roleName, 0 TSRMLS_CC)) {
			if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) {
				zephir_is_iterable(inheritedRoles, &_5$$13, &_4$$13, 0, 0, "phalcon/acl/adapter/memory.zep", 610);
				for (
				  ; zephir_hash_get_current_data_ex(_5$$13, (void**) &_6$$13, &_4$$13) == SUCCESS
				  ; zephir_hash_move_forward_ex(_5$$13, &_4$$13)
				) {
					ZEPHIR_GET_HVALUE(inheritedRole, _6$$13);
					ZEPHIR_INIT_NVAR(accessKey);
					ZEPHIR_CONCAT_VSVSV(accessKey, inheritedRole, "!", resourceName, "!", access);
					if (zephir_array_isset(accessList, accessKey)) {
						ZEPHIR_OBS_NVAR(haveAccess);
						zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 606 TSRMLS_CC);
					}
					ZEPHIR_OBS_NVAR(funcAccess);
					zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC);
				}
			}
		}
	}
	if (Z_TYPE_P(haveAccess) == IS_NULL) {
		ZEPHIR_INIT_NVAR(accessKey);
		ZEPHIR_CONCAT_VSVS(accessKey, roleName, "!", resourceName, "!*");
		if (zephir_array_isset(accessList, accessKey)) {
			ZEPHIR_OBS_NVAR(haveAccess);
			zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 625 TSRMLS_CC);
			ZEPHIR_OBS_NVAR(funcAccess);
			zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC);
		} else {
			if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) {
				zephir_is_iterable(inheritedRoles, &_8$$19, &_7$$19, 0, 0, "phalcon/acl/adapter/memory.zep", 641);
				for (
				  ; zephir_hash_get_current_data_ex(_8$$19, (void**) &_9$$19, &_7$$19) == SUCCESS
				  ; zephir_hash_move_forward_ex(_8$$19, &_7$$19)
				) {
					ZEPHIR_GET_HVALUE(inheritedRole, _9$$19);
					ZEPHIR_INIT_NVAR(accessKey);
					ZEPHIR_CONCAT_VSVS(accessKey, inheritedRole, "!", resourceName, "!*");
					ZEPHIR_OBS_NVAR(funcAccess);
					zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC);
					if (zephir_array_isset(accessList, accessKey)) {
						ZEPHIR_OBS_NVAR(haveAccess);
						zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 637 TSRMLS_CC);
						break;
					}
				}
			}
		}
	}
	if (Z_TYPE_P(haveAccess) == IS_NULL) {
		ZEPHIR_INIT_NVAR(accessKey);
		ZEPHIR_CONCAT_VS(accessKey, roleName, "!*!*");
		if (zephir_array_isset(accessList, accessKey)) {
			ZEPHIR_OBS_NVAR(haveAccess);
			zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 656 TSRMLS_CC);
			ZEPHIR_OBS_NVAR(funcAccess);
			zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC);
		} else {
			if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) {
				zephir_is_iterable(inheritedRoles, &_11$$25, &_10$$25, 0, 0, "phalcon/acl/adapter/memory.zep", 672);
				for (
				  ; zephir_hash_get_current_data_ex(_11$$25, (void**) &_12$$25, &_10$$25) == SUCCESS
				  ; zephir_hash_move_forward_ex(_11$$25, &_10$$25)
				) {
					ZEPHIR_GET_HVALUE(inheritedRole, _12$$25);
					ZEPHIR_INIT_NVAR(accessKey);
					ZEPHIR_CONCAT_VS(accessKey, inheritedRole, "!*!*");
					ZEPHIR_OBS_NVAR(funcAccess);
					zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC);
					if (zephir_array_isset(accessList, accessKey)) {
						ZEPHIR_OBS_NVAR(haveAccess);
						zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 668 TSRMLS_CC);
						break;
					}
				}
			}
		}
	}
	zephir_update_property_this(this_ptr, SL("_accessGranted"), haveAccess TSRMLS_CC);
	if (Z_TYPE_P(eventsManager) == IS_OBJECT) {
		ZEPHIR_INIT_VAR(_13$$28);
		ZVAL_STRING(_13$$28, "acl:afterCheckAccess", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _13$$28, this_ptr);
		zephir_check_temp_parameter(_13$$28);
		zephir_check_call_status();
	}
	if (Z_TYPE_P(haveAccess) == IS_NULL) {
		_14$$29 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAccess"), PH_NOISY_CC);
		RETURN_MM_BOOL(ZEPHIR_IS_LONG(_14$$29, 1));
	}
	if (Z_TYPE_P(funcAccess) != IS_NULL) {
		ZEPHIR_INIT_VAR(reflectionFunction);
		object_init_ex(reflectionFunction, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC));
		ZEPHIR_CALL_METHOD(NULL, reflectionFunction, "__construct", NULL, 85, funcAccess);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(&reflectionParameters, reflectionFunction, "getparameters", NULL, 86);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(parameterNumber);
		ZVAL_LONG(parameterNumber, zephir_fast_count_int(reflectionParameters TSRMLS_CC));
		if (ZEPHIR_IS_LONG_IDENTICAL(parameterNumber, 0)) {
			_15$$31 = ZEPHIR_IS_LONG(haveAccess, 1);
			if (_15$$31) {
				ZEPHIR_INIT_VAR(_16$$31);
				ZEPHIR_CALL_USER_FUNC(_16$$31, funcAccess);
				zephir_check_call_status();
				_15$$31 = zephir_is_true(_16$$31);
			}
			RETURN_MM_BOOL(_15$$31);
		}
		ZEPHIR_INIT_VAR(parametersForFunction);
		array_init(parametersForFunction);
		ZEPHIR_CALL_METHOD(&numberOfRequiredParameters, reflectionFunction, "getnumberofrequiredparameters", NULL, 87);
		zephir_check_call_status();
		ZEPHIR_CPY_WRT(userParametersSizeShouldBe, parameterNumber);
		zephir_is_iterable(reflectionParameters, &_18$$30, &_17$$30, 0, 0, "phalcon/acl/adapter/memory.zep", 737);
		for (
		  ; zephir_hash_get_current_data_ex(_18$$30, (void**) &_19$$30, &_17$$30) == SUCCESS
		  ; zephir_hash_move_forward_ex(_18$$30, &_17$$30)
		) {
			ZEPHIR_GET_HVALUE(reflectionParameter, _19$$30);
			ZEPHIR_CALL_METHOD(&reflectionClass, reflectionParameter, "getclass", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&parameterToCheck, reflectionParameter, "getname", NULL, 0);
			zephir_check_call_status();
			if (Z_TYPE_P(reflectionClass) != IS_NULL) {
				_20$$33 = Z_TYPE_P(roleObject) != IS_NULL;
				if (_20$$33) {
					ZEPHIR_CALL_METHOD(&_21$$33, reflectionClass, "isinstance", NULL, 0, roleObject);
					zephir_check_call_status();
					_20$$33 = zephir_is_true(_21$$33);
				}
				if (_20$$33) {
					zephir_array_append(&parametersForFunction, roleObject, PH_SEPARATE, "phalcon/acl/adapter/memory.zep", 709);
					ZEPHIR_SEPARATE(userParametersSizeShouldBe);
					zephir_decrement(userParametersSizeShouldBe);
					continue;
				}
				_22$$33 = Z_TYPE_P(resourceObject) != IS_NULL;
				if (_22$$33) {
					ZEPHIR_CALL_METHOD(&_23$$33, reflectionClass, "isinstance", NULL, 0, resourceObject);
					zephir_check_call_status();
					_22$$33 = zephir_is_true(_23$$33);
				}
				if (_22$$33) {
					zephir_array_append(&parametersForFunction, resourceObject, PH_SEPARATE, "phalcon/acl/adapter/memory.zep", 717);
					ZEPHIR_SEPARATE(userParametersSizeShouldBe);
					zephir_decrement(userParametersSizeShouldBe);
					continue;
				}
				_24$$33 = zephir_array_isset(parameters, parameterToCheck);
				if (_24$$33) {
					ZEPHIR_OBS_NVAR(_25$$33);
					zephir_array_fetch(&_25$$33, parameters, parameterToCheck, PH_NOISY, "phalcon/acl/adapter/memory.zep", 724 TSRMLS_CC);
					_24$$33 = Z_TYPE_P(_25$$33) == IS_OBJECT;
				}
				_26$$33 = _24$$33;
				if (_26$$33) {
					zephir_array_fetch(&_28$$33, parameters, parameterToCheck, PH_NOISY | PH_READONLY, "phalcon/acl/adapter/memory.zep", 724 TSRMLS_CC);
					ZEPHIR_CALL_METHOD(&_27$$33, reflectionClass, "isinstance", NULL, 0, _28$$33);
					zephir_check_call_status();
					_26$$33 = !zephir_is_true(_27$$33);
				}
				if (_26$$33) {
					ZEPHIR_INIT_NVAR(_29$$36);
					object_init_ex(_29$$36, phalcon_acl_exception_ce);
					ZEPHIR_INIT_NVAR(_30$$36);
					zephir_array_fetch(&_31$$36, parameters, parameterToCheck, PH_NOISY | PH_READONLY, "phalcon/acl/adapter/memory.zep", 726 TSRMLS_CC);
					zephir_get_class(_30$$36, _31$$36, 0 TSRMLS_CC);
					ZEPHIR_CALL_METHOD(&_32$$36, reflectionClass, "getname", NULL, 0);
					zephir_check_call_status();
					ZEPHIR_INIT_LNVAR(_33$$36);
					ZEPHIR_CONCAT_SVSVSVSVSVS(_33$$36, "Your passed parameter doesn't have the same class as the parameter in defined function when check ", roleName, " can ", access, " ", resourceName, ". Class passed: ", _30$$36, " , Class in defined function: ", _32$$36, ".");
					ZEPHIR_CALL_METHOD(NULL, _29$$36, "__construct", &_34, 9, _33$$36);
					zephir_check_call_status();
					zephir_throw_exception_debug(_29$$36, "phalcon/acl/adapter/memory.zep", 727 TSRMLS_CC);
					ZEPHIR_MM_RESTORE();
					return;
				}
			}
			if (zephir_array_isset(parameters, parameterToCheck)) {
				zephir_array_fetch(&_35$$37, parameters, parameterToCheck, PH_NOISY | PH_READONLY, "phalcon/acl/adapter/memory.zep", 733 TSRMLS_CC);
				zephir_array_append(&parametersForFunction, _35$$37, PH_SEPARATE, "phalcon/acl/adapter/memory.zep", 733);
			}
		}
		if (ZEPHIR_LT_LONG(userParametersSizeShouldBe, zephir_fast_count_int(parameters TSRMLS_CC))) {
			ZEPHIR_INIT_VAR(_36$$38);
			ZEPHIR_CONCAT_SVSVSVS(_36$$38, "Number of parameters in array is higher than the number of parameters in defined function when check ", roleName, " can ", access, " ", resourceName, ". Remember that more parameters than defined in function will be ignored.");
			ZEPHIR_SINIT_VAR(_37$$38);
			ZVAL_LONG(&_37$$38, 512);
			ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", &_38, 2, _36$$38, &_37$$38);
			zephir_check_call_status();
		}
		if (zephir_fast_count_int(parametersForFunction TSRMLS_CC) == 0) {
			if (ZEPHIR_GT_LONG(numberOfRequiredParameters, 0)) {
				ZEPHIR_INIT_VAR(_39$$40);
				ZEPHIR_CONCAT_SVSVSVS(_39$$40, "You didn't provide any parameters when check ", roleName, " can ", access, " ", resourceName, ". We will use default action when no arguments.");
				ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", &_38, 2, _39$$40);
				zephir_check_call_status();
				_40$$40 = ZEPHIR_IS_LONG(haveAccess, 1);
				if (_40$$40) {
					_41$$40 = zephir_fetch_nproperty_this(this_ptr, SL("_noArgumentsDefaultAction"), PH_NOISY_CC);
					_40$$40 = ZEPHIR_IS_LONG(_41$$40, 1);
				}
				RETURN_MM_BOOL(_40$$40);
			}
			_42$$39 = ZEPHIR_IS_LONG(haveAccess, 1);
			if (_42$$39) {
				ZEPHIR_INIT_VAR(_43$$39);
				ZEPHIR_CALL_USER_FUNC(_43$$39, funcAccess);
				zephir_check_call_status();
				_42$$39 = zephir_is_true(_43$$39);
			}
			RETURN_MM_BOOL(_42$$39);
		}
		if (ZEPHIR_LE_LONG(numberOfRequiredParameters, zephir_fast_count_int(parametersForFunction TSRMLS_CC))) {
			_44$$41 = ZEPHIR_IS_LONG(haveAccess, 1);
			if (_44$$41) {
				ZEPHIR_INIT_VAR(_45$$41);
				ZEPHIR_CALL_USER_FUNC_ARRAY(_45$$41, funcAccess, parametersForFunction);
				zephir_check_call_status();
				_44$$41 = zephir_is_true(_45$$41);
			}
			RETURN_MM_BOOL(_44$$41);
		}
		ZEPHIR_INIT_VAR(_46$$30);
		object_init_ex(_46$$30, phalcon_acl_exception_ce);
		ZEPHIR_INIT_VAR(_47$$30);
		ZEPHIR_CONCAT_SVSVSV(_47$$30, "You didn't provide all necessary parameters for defined function when check ", roleName, " can ", access, " ", resourceName);
		ZEPHIR_CALL_METHOD(NULL, _46$$30, "__construct", &_34, 9, _47$$30);
		zephir_check_call_status();
		zephir_throw_exception_debug(_46$$30, "phalcon/acl/adapter/memory.zep", 766 TSRMLS_CC);
		ZEPHIR_MM_RESTORE();
		return;
	}
	RETURN_MM_BOOL(ZEPHIR_IS_LONG(haveAccess, 1));

}
Exemple #20
0
/**
 * Executes the validation
 */
PHP_METHOD(Phalcon_Validation_Validator_File, validate) {

	zend_bool _1, _2, _3, _5, _6, _11, _12, _14, _20, _21, _50, _57$$16, _64$$21;
	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *validation, validation_sub, *field, field_sub, *_SERVER, *_POST, *_FILES, value, message, label, replacePairs, types, byteUnits, unit, maxSize, matches, bytes, mime, tmp, width, height, minResolution, maxResolution, minWidth, maxWidth, minHeight, maxHeight, fieldTypes, code, minResolutionArray, maxResolutionArray, _0, _4, _7, _13, _15, _16, _25, _26, _42, _49, _51, _8$$3, _9$$3, _10$$3, _17$$4, _18$$4, _19$$4, _22$$5, _23$$5, _24$$5, _27$$6, _29$$6, _30$$6, _31$$6, _32$$6, _33$$6, _34$$6, _35$$6, _36$$6, _37$$6, _38$$6, _28$$7, _39$$9, _40$$9, _41$$9, _43$$10, _44$$13, _45$$13, _46$$15, _47$$15, _48$$15, _52$$16, _53$$16, _54$$16, _61$$16, _55$$17, _56$$18, _58$$20, _59$$20, _60$$20, _62$$21, _63$$22, _65$$23, _66$$23, _67$$23;
	zval *this_ptr = getThis();

	ZVAL_UNDEF(&validation_sub);
	ZVAL_UNDEF(&field_sub);
	ZVAL_UNDEF(&value);
	ZVAL_UNDEF(&message);
	ZVAL_UNDEF(&label);
	ZVAL_UNDEF(&replacePairs);
	ZVAL_UNDEF(&types);
	ZVAL_UNDEF(&byteUnits);
	ZVAL_UNDEF(&unit);
	ZVAL_UNDEF(&maxSize);
	ZVAL_UNDEF(&matches);
	ZVAL_UNDEF(&bytes);
	ZVAL_UNDEF(&mime);
	ZVAL_UNDEF(&tmp);
	ZVAL_UNDEF(&width);
	ZVAL_UNDEF(&height);
	ZVAL_UNDEF(&minResolution);
	ZVAL_UNDEF(&maxResolution);
	ZVAL_UNDEF(&minWidth);
	ZVAL_UNDEF(&maxWidth);
	ZVAL_UNDEF(&minHeight);
	ZVAL_UNDEF(&maxHeight);
	ZVAL_UNDEF(&fieldTypes);
	ZVAL_UNDEF(&code);
	ZVAL_UNDEF(&minResolutionArray);
	ZVAL_UNDEF(&maxResolutionArray);
	ZVAL_UNDEF(&_0);
	ZVAL_UNDEF(&_4);
	ZVAL_UNDEF(&_7);
	ZVAL_UNDEF(&_13);
	ZVAL_UNDEF(&_15);
	ZVAL_UNDEF(&_16);
	ZVAL_UNDEF(&_25);
	ZVAL_UNDEF(&_26);
	ZVAL_UNDEF(&_42);
	ZVAL_UNDEF(&_49);
	ZVAL_UNDEF(&_51);
	ZVAL_UNDEF(&_8$$3);
	ZVAL_UNDEF(&_9$$3);
	ZVAL_UNDEF(&_10$$3);
	ZVAL_UNDEF(&_17$$4);
	ZVAL_UNDEF(&_18$$4);
	ZVAL_UNDEF(&_19$$4);
	ZVAL_UNDEF(&_22$$5);
	ZVAL_UNDEF(&_23$$5);
	ZVAL_UNDEF(&_24$$5);
	ZVAL_UNDEF(&_27$$6);
	ZVAL_UNDEF(&_29$$6);
	ZVAL_UNDEF(&_30$$6);
	ZVAL_UNDEF(&_31$$6);
	ZVAL_UNDEF(&_32$$6);
	ZVAL_UNDEF(&_33$$6);
	ZVAL_UNDEF(&_34$$6);
	ZVAL_UNDEF(&_35$$6);
	ZVAL_UNDEF(&_36$$6);
	ZVAL_UNDEF(&_37$$6);
	ZVAL_UNDEF(&_38$$6);
	ZVAL_UNDEF(&_28$$7);
	ZVAL_UNDEF(&_39$$9);
	ZVAL_UNDEF(&_40$$9);
	ZVAL_UNDEF(&_41$$9);
	ZVAL_UNDEF(&_43$$10);
	ZVAL_UNDEF(&_44$$13);
	ZVAL_UNDEF(&_45$$13);
	ZVAL_UNDEF(&_46$$15);
	ZVAL_UNDEF(&_47$$15);
	ZVAL_UNDEF(&_48$$15);
	ZVAL_UNDEF(&_52$$16);
	ZVAL_UNDEF(&_53$$16);
	ZVAL_UNDEF(&_54$$16);
	ZVAL_UNDEF(&_61$$16);
	ZVAL_UNDEF(&_55$$17);
	ZVAL_UNDEF(&_56$$18);
	ZVAL_UNDEF(&_58$$20);
	ZVAL_UNDEF(&_59$$20);
	ZVAL_UNDEF(&_60$$20);
	ZVAL_UNDEF(&_62$$21);
	ZVAL_UNDEF(&_63$$22);
	ZVAL_UNDEF(&_65$$23);
	ZVAL_UNDEF(&_66$$23);
	ZVAL_UNDEF(&_67$$23);

	ZEPHIR_MM_GROW();
	zephir_get_global(&_FILES, SL("_FILES"));
	zephir_get_global(&_POST, SL("_POST"));
	zephir_get_global(&_SERVER, SL("_SERVER"));
	zephir_fetch_params(1, 2, 0, &validation, &field);



	ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&label, this_ptr, "preparelabel", NULL, 0, validation, field);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&code, this_ptr, "preparecode", NULL, 0, field);
	zephir_check_call_status();
	zephir_array_fetch_string(&_0, _SERVER, SL("REQUEST_METHOD"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 103 TSRMLS_CC);
	_1 = ZEPHIR_IS_STRING(&_0, "POST");
	if (_1) {
		_1 = ZEPHIR_IS_EMPTY(_POST);
	}
	_2 = _1;
	if (_2) {
		_2 = ZEPHIR_IS_EMPTY(_FILES);
	}
	_3 = _2;
	if (_3) {
		zephir_array_fetch_string(&_4, _SERVER, SL("CONTENT_LENGTH"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 103 TSRMLS_CC);
		_3 = ZEPHIR_GT_LONG(&_4, 0);
	}
	_5 = _3;
	if (!(_5)) {
		_6 = zephir_array_isset_string(&value, SL("error"));
		if (_6) {
			zephir_array_fetch_string(&_7, &value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 103 TSRMLS_CC);
			_6 = ZEPHIR_IS_LONG_IDENTICAL(&_7, 1);
		}
		_5 = _6;
	}
	if (_5) {
		ZEPHIR_INIT_VAR(&_8$$3);
		ZVAL_STRING(&_8$$3, "FileIniSize");
		ZEPHIR_INIT_VAR(&_9$$3);
		ZVAL_STRING(&_9$$3, "messageIniSize");
		ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, &_8$$3, &_9$$3);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(&replacePairs);
		zephir_create_array(&replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		ZEPHIR_INIT_NVAR(&_8$$3);
		object_init_ex(&_8$$3, phalcon_messages_message_ce);
		ZEPHIR_CALL_FUNCTION(&_10$$3, "strtr", NULL, 50, &message, &replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(&_9$$3);
		ZVAL_STRING(&_9$$3, "FileIniSize");
		ZEPHIR_CALL_METHOD(NULL, &_8$$3, "__construct", NULL, 295, &_10$$3, field, &_9$$3, &code);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, &_8$$3);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	_11 = !(zephir_array_isset_string(&value, SL("error")));
	if (!(_11)) {
		_11 = !(zephir_array_isset_string(&value, SL("tmp_name")));
	}
	_12 = _11;
	if (!(_12)) {
		zephir_array_fetch_string(&_13, &value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 119 TSRMLS_CC);
		_12 = !ZEPHIR_IS_LONG_IDENTICAL(&_13, 0);
	}
	_14 = _12;
	if (!(_14)) {
		zephir_array_fetch_string(&_15, &value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 119 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_16, "is_uploaded_file", NULL, 228, &_15);
		zephir_check_call_status();
		_14 = !zephir_is_true(&_16);
	}
	if (_14) {
		ZEPHIR_INIT_VAR(&_17$$4);
		ZVAL_STRING(&_17$$4, "FileEmpty");
		ZEPHIR_INIT_VAR(&_18$$4);
		ZVAL_STRING(&_18$$4, "messageEmpty");
		ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, &_17$$4, &_18$$4);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(&replacePairs);
		zephir_create_array(&replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		ZEPHIR_INIT_NVAR(&_17$$4);
		object_init_ex(&_17$$4, phalcon_messages_message_ce);
		ZEPHIR_CALL_FUNCTION(&_19$$4, "strtr", NULL, 50, &message, &replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(&_18$$4);
		ZVAL_STRING(&_18$$4, "FileEmpty");
		ZEPHIR_CALL_METHOD(NULL, &_17$$4, "__construct", NULL, 295, &_19$$4, field, &_18$$4, &code);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, &_17$$4);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	_20 = !(zephir_array_isset_string(&value, SL("name")));
	if (!(_20)) {
		_20 = !(zephir_array_isset_string(&value, SL("type")));
	}
	_21 = _20;
	if (!(_21)) {
		_21 = !(zephir_array_isset_string(&value, SL("size")));
	}
	if (_21) {
		ZEPHIR_INIT_VAR(&_22$$5);
		ZVAL_STRING(&_22$$5, "FileValid");
		ZEPHIR_INIT_VAR(&_23$$5);
		ZVAL_STRING(&_23$$5, "messageValid");
		ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, &_22$$5, &_23$$5);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(&replacePairs);
		zephir_create_array(&replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		ZEPHIR_INIT_NVAR(&_22$$5);
		object_init_ex(&_22$$5, phalcon_messages_message_ce);
		ZEPHIR_CALL_FUNCTION(&_24$$5, "strtr", NULL, 50, &message, &replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(&_23$$5);
		ZVAL_STRING(&_23$$5, "FileValid");
		ZEPHIR_CALL_METHOD(NULL, &_22$$5, "__construct", NULL, 295, &_24$$5, field, &_23$$5, &code);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, &_22$$5);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_INIT_VAR(&_26);
	ZVAL_STRING(&_26, "maxSize");
	ZEPHIR_CALL_METHOD(&_25, this_ptr, "hasoption", NULL, 0, &_26);
	zephir_check_call_status();
	if (zephir_is_true(&_25)) {
		ZEPHIR_INIT_VAR(&byteUnits);
		zephir_create_array(&byteUnits, 9, 0 TSRMLS_CC);
		add_assoc_long_ex(&byteUnits, SL("B"), 0);
		add_assoc_long_ex(&byteUnits, SL("K"), 10);
		add_assoc_long_ex(&byteUnits, SL("M"), 20);
		add_assoc_long_ex(&byteUnits, SL("G"), 30);
		add_assoc_long_ex(&byteUnits, SL("T"), 40);
		add_assoc_long_ex(&byteUnits, SL("KB"), 10);
		add_assoc_long_ex(&byteUnits, SL("MB"), 20);
		add_assoc_long_ex(&byteUnits, SL("GB"), 30);
		add_assoc_long_ex(&byteUnits, SL("TB"), 40);
		ZEPHIR_INIT_VAR(&_27$$6);
		ZVAL_STRING(&_27$$6, "maxSize");
		ZEPHIR_CALL_METHOD(&maxSize, this_ptr, "getoption", NULL, 0, &_27$$6);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(&matches);
		ZVAL_NULL(&matches);
		ZEPHIR_INIT_VAR(&unit);
		ZVAL_STRING(&unit, "B");
		if (Z_TYPE_P(&maxSize) == IS_ARRAY) {
			zephir_array_fetch(&_28$$7, &maxSize, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 159 TSRMLS_CC);
			ZEPHIR_CPY_WRT(&maxSize, &_28$$7);
		}
		ZEPHIR_INIT_NVAR(&_27$$6);
		ZEPHIR_INIT_VAR(&_29$$6);
		zephir_array_keys(&_29$$6, &byteUnits TSRMLS_CC);
		zephir_fast_join_str(&_27$$6, SL("|"), &_29$$6 TSRMLS_CC);
		ZEPHIR_INIT_VAR(&_30$$6);
		ZEPHIR_CONCAT_SVS(&_30$$6, "/^([0-9]+(?:\\.[0-9]+)?)(", &_27$$6, ")?$/Di");
		ZEPHIR_INIT_VAR(&_31$$6);
		zephir_preg_match(&_31$$6, &_30$$6, &maxSize, &matches, 0, 0 , 0  TSRMLS_CC);
		if (zephir_array_isset_long(&matches, 2)) {
			ZEPHIR_OBS_NVAR(&unit);
			zephir_array_fetch_long(&unit, &matches, 2, PH_NOISY, "phalcon/validation/validator/file.zep", 165 TSRMLS_CC);
		}
		zephir_array_fetch_long(&_32$$6, &matches, 1, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 168 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_33$$6, "floatval", NULL, 319, &_32$$6);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(&_34$$6);
		zephir_array_fetch(&_35$$6, &byteUnits, &unit, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 168 TSRMLS_CC);
		ZVAL_LONG(&_36$$6, 2);
		zephir_pow_function(&_34$$6, &_36$$6, &_35$$6);
		ZEPHIR_INIT_VAR(&bytes);
		mul_function(&bytes, &_33$$6, &_34$$6 TSRMLS_CC);
		zephir_array_fetch_string(&_37$$6, &value, SL("size"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 170 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_33$$6, "floatval", NULL, 319, &_37$$6);
		zephir_check_call_status();
		ZEPHIR_CALL_FUNCTION(&_38$$6, "floatval", NULL, 319, &bytes);
		zephir_check_call_status();
		if (ZEPHIR_GT(&_33$$6, &_38$$6)) {
			ZEPHIR_INIT_VAR(&_39$$9);
			ZVAL_STRING(&_39$$9, "FileSize");
			ZEPHIR_INIT_VAR(&_40$$9);
			ZVAL_STRING(&_40$$9, "messageSize");
			ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, &_39$$9, &_40$$9);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(&replacePairs);
			zephir_create_array(&replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			zephir_array_update_string(&replacePairs, SL(":max"), &maxSize, PH_COPY | PH_SEPARATE);
			ZEPHIR_INIT_NVAR(&_39$$9);
			object_init_ex(&_39$$9, phalcon_messages_message_ce);
			ZEPHIR_CALL_FUNCTION(&_41$$9, "strtr", NULL, 50, &message, &replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(&_40$$9);
			ZVAL_STRING(&_40$$9, "FileSize");
			ZEPHIR_CALL_METHOD(NULL, &_39$$9, "__construct", NULL, 295, &_41$$9, field, &_40$$9, &code);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, &_39$$9);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
	}
	ZEPHIR_INIT_NVAR(&_26);
	ZVAL_STRING(&_26, "allowedTypes");
	ZEPHIR_CALL_METHOD(&_42, this_ptr, "hasoption", NULL, 0, &_26);
	zephir_check_call_status();
	if (zephir_is_true(&_42)) {
		ZEPHIR_INIT_VAR(&_43$$10);
		ZVAL_STRING(&_43$$10, "allowedTypes");
		ZEPHIR_CALL_METHOD(&types, this_ptr, "getoption", NULL, 0, &_43$$10);
		zephir_check_call_status();
		ZEPHIR_OBS_VAR(&fieldTypes);
		if (zephir_array_isset_fetch(&fieldTypes, &types, field, 0 TSRMLS_CC)) {
			ZEPHIR_CPY_WRT(&types, &fieldTypes);
		}
		if (Z_TYPE_P(&types) != IS_ARRAY) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Option 'allowedTypes' must be an array", "phalcon/validation/validator/file.zep", 196);
			return;
		}
		if ((zephir_function_exists_ex(SL("finfo_open") TSRMLS_CC) == SUCCESS)) {
			ZVAL_LONG(&_44$$13, 16);
			ZEPHIR_CALL_FUNCTION(&tmp, "finfo_open", NULL, 225, &_44$$13);
			zephir_check_call_status();
			zephir_array_fetch_string(&_45$$13, &value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 201 TSRMLS_CC);
			ZEPHIR_CALL_FUNCTION(&mime, "finfo_file", NULL, 226, &tmp, &_45$$13);
			zephir_check_call_status();
			ZEPHIR_CALL_FUNCTION(NULL, "finfo_close", NULL, 227, &tmp);
			zephir_check_call_status();
		} else {
			ZEPHIR_OBS_NVAR(&mime);
			zephir_array_fetch_string(&mime, &value, SL("type"), PH_NOISY, "phalcon/validation/validator/file.zep", 205 TSRMLS_CC);
		}
		if (!(zephir_fast_in_array(&mime, &types TSRMLS_CC))) {
			ZEPHIR_INIT_VAR(&_46$$15);
			ZVAL_STRING(&_46$$15, "FileType");
			ZEPHIR_INIT_VAR(&_47$$15);
			ZVAL_STRING(&_47$$15, "messageType");
			ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, &_46$$15, &_47$$15);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(&replacePairs);
			zephir_create_array(&replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			ZEPHIR_INIT_NVAR(&_46$$15);
			zephir_fast_join_str(&_46$$15, SL(", "), &types TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":types"), &_46$$15, PH_COPY | PH_SEPARATE);
			ZEPHIR_INIT_NVAR(&_46$$15);
			object_init_ex(&_46$$15, phalcon_messages_message_ce);
			ZEPHIR_CALL_FUNCTION(&_48$$15, "strtr", NULL, 50, &message, &replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(&_47$$15);
			ZVAL_STRING(&_47$$15, "FileType");
			ZEPHIR_CALL_METHOD(NULL, &_46$$15, "__construct", NULL, 295, &_48$$15, field, &_47$$15, &code);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, &_46$$15);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
	}
	ZEPHIR_INIT_NVAR(&_26);
	ZVAL_STRING(&_26, "minResolution");
	ZEPHIR_CALL_METHOD(&_49, this_ptr, "hasoption", NULL, 0, &_26);
	zephir_check_call_status();
	_50 = zephir_is_true(&_49);
	if (!(_50)) {
		ZEPHIR_INIT_NVAR(&_26);
		ZVAL_STRING(&_26, "maxResolution");
		ZEPHIR_CALL_METHOD(&_51, this_ptr, "hasoption", NULL, 0, &_26);
		zephir_check_call_status();
		_50 = zephir_is_true(&_51);
	}
	if (_50) {
		zephir_array_fetch_string(&_52$$16, &value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 226 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 237, &_52$$16);
		zephir_check_call_status();
		ZEPHIR_OBS_VAR(&width);
		zephir_array_fetch_long(&width, &tmp, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 227 TSRMLS_CC);
		ZEPHIR_OBS_VAR(&height);
		zephir_array_fetch_long(&height, &tmp, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 228 TSRMLS_CC);
		ZEPHIR_INIT_VAR(&_54$$16);
		ZVAL_STRING(&_54$$16, "minResolution");
		ZEPHIR_CALL_METHOD(&_53$$16, this_ptr, "hasoption", NULL, 0, &_54$$16);
		zephir_check_call_status();
		if (zephir_is_true(&_53$$16)) {
			ZEPHIR_INIT_VAR(&_55$$17);
			ZVAL_STRING(&_55$$17, "minResolution");
			ZEPHIR_CALL_METHOD(&minResolution, this_ptr, "getoption", NULL, 0, &_55$$17);
			zephir_check_call_status();
			if (Z_TYPE_P(&minResolution) == IS_ARRAY) {
				zephir_array_fetch(&_56$$18, &minResolution, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 233 TSRMLS_CC);
				ZEPHIR_CPY_WRT(&minResolution, &_56$$18);
			}
			ZEPHIR_INIT_VAR(&minResolutionArray);
			zephir_fast_explode_str(&minResolutionArray, SL("x"), &minResolution, LONG_MAX TSRMLS_CC);
			ZEPHIR_OBS_VAR(&minWidth);
			zephir_array_fetch_long(&minWidth, &minResolutionArray, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 236 TSRMLS_CC);
			ZEPHIR_OBS_VAR(&minHeight);
			zephir_array_fetch_long(&minHeight, &minResolutionArray, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 237 TSRMLS_CC);
		} else {
			ZEPHIR_INIT_NVAR(&minWidth);
			ZVAL_LONG(&minWidth, 1);
			ZEPHIR_INIT_NVAR(&minHeight);
			ZVAL_LONG(&minHeight, 1);
		}
		_57$$16 = ZEPHIR_LT(&width, &minWidth);
		if (!(_57$$16)) {
			_57$$16 = ZEPHIR_LT(&height, &minHeight);
		}
		if (_57$$16) {
			ZEPHIR_INIT_VAR(&_58$$20);
			ZVAL_STRING(&_58$$20, "FileMinResolution");
			ZEPHIR_INIT_VAR(&_59$$20);
			ZVAL_STRING(&_59$$20, "messageMinResolution");
			ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, &_58$$20, &_59$$20);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(&replacePairs);
			zephir_create_array(&replacePairs, 2, 0 TSRMLS_CC);
			zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
			zephir_array_update_string(&replacePairs, SL(":min"), &minResolution, PH_COPY | PH_SEPARATE);
			ZEPHIR_INIT_NVAR(&_58$$20);
			object_init_ex(&_58$$20, phalcon_messages_message_ce);
			ZEPHIR_CALL_FUNCTION(&_60$$20, "strtr", NULL, 50, &message, &replacePairs);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(&_59$$20);
			ZVAL_STRING(&_59$$20, "FileMinResolution");
			ZEPHIR_CALL_METHOD(NULL, &_58$$20, "__construct", NULL, 295, &_60$$20, field, &_59$$20, &code);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, &_58$$20);
			zephir_check_call_status();
			RETURN_MM_BOOL(0);
		}
		ZEPHIR_INIT_NVAR(&_54$$16);
		ZVAL_STRING(&_54$$16, "maxResolution");
		ZEPHIR_CALL_METHOD(&_61$$16, this_ptr, "hasoption", NULL, 0, &_54$$16);
		zephir_check_call_status();
		if (zephir_is_true(&_61$$16)) {
			ZEPHIR_INIT_VAR(&_62$$21);
			ZVAL_STRING(&_62$$21, "maxResolution");
			ZEPHIR_CALL_METHOD(&maxResolution, this_ptr, "getoption", NULL, 0, &_62$$21);
			zephir_check_call_status();
			if (Z_TYPE_P(&maxResolution) == IS_ARRAY) {
				zephir_array_fetch(&_63$$22, &maxResolution, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 263 TSRMLS_CC);
				ZEPHIR_CPY_WRT(&maxResolution, &_63$$22);
			}
			ZEPHIR_INIT_VAR(&maxResolutionArray);
			zephir_fast_explode_str(&maxResolutionArray, SL("x"), &maxResolution, LONG_MAX TSRMLS_CC);
			ZEPHIR_OBS_VAR(&maxWidth);
			zephir_array_fetch_long(&maxWidth, &maxResolutionArray, 0, PH_NOISY, "phalcon/validation/validator/file.zep", 266 TSRMLS_CC);
			ZEPHIR_OBS_VAR(&maxHeight);
			zephir_array_fetch_long(&maxHeight, &maxResolutionArray, 1, PH_NOISY, "phalcon/validation/validator/file.zep", 267 TSRMLS_CC);
			_64$$21 = ZEPHIR_GT(&width, &maxWidth);
			if (!(_64$$21)) {
				_64$$21 = ZEPHIR_GT(&height, &maxHeight);
			}
			if (_64$$21) {
				ZEPHIR_INIT_VAR(&_65$$23);
				ZVAL_STRING(&_65$$23, "FileMaxResolution");
				ZEPHIR_INIT_VAR(&_66$$23);
				ZVAL_STRING(&_66$$23, "messageMaxResolution");
				ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, &_65$$23, &_66$$23);
				zephir_check_call_status();
				ZEPHIR_INIT_NVAR(&replacePairs);
				zephir_create_array(&replacePairs, 2, 0 TSRMLS_CC);
				zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
				zephir_array_update_string(&replacePairs, SL(":max"), &maxResolution, PH_COPY | PH_SEPARATE);
				ZEPHIR_INIT_NVAR(&_65$$23);
				object_init_ex(&_65$$23, phalcon_messages_message_ce);
				ZEPHIR_CALL_FUNCTION(&_67$$23, "strtr", NULL, 50, &message, &replacePairs);
				zephir_check_call_status();
				ZEPHIR_INIT_NVAR(&_66$$23);
				ZVAL_STRING(&_66$$23, "FileMaxResolution");
				ZEPHIR_CALL_METHOD(NULL, &_65$$23, "__construct", NULL, 295, &_67$$23, field, &_66$$23, &code);
				zephir_check_call_status();
				ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, &_65$$23);
				zephir_check_call_status();
				RETURN_MM_BOOL(0);
			}
		}
	}
	RETURN_MM_BOOL(1);

}