/** * Executes the validation */ PHP_METHOD(Phalcon_Validation_Validator_Email, validate) { zend_bool _2; int ZEPHIR_LAST_CALL_STATUS; zval *field = NULL; zval *validation, *field_param = NULL, *value = NULL, *message = NULL, *label = NULL, *replacePairs, *_0 = NULL, *_1 = NULL, _3, *_4 = NULL, *_5 = NULL, *_6; 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(); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_0, this_ptr, "issetoption", NULL, 0, _1); zephir_check_temp_parameter(_1); zephir_check_call_status(); _2 = zephir_is_true(_0); if (_2) { _2 = ZEPHIR_IS_EMPTY(value); } if (_2) { RETURN_MM_BOOL(1); } ZEPHIR_SINIT_VAR(_3); ZVAL_LONG(&_3, 274); ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 190, value, &_3); zephir_check_call_status(); if (!(zephir_is_true(_4))) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "label", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _1); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(label)) { ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "message", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _1); zephir_check_temp_parameter(_1); 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(_1); ZVAL_STRING(_1, "Email", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _1); zephir_check_temp_parameter(_1); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_1); object_init_ex(_1, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_5, "strtr", NULL, 53, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_6); ZVAL_STRING(_6, "Email", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 432, _5, field, _6); zephir_check_temp_parameter(_6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1); zephir_check_call_status(); RETURN_MM_BOOL(0); } RETURN_MM_BOOL(1); }
/** * Generates random text in accordance with the template * * <code> * // Hi my name is a Bob * echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); * * // Hi my name is a Jon * echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); * * // Hello my name is a Bob * echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); * * // Hello my name is a Zyxep * echo Phalcon\Text::dynamic("[Hi/Hello], my name is a [Zyxep/Mark]!", "[", "]", "/"); * </code> */ PHP_METHOD(Phalcon_Text, dynamic) { zend_bool _11$$6; HashTable *_9$$5; HashPosition _8$$5; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_1 = NULL, *_5 = NULL, *_14 = NULL, *_19 = NULL; zval *text_param = NULL, *leftDelimiter_param = NULL, *rightDelimiter_param = NULL, *separator_param = NULL, *ldS = NULL, *rdS = NULL, *pattern = NULL, *matches = NULL, *match = NULL, *words = NULL, *word = NULL, *sub = NULL, *_0 = NULL, *_2 = NULL, *_6, *_7 = NULL, *_3$$3, **_10$$5, *_12$$6, *_13$$6 = NULL, *_15$$6, *_16$$6 = NULL, *_17$$6 = NULL, *_18$$6 = NULL; zval *text = NULL, *leftDelimiter = NULL, *rightDelimiter = NULL, *separator = NULL, *_4$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 3, &text_param, &leftDelimiter_param, &rightDelimiter_param, &separator_param); if (UNEXPECTED(Z_TYPE_P(text_param) != IS_STRING && Z_TYPE_P(text_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'text' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(text_param) == IS_STRING)) { zephir_get_strval(text, text_param); } else { ZEPHIR_INIT_VAR(text); ZVAL_EMPTY_STRING(text); } if (!leftDelimiter_param) { ZEPHIR_INIT_VAR(leftDelimiter); ZVAL_STRING(leftDelimiter, "{", 1); } else { if (UNEXPECTED(Z_TYPE_P(leftDelimiter_param) != IS_STRING && Z_TYPE_P(leftDelimiter_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'leftDelimiter' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(leftDelimiter_param) == IS_STRING)) { zephir_get_strval(leftDelimiter, leftDelimiter_param); } else { ZEPHIR_INIT_VAR(leftDelimiter); ZVAL_EMPTY_STRING(leftDelimiter); } } if (!rightDelimiter_param) { ZEPHIR_INIT_VAR(rightDelimiter); ZVAL_STRING(rightDelimiter, "}", 1); } else { if (UNEXPECTED(Z_TYPE_P(rightDelimiter_param) != IS_STRING && Z_TYPE_P(rightDelimiter_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'rightDelimiter' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(rightDelimiter_param) == IS_STRING)) { zephir_get_strval(rightDelimiter, rightDelimiter_param); } else { ZEPHIR_INIT_VAR(rightDelimiter); ZVAL_EMPTY_STRING(rightDelimiter); } } if (!separator_param) { ZEPHIR_INIT_VAR(separator); ZVAL_STRING(separator, "|", 1); } else { if (UNEXPECTED(Z_TYPE_P(separator_param) != IS_STRING && Z_TYPE_P(separator_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'separator' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(separator_param) == IS_STRING)) { zephir_get_strval(separator, separator_param); } else { ZEPHIR_INIT_VAR(separator); ZVAL_EMPTY_STRING(separator); } } ZEPHIR_CALL_FUNCTION(&_0, "substr_count", &_1, 459, text, leftDelimiter); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_2, "substr_count", &_1, 459, text, rightDelimiter); zephir_check_call_status(); if (!ZEPHIR_IS_IDENTICAL(_0, _2)) { ZEPHIR_INIT_VAR(_3$$3); object_init_ex(_3$$3, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(_4$$3); ZEPHIR_CONCAT_SVS(_4$$3, "Syntax error in string \"", text, "\""); ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 460, _4$$3); zephir_check_call_status(); zephir_throw_exception_debug(_3$$3, "phalcon/text.zep", 289 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_CALL_FUNCTION(&ldS, "preg_quote", &_5, 461, leftDelimiter); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&rdS, "preg_quote", &_5, 461, rightDelimiter); zephir_check_call_status(); ZEPHIR_INIT_VAR(pattern); ZEPHIR_CONCAT_SVSVVSVS(pattern, "/", ldS, "([^", ldS, rdS, "]+)", rdS, "/"); ZEPHIR_INIT_VAR(matches); array_init(matches); ZEPHIR_INIT_VAR(_6); ZVAL_LONG(_6, 2); ZEPHIR_MAKE_REF(matches); ZEPHIR_CALL_FUNCTION(&_7, "preg_match_all", NULL, 39, pattern, text, matches, _6); ZEPHIR_UNREF(matches); zephir_check_call_status(); if (!(zephir_is_true(_7))) { RETURN_CTOR(text); } if (Z_TYPE_P(matches) == IS_ARRAY) { zephir_is_iterable(matches, &_9$$5, &_8$$5, 0, 0, "phalcon/text.zep", 312); for ( ; zend_hash_get_current_data_ex(_9$$5, (void**) &_10$$5, &_8$$5) == SUCCESS ; zend_hash_move_forward_ex(_9$$5, &_8$$5) ) { ZEPHIR_GET_HVALUE(match, _10$$5); _11$$6 = !(zephir_array_isset_long(match, 0)); if (!(_11$$6)) { _11$$6 = !(zephir_array_isset_long(match, 1)); } if (_11$$6) { continue; } zephir_array_fetch_long(&_12$$6, match, 1, PH_NOISY | PH_READONLY, "phalcon/text.zep", 307 TSRMLS_CC); ZEPHIR_INIT_NVAR(words); zephir_fast_explode(words, separator, _12$$6, LONG_MAX TSRMLS_CC); ZEPHIR_OBS_NVAR(word); ZEPHIR_CALL_FUNCTION(&_13$$6, "array_rand", &_14, 462, words); zephir_check_call_status(); zephir_array_fetch(&word, words, _13$$6, PH_NOISY, "phalcon/text.zep", 308 TSRMLS_CC); zephir_array_fetch_long(&_15$$6, match, 0, PH_NOISY | PH_READONLY, "phalcon/text.zep", 309 TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", &_5, 461, _15$$6, separator); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_16$$6); ZEPHIR_CONCAT_SVS(_16$$6, "/", sub, "/"); ZEPHIR_INIT_NVAR(_17$$6); ZVAL_LONG(_17$$6, 1); ZEPHIR_CALL_FUNCTION(&_18$$6, "preg_replace", &_19, 40, _16$$6, word, text, _17$$6); zephir_check_call_status(); zephir_get_strval(text, _18$$6); } } RETURN_CTOR(text); }
PHP_METHOD(Phalcon_Session_Adapter_Libmemcached, __construct) { zval _7, _9; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_0 = NULL; zval options, *options_param = NULL, client, persistentId, prefix, servers, statsKey, ttl, _1, _2, _3, _4, _5, _6, _8; zval *this_ptr = getThis(); ZVAL_UNDEF(&options); ZVAL_UNDEF(&client); ZVAL_UNDEF(&persistentId); ZVAL_UNDEF(&prefix); ZVAL_UNDEF(&servers); ZVAL_UNDEF(&statsKey); ZVAL_UNDEF(&ttl); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_8); ZVAL_UNDEF(&_7); ZVAL_UNDEF(&_9); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &options_param); if (!options_param) { ZEPHIR_INIT_VAR(&options); array_init(&options); } else { ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); } ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_libmemcached_ce, getThis(), "__construct", &_0, 0, &options); zephir_check_call_status(); zephir_read_property(&_1, this_ptr, SL("options"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&options, &_1); ZEPHIR_OBS_VAR(&servers); if (!(zephir_array_isset_string_fetch(&servers, &options, SL("servers"), 0))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_session_exception_ce, "No 'servers' specified in the options", "phalcon/session/adapter/libmemcached.zep", 62); return; } ZEPHIR_INIT_VAR(&_2); array_init(&_2); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "client"); ZEPHIR_CALL_METHOD(&client, this_ptr, "arraygetdefault", NULL, 0, &options, &_3, &_2); zephir_check_call_status(); zephir_read_property(&_1, this_ptr, SL("ttl"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "ttl"); ZEPHIR_CALL_METHOD(&ttl, this_ptr, "arraygetdefault", NULL, 0, &options, &_3, &_1); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "statsKey"); ZEPHIR_INIT_VAR(&_4); ZVAL_STRING(&_4, ""); ZEPHIR_CALL_METHOD(&statsKey, this_ptr, "arraygetdefault", NULL, 0, &options, &_3, &_4); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "persistent_id"); ZEPHIR_INIT_NVAR(&_4); ZVAL_STRING(&_4, "phalcon-session"); ZEPHIR_CALL_METHOD(&persistentId, this_ptr, "arraygetdefault", NULL, 0, &options, &_3, &_4); zephir_check_call_status(); ZVAL_LONG(&_5, 2592000); ZEPHIR_CALL_FUNCTION(&_6, "min", NULL, 423, &ttl, &_5); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("ttl"), &_6); ZEPHIR_INIT_NVAR(&_3); object_init_ex(&_3, phalcon_cache_backend_libmemcached_ce); ZEPHIR_INIT_NVAR(&_4); object_init_ex(&_4, phalcon_cache_frontend_data_ce); ZEPHIR_INIT_VAR(&_7); zephir_create_array(&_7, 1, 0 TSRMLS_CC); ZEPHIR_OBS_VAR(&_8); zephir_read_property(&_8, this_ptr, SL("ttl"), PH_NOISY_CC); zephir_array_update_string(&_7, SL("lifetime"), &_8, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, &_4, "__construct", NULL, 328, &_7); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9); zephir_create_array(&_9, 5, 0 TSRMLS_CC); zephir_array_update_string(&_9, SL("servers"), &servers, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_9, SL("client"), &client, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_9, SL("prefix"), &prefix, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_9, SL("statsKey"), &statsKey, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_9, SL("persistent_id"), &persistentId, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, &_3, "__construct", NULL, 329, &_4, &_9); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("connection"), &_3); ZEPHIR_MM_RESTORE(); }
/** * Returns an array of Phalcon\Db\Column objects describing a table * * <code> * print_r($connection->describeColumns("posts")); * </code> * * @param string table * @param string schema * @return Phalcon\Db\Column[] */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeColumns) { zephir_fcall_cache_entry *_21 = NULL; zephir_nts_static zephir_fcall_cache_entry *_16 = NULL, *_20 = NULL; HashTable *_5; HashPosition _4; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema_param = NULL, *columns, *columnType = NULL, *field = NULL, *definition = NULL, *oldColumn = NULL, *columnName, *charSize = NULL, *numericSize = NULL, *numericScale = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7 = NULL, *_8 = NULL, *_9 = NULL, *_10, *_11, *_12, *_13 = NULL, *_14, *_15 = NULL, *_17, _18 = zval_used_for_init, *_19 = NULL; zval *table = NULL, *schema = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema_param); zephir_get_strval(table, table_param); if (!schema_param) { ZEPHIR_INIT_VAR(schema); ZVAL_EMPTY_STRING(schema); } else { zephir_get_strval(schema, schema_param); } ZEPHIR_INIT_VAR(oldColumn); ZVAL_NULL(oldColumn); ZEPHIR_INIT_VAR(columns); array_init(columns); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describecolumns", NULL, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/postgresql.zep", 295); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(field, _6); ZEPHIR_INIT_NVAR(definition); zephir_create_array(definition, 1, 0 TSRMLS_CC); add_assoc_long_ex(definition, SS("bindType"), 2); ZEPHIR_OBS_NVAR(columnType); zephir_array_fetch_long(&columnType, field, 1, PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 119 TSRMLS_CC); ZEPHIR_OBS_NVAR(charSize); zephir_array_fetch_long(&charSize, field, 2, PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 120 TSRMLS_CC); ZEPHIR_OBS_NVAR(numericSize); zephir_array_fetch_long(&numericSize, field, 3, PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 121 TSRMLS_CC); ZEPHIR_OBS_NVAR(numericScale); zephir_array_fetch_long(&numericScale, field, 4, PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 122 TSRMLS_CC); while (1) { if (zephir_memnstr_str(columnType, SL("smallint(1)"), "phalcon/db/adapter/pdo/postgresql.zep", 129)) { ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 8); zephir_array_update_string(&definition, SL("type"), &_3, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("bindType"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/postgresql.zep", 138)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 0); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 1); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("varying"), "phalcon/db/adapter/pdo/postgresql.zep", 149)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 2); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &charSize, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/postgresql.zep", 158)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 0); zephir_array_update_string(&definition, SL("size"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("numeric"), "phalcon/db/adapter/pdo/postgresql.zep", 167)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 3); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("scale"), &numericScale, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 32); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/postgresql.zep", 179)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &charSize, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("timestamp"), "phalcon/db/adapter/pdo/postgresql.zep", 188)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 4); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 0); zephir_array_update_string(&definition, SL("size"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("text"), "phalcon/db/adapter/pdo/postgresql.zep", 197)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 6); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &charSize, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("float"), "phalcon/db/adapter/pdo/postgresql.zep", 206)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 7); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 32); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("bool"), "phalcon/db/adapter/pdo/postgresql.zep", 217)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 8); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 0); zephir_array_update_string(&definition, SL("size"), &_8, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_9); ZVAL_LONG(_9, 5); zephir_array_update_string(&definition, SL("bindType"), &_9, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("uuid"), "phalcon/db/adapter/pdo/postgresql.zep", 227)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 36); zephir_array_update_string(&definition, SL("size"), &_8, PH_COPY | PH_SEPARATE); break; } ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 2); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/postgresql.zep", 243)) { zephir_array_update_string(&definition, SL("unsigned"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(oldColumn) == IS_NULL) { zephir_array_update_string(&definition, SL("first"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } else { zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_10, field, 6, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 259 TSRMLS_CC); if (ZEPHIR_IS_STRING(_10, "PRI")) { zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_11, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 266 TSRMLS_CC); if (ZEPHIR_IS_STRING(_11, "NO")) { zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_12, field, 7, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 273 TSRMLS_CC); if (ZEPHIR_IS_STRING(_12, "auto_increment")) { zephir_array_update_string(&definition, SL("autoIncrement"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(_13); zephir_array_fetch_long(&_13, field, 9, PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 280 TSRMLS_CC); if (Z_TYPE_P(_13) != IS_NULL) { zephir_array_fetch_long(&_14, field, 9, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 281 TSRMLS_CC); ZEPHIR_INIT_NVAR(_8); ZVAL_STRING(_8, "/^'|'?::[[:alnum:][:space:]]+$/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_15, "preg_replace", &_16, _8, _9, _14); zephir_check_temp_parameter(_8); zephir_check_temp_parameter(_9); zephir_check_call_status(); zephir_array_update_string(&definition, SL("default"), &_15, PH_COPY | PH_SEPARATE); zephir_array_fetch_string(&_17, definition, SL("default"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 282 TSRMLS_CC); ZEPHIR_SINIT_NVAR(_18); ZVAL_STRING(&_18, "null", 0); ZEPHIR_CALL_FUNCTION(&_19, "strcasecmp", &_20, _17, &_18); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_19, 0)) { zephir_array_update_string(&definition, SL("default"), &ZEPHIR_GLOBAL(global_null), PH_COPY | PH_SEPARATE); } } zephir_array_fetch_long(&columnName, field, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 290 TSRMLS_CC); ZEPHIR_INIT_NVAR(_7); object_init_ex(_7, phalcon_db_column_ce); ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_21, columnName, definition); zephir_check_call_status(); zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/postgresql.zep", 291); ZEPHIR_CPY_WRT(oldColumn, columnName); } RETURN_CCTOR(columns); }
/** * Stores cached content into the APCu backend and stops the frontend * * @param string|int keyName * @param string content * @param int lifetime * @param boolean stopBuffer */ PHP_METHOD(Phalcon_Cache_Backend_Apcu, save) { zend_long ZEPHIR_LAST_CALL_STATUS; zend_bool stopBuffer; zval *keyName = NULL, *content = NULL, *lifetime = NULL, *stopBuffer_param = NULL, *lastKey = NULL, *frontend = NULL, *cachedContent = NULL, *preparedContent = NULL, *ttl = NULL, *isBuffering = NULL, *success = NULL, *_0$$4; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 4, &keyName, &content, &lifetime, &stopBuffer_param); if (!keyName) { keyName = ZEPHIR_GLOBAL(global_null); } if (!content) { content = ZEPHIR_GLOBAL(global_null); } if (!lifetime) { ZEPHIR_CPY_WRT(lifetime, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(lifetime); } if (!stopBuffer_param) { stopBuffer = 1; } else { stopBuffer = zephir_get_boolval(stopBuffer_param); } if (Z_TYPE_P(keyName) == IS_NULL) { ZEPHIR_OBS_VAR(lastKey); zephir_read_property_this(&lastKey, this_ptr, SL("_lastKey"), PH_NOISY_CC); } else { _0$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(lastKey); ZEPHIR_CONCAT_SVV(lastKey, "_PHCA", _0$$4, keyName); } if (!(zephir_is_true(lastKey))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cache must be started first", "phalcon/cache/backend/apcu.zep", 95); return; } ZEPHIR_OBS_VAR(frontend); zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC); if (Z_TYPE_P(content) == IS_NULL) { ZEPHIR_CALL_METHOD(&cachedContent, frontend, "getcontent", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(cachedContent, content); } if (!(zephir_is_numeric(cachedContent))) { ZEPHIR_CALL_METHOD(&preparedContent, frontend, "beforestore", NULL, 0, cachedContent); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(preparedContent, cachedContent); } if (Z_TYPE_P(lifetime) == IS_NULL) { ZEPHIR_OBS_NVAR(lifetime); zephir_read_property_this(&lifetime, this_ptr, SL("_lastLifetime"), PH_NOISY_CC); if (Z_TYPE_P(lifetime) == IS_NULL) { ZEPHIR_CALL_METHOD(&ttl, frontend, "getlifetime", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(ttl, lifetime); zephir_update_property_this(getThis(), SL("_lastKey"), lastKey TSRMLS_CC); } } else { ZEPHIR_CPY_WRT(ttl, lifetime); } ZEPHIR_CALL_FUNCTION(&success, "apcu_store", NULL, 93, lastKey, preparedContent, ttl); zephir_check_call_status(); if (!(zephir_is_true(success))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Failed storing data in APCu", "phalcon/cache/backend/apcu.zep", 132); return; } ZEPHIR_CALL_METHOD(&isBuffering, frontend, "isbuffering", NULL, 0); zephir_check_call_status(); if (stopBuffer == 1) { ZEPHIR_CALL_METHOD(NULL, frontend, "stop", NULL, 0); zephir_check_call_status(); } if (ZEPHIR_IS_TRUE_IDENTICAL(isBuffering)) { zend_print_zval(cachedContent, 0); } if (0) { zephir_update_property_this(getThis(), SL("_started"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(getThis(), SL("_started"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } RETURN_CCTOR(success); }
/** * Returns an array of Phalcon\Db\Column objects describing a table * * <code> * print_r( * $connection->describeColumns("posts") * ); * </code> */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeColumns) { HashTable *_5; HashPosition _4; zephir_fcall_cache_entry *_41 = NULL, *_45 = NULL, *_47 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema_param = NULL, *columns = NULL, *columnType = NULL, *field = NULL, *definition = NULL, *oldColumn = NULL, *columnName = NULL, *charSize = NULL, *numericSize = NULL, *numericScale = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3, **_6, *_7$$4 = NULL, *_8$$4 = NULL, *_9$$5 = NULL, *_10$$5 = NULL, *_11$$6 = NULL, *_12$$6 = NULL, *_13$$7 = NULL, *_14$$8 = NULL, *_15$$8 = NULL, *_16$$9 = NULL, *_17$$10 = NULL, *_18$$10 = NULL, *_19$$11 = NULL, *_20$$12 = NULL, *_21$$12 = NULL, *_22$$13 = NULL, *_23$$14 = NULL, *_24$$14 = NULL, *_25$$15 = NULL, *_26$$15 = NULL, *_27$$15 = NULL, *_28$$16 = NULL, *_29$$17 = NULL, *_30$$18 = NULL, *_31$$18 = NULL, *_32$$19 = NULL, *_33$$3, *_34$$3, *_35$$3, *_36$$3 = NULL, *_46$$3 = NULL, *_37$$26, *_38$$26 = NULL, *_39$$26 = NULL, *_40$$26 = NULL, *_42$$26, _43$$26 = zval_used_for_init, *_44$$26 = NULL; zval *table = NULL, *schema = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema_param); zephir_get_strval(table, table_param); if (!schema_param) { ZEPHIR_INIT_VAR(schema); ZVAL_EMPTY_STRING(schema); } else { zephir_get_strval(schema, schema_param); } ZEPHIR_INIT_VAR(oldColumn); ZVAL_NULL(oldColumn); ZEPHIR_INIT_VAR(columns); array_init(columns); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describecolumns", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/postgresql.zep", 281); for ( ; zend_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zend_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(field, _6); ZEPHIR_INIT_NVAR(definition); zephir_create_array(definition, 1, 0 TSRMLS_CC); add_assoc_long_ex(definition, SS("bindType"), 2); ZEPHIR_OBS_NVAR(columnType); zephir_array_fetch_long(&columnType, field, 1, PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 118 TSRMLS_CC); ZEPHIR_OBS_NVAR(charSize); zephir_array_fetch_long(&charSize, field, 2, PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 119 TSRMLS_CC); ZEPHIR_OBS_NVAR(numericSize); zephir_array_fetch_long(&numericSize, field, 3, PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 120 TSRMLS_CC); ZEPHIR_OBS_NVAR(numericScale); zephir_array_fetch_long(&numericScale, field, 4, PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 121 TSRMLS_CC); if (zephir_memnstr_str(columnType, SL("smallint(1)"), "phalcon/db/adapter/pdo/postgresql.zep", 123)) { ZEPHIR_INIT_NVAR(_7$$4); ZVAL_LONG(_7$$4, 8); zephir_array_update_string(&definition, SL("type"), &_7$$4, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8$$4); ZVAL_LONG(_8$$4, 5); zephir_array_update_string(&definition, SL("bindType"), &_8$$4, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("bigint"), "phalcon/db/adapter/pdo/postgresql.zep", 129)) { ZEPHIR_INIT_NVAR(_9$$5); ZVAL_LONG(_9$$5, 14); zephir_array_update_string(&definition, SL("type"), &_9$$5, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_10$$5); ZVAL_LONG(_10$$5, 1); zephir_array_update_string(&definition, SL("bindType"), &_10$$5, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/postgresql.zep", 136)) { ZEPHIR_INIT_NVAR(_11$$6); ZVAL_LONG(_11$$6, 0); zephir_array_update_string(&definition, SL("type"), &_11$$6, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_12$$6); ZVAL_LONG(_12$$6, 1); zephir_array_update_string(&definition, SL("bindType"), &_12$$6, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("varying"), "phalcon/db/adapter/pdo/postgresql.zep", 144)) { ZEPHIR_INIT_NVAR(_13$$7); ZVAL_LONG(_13$$7, 2); zephir_array_update_string(&definition, SL("type"), &_13$$7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &charSize, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/postgresql.zep", 150)) { ZEPHIR_INIT_NVAR(_14$$8); ZVAL_LONG(_14$$8, 1); zephir_array_update_string(&definition, SL("type"), &_14$$8, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_15$$8); ZVAL_LONG(_15$$8, 0); zephir_array_update_string(&definition, SL("size"), &_15$$8, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("timestamp"), "phalcon/db/adapter/pdo/postgresql.zep", 156)) { ZEPHIR_INIT_NVAR(_16$$9); ZVAL_LONG(_16$$9, 17); zephir_array_update_string(&definition, SL("type"), &_16$$9, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("numeric"), "phalcon/db/adapter/pdo/postgresql.zep", 161)) { ZEPHIR_INIT_NVAR(_17$$10); ZVAL_LONG(_17$$10, 3); zephir_array_update_string(&definition, SL("type"), &_17$$10, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("scale"), &numericScale, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_18$$10); ZVAL_LONG(_18$$10, 32); zephir_array_update_string(&definition, SL("bindType"), &_18$$10, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/postgresql.zep", 170)) { ZEPHIR_INIT_NVAR(_19$$11); ZVAL_LONG(_19$$11, 5); zephir_array_update_string(&definition, SL("type"), &_19$$11, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &charSize, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("timestamp"), "phalcon/db/adapter/pdo/postgresql.zep", 176)) { ZEPHIR_INIT_NVAR(_20$$12); ZVAL_LONG(_20$$12, 4); zephir_array_update_string(&definition, SL("type"), &_20$$12, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_21$$12); ZVAL_LONG(_21$$12, 0); zephir_array_update_string(&definition, SL("size"), &_21$$12, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("text"), "phalcon/db/adapter/pdo/postgresql.zep", 182)) { ZEPHIR_INIT_NVAR(_22$$13); ZVAL_LONG(_22$$13, 6); zephir_array_update_string(&definition, SL("type"), &_22$$13, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &charSize, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("float"), "phalcon/db/adapter/pdo/postgresql.zep", 188)) { ZEPHIR_INIT_NVAR(_23$$14); ZVAL_LONG(_23$$14, 7); zephir_array_update_string(&definition, SL("type"), &_23$$14, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_24$$14); ZVAL_LONG(_24$$14, 32); zephir_array_update_string(&definition, SL("bindType"), &_24$$14, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("bool"), "phalcon/db/adapter/pdo/postgresql.zep", 196)) { ZEPHIR_INIT_NVAR(_25$$15); ZVAL_LONG(_25$$15, 8); zephir_array_update_string(&definition, SL("type"), &_25$$15, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_26$$15); ZVAL_LONG(_26$$15, 0); zephir_array_update_string(&definition, SL("size"), &_26$$15, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_27$$15); ZVAL_LONG(_27$$15, 5); zephir_array_update_string(&definition, SL("bindType"), &_27$$15, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("jsonb"), "phalcon/db/adapter/pdo/postgresql.zep", 203)) { ZEPHIR_INIT_NVAR(_28$$16); ZVAL_LONG(_28$$16, 16); zephir_array_update_string(&definition, SL("type"), &_28$$16, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("json"), "phalcon/db/adapter/pdo/postgresql.zep", 208)) { ZEPHIR_INIT_NVAR(_29$$17); ZVAL_LONG(_29$$17, 15); zephir_array_update_string(&definition, SL("type"), &_29$$17, PH_COPY | PH_SEPARATE); } else if (zephir_memnstr_str(columnType, SL("uuid"), "phalcon/db/adapter/pdo/postgresql.zep", 213)) { ZEPHIR_INIT_NVAR(_30$$18); ZVAL_LONG(_30$$18, 5); zephir_array_update_string(&definition, SL("type"), &_30$$18, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_31$$18); ZVAL_LONG(_31$$18, 36); zephir_array_update_string(&definition, SL("size"), &_31$$18, PH_COPY | PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(_32$$19); ZVAL_LONG(_32$$19, 2); zephir_array_update_string(&definition, SL("type"), &_32$$19, PH_COPY | PH_SEPARATE); } if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/postgresql.zep", 229)) { zephir_array_update_string(&definition, SL("unsigned"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(oldColumn) == IS_NULL) { zephir_array_update_string(&definition, SL("first"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } else { zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_33$$3, field, 6, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 245 TSRMLS_CC); if (ZEPHIR_IS_STRING(_33$$3, "PRI")) { zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_34$$3, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 252 TSRMLS_CC); if (ZEPHIR_IS_STRING(_34$$3, "NO")) { zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_35$$3, field, 7, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 259 TSRMLS_CC); if (ZEPHIR_IS_STRING(_35$$3, "auto_increment")) { zephir_array_update_string(&definition, SL("autoIncrement"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(_36$$3); zephir_array_fetch_long(&_36$$3, field, 9, PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 266 TSRMLS_CC); if (Z_TYPE_P(_36$$3) != IS_NULL) { zephir_array_fetch_long(&_37$$26, field, 9, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 267 TSRMLS_CC); ZEPHIR_INIT_NVAR(_38$$26); ZVAL_STRING(_38$$26, "/^'|'?::[[:alnum:][:space:]]+$/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_39$$26); ZVAL_STRING(_39$$26, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_40$$26, "preg_replace", &_41, 39, _38$$26, _39$$26, _37$$26); zephir_check_temp_parameter(_38$$26); zephir_check_temp_parameter(_39$$26); zephir_check_call_status(); zephir_array_update_string(&definition, SL("default"), &_40$$26, PH_COPY | PH_SEPARATE); zephir_array_fetch_string(&_42$$26, definition, SL("default"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 268 TSRMLS_CC); ZEPHIR_SINIT_NVAR(_43$$26); ZVAL_STRING(&_43$$26, "null", 0); ZEPHIR_CALL_FUNCTION(&_44$$26, "strcasecmp", &_45, 16, _42$$26, &_43$$26); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_44$$26, 0)) { zephir_array_update_string(&definition, SL("default"), &ZEPHIR_GLOBAL(global_null), PH_COPY | PH_SEPARATE); } } zephir_array_fetch_long(&columnName, field, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 276 TSRMLS_CC); ZEPHIR_INIT_NVAR(_46$$3); object_init_ex(_46$$3, phalcon_db_column_ce); ZEPHIR_CALL_METHOD(NULL, _46$$3, "__construct", &_47, 148, columnName, definition); zephir_check_call_status(); zephir_array_append(&columns, _46$$3, PH_SEPARATE, "phalcon/db/adapter/pdo/postgresql.zep", 277); ZEPHIR_CPY_WRT(oldColumn, columnName); } RETURN_CCTOR(columns); }
/** * Modifies a table column based on a definition */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, modifyColumn) { HashTable *_2$$4; HashPosition _1$$4; zephir_fcall_cache_entry *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *tableName_param = NULL, *schemaName_param = NULL, *column, *currentColumn = NULL, *sql = NULL, *queries = NULL, *query = NULL, *exception = NULL, *_0, **_3$$4, *_4$$5 = NULL, *_6$$3, *_7$$8 = NULL, *_8$$8, *_9$$8; zval *tableName = NULL, *schemaName = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &tableName_param, &schemaName_param, &column, ¤tColumn); if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { zephir_get_strval(tableName, tableName_param); } else { ZEPHIR_INIT_VAR(tableName); ZVAL_EMPTY_STRING(tableName); } if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { zephir_get_strval(schemaName, schemaName_param); } else { ZEPHIR_INIT_VAR(schemaName); ZVAL_EMPTY_STRING(schemaName); } if (!currentColumn) { currentColumn = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&sql, _0, "modifycolumn", NULL, 0, tableName, schemaName, column, currentColumn); zephir_check_call_status(); ZEPHIR_INIT_VAR(queries); zephir_fast_explode_str(queries, SL(";"), sql, LONG_MAX TSRMLS_CC); if (zephir_fast_count_int(queries TSRMLS_CC) > 1) { /* try_start_1: */ ZEPHIR_CALL_METHOD(NULL, this_ptr, "begin", NULL, 0); zephir_check_call_status_or_jump(try_end_1); zephir_is_iterable(queries, &_2$$4, &_1$$4, 0, 0, "phalcon/db/adapter/pdo/postgresql.zep", 344); for ( ; zend_hash_get_current_data_ex(_2$$4, (void**) &_3$$4, &_1$$4) == SUCCESS ; zend_hash_move_forward_ex(_2$$4, &_1$$4) ) { ZEPHIR_GET_HVALUE(query, _3$$4); if (ZEPHIR_IS_EMPTY(query)) { continue; } ZEPHIR_INIT_LNVAR(_4$$5); ZEPHIR_CONCAT_VS(_4$$5, query, ";"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "query", &_5, 0, _4$$5); zephir_check_call_status_or_jump(try_end_1); } ZEPHIR_RETURN_CALL_METHOD(this_ptr, "commit", NULL, 0); zephir_check_call_status_or_jump(try_end_1); RETURN_MM(); try_end_1: if (EG(exception)) { ZEPHIR_INIT_VAR(_6$$3); ZEPHIR_CPY_WRT(_6$$3, EG(exception)); if (zephir_instance_of_ev(_6$$3, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CPY_WRT(exception, _6$$3); ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); zephir_check_call_status(); zephir_throw_exception_debug(exception, "phalcon/db/adapter/pdo/postgresql.zep", 349 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } else { ZEPHIR_INIT_VAR(_7$$8); if (!(ZEPHIR_IS_EMPTY(sql))) { zephir_array_fetch_long(&_8$$8, queries, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 353 TSRMLS_CC); ZEPHIR_INIT_VAR(_9$$8); ZEPHIR_CONCAT_VS(_9$$8, _8$$8, ";"); ZEPHIR_CALL_METHOD(&_7$$8, this_ptr, "execute", NULL, 0, _9$$8); zephir_check_call_status(); } else { ZVAL_BOOL(_7$$8, 1); } RETURN_CCTOR(_7$$8); } RETURN_MM_BOOL(1); }
/** * Sends SQL statements to the database server returning the success state. * Use this method only when the SQL statement sent to the server is returning rows * *<code> * //Querying data * $resultset = $connection->query("SELECT * FROM robots WHERE type='mechanical'"); * $resultset = $connection->query("SELECT * FROM robots WHERE type=?", array("mechanical")); *</code> * * @param string sqlStatement * @param array bindParams * @param array bindTypes * @return Phalcon\Db\ResultInterface|bool */ PHP_METHOD(Phalcon_Db_Adapter_Pdo, query) { zephir_nts_static zephir_fcall_cache_entry *_3 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *sqlStatement_param = NULL, *bindParams = NULL, *bindTypes = NULL, *eventsManager = NULL, *pdo = NULL, *statement = NULL, *_0, *_1 = NULL, *_2 = NULL; zval *sqlStatement = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &sqlStatement_param, &bindParams, &bindTypes); if (unlikely(Z_TYPE_P(sqlStatement_param) != IS_STRING && Z_TYPE_P(sqlStatement_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlStatement' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(sqlStatement_param) == IS_STRING)) { zephir_get_strval(sqlStatement, sqlStatement_param); } else { ZEPHIR_INIT_VAR(sqlStatement); ZVAL_EMPTY_STRING(sqlStatement); } if (!bindParams) { bindParams = ZEPHIR_GLOBAL(global_null); } if (!bindTypes) { bindTypes = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC); ZEPHIR_CPY_WRT(eventsManager, _0); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_sqlStatement"), sqlStatement TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_sqlVariables"), bindParams TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_sqlBindTypes"), bindTypes TSRMLS_CC); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "db:beforeQuery", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_1, eventsManager, "fire", NULL, _2, this_ptr, bindParams); zephir_check_temp_parameter(_2); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { RETURN_MM_BOOL(0); } } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_pdo"), PH_NOISY_CC); ZEPHIR_CPY_WRT(pdo, _0); if (Z_TYPE_P(bindParams) == IS_ARRAY) { ZEPHIR_CALL_METHOD(&statement, pdo, "prepare", NULL, sqlStatement); zephir_check_call_status(); if (Z_TYPE_P(statement) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&_1, this_ptr, "executeprepared", NULL, statement, bindParams, bindTypes); zephir_check_call_status(); ZEPHIR_CPY_WRT(statement, _1); } } else { ZEPHIR_CALL_METHOD(&statement, pdo, "query", NULL, sqlStatement); zephir_check_call_status(); } if (Z_TYPE_P(statement) == IS_OBJECT) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_2); ZVAL_STRING(_2, "db:afterQuery", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, _2, this_ptr, bindParams); zephir_check_temp_parameter(_2); zephir_check_call_status(); } object_init_ex(return_value, phalcon_db_result_pdo_ce); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_3, this_ptr, statement, sqlStatement, bindParams, bindTypes); zephir_check_call_status(); RETURN_MM(); } RETURN_CCTOR(statement); }
/** * Sends SQL statements to the database server returning the success state. * Use this method only when the SQL statement sent to the server doesn't return any row * *<code> * //Inserting data * $success = $connection->execute("INSERT INTO robots VALUES (1, 'Astro Boy')"); * $success = $connection->execute("INSERT INTO robots VALUES (?, ?)", array(1, 'Astro Boy')); *</code> * * @param string sqlStatement * @param array bindParams * @param array bindTypes * @return boolean */ PHP_METHOD(Phalcon_Db_Adapter_Pdo, execute) { int ZEPHIR_LAST_CALL_STATUS; zval *sqlStatement_param = NULL, *bindParams = NULL, *bindTypes = NULL, *eventsManager = NULL, *affectedRows = NULL, *pdo = NULL, *newStatement = NULL, *statement = NULL, *_0, *_1 = NULL, *_2 = NULL; zval *sqlStatement = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &sqlStatement_param, &bindParams, &bindTypes); if (unlikely(Z_TYPE_P(sqlStatement_param) != IS_STRING && Z_TYPE_P(sqlStatement_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlStatement' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(sqlStatement_param) == IS_STRING)) { zephir_get_strval(sqlStatement, sqlStatement_param); } else { ZEPHIR_INIT_VAR(sqlStatement); ZVAL_EMPTY_STRING(sqlStatement); } if (!bindParams) { bindParams = ZEPHIR_GLOBAL(global_null); } if (!bindTypes) { bindTypes = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC); ZEPHIR_CPY_WRT(eventsManager, _0); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_sqlStatement"), sqlStatement TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_sqlVariables"), bindParams TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_sqlBindTypes"), bindTypes TSRMLS_CC); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "db:beforeQuery", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_1, eventsManager, "fire", NULL, _2, this_ptr, bindParams); zephir_check_temp_parameter(_2); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { RETURN_MM_BOOL(0); } } ZEPHIR_INIT_VAR(affectedRows); ZVAL_LONG(affectedRows, 0); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_pdo"), PH_NOISY_CC); ZEPHIR_CPY_WRT(pdo, _0); if (Z_TYPE_P(bindParams) == IS_ARRAY) { ZEPHIR_CALL_METHOD(&statement, pdo, "prepare", NULL, sqlStatement); zephir_check_call_status(); if (Z_TYPE_P(statement) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&newStatement, this_ptr, "executeprepared", NULL, statement, bindParams, bindTypes); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&affectedRows, newStatement, "rowcount", NULL); zephir_check_call_status(); } } else { ZEPHIR_CALL_METHOD(&affectedRows, pdo, "exec", NULL, sqlStatement); zephir_check_call_status(); } if (Z_TYPE_P(affectedRows) == IS_LONG) { zephir_update_property_this(this_ptr, SL("_affectedRows"), affectedRows TSRMLS_CC); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_2); ZVAL_STRING(_2, "db:afterQuery", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, _2, this_ptr, bindParams); zephir_check_temp_parameter(_2); zephir_check_call_status(); } } RETURN_MM_BOOL(1); }
/** * This method is automatically called in Phalcon\Db\Adapter\Pdo constructor. * Call it when you need to restore a database connection * *<code> * //Make a connection * $connection = new \Phalcon\Db\Adapter\Pdo\Mysql(array( * 'host' => '192.168.0.11', * 'username' => 'sigma', * 'password' => 'secret', * 'dbname' => 'blog', * )); * * //Reconnect * $connection->connect(); * </code> * * @param array descriptor * @return boolean */ PHP_METHOD(Phalcon_Db_Adapter_Pdo, connect) { int ZEPHIR_LAST_CALL_STATUS; HashTable *_1; HashPosition _0; zval *descriptor = NULL, *username = NULL, *password = NULL, *dsnParts, *dsnAttributes = NULL, *persistent, *options = NULL, *key = NULL, *value = NULL, **_2, *_3 = NULL, *_4, *_5, *_6; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &descriptor); if (!descriptor) { ZEPHIR_CPY_WRT(descriptor, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(descriptor); } if (Z_TYPE_P(descriptor) == IS_NULL) { ZEPHIR_OBS_NVAR(descriptor); zephir_read_property_this(&descriptor, this_ptr, SL("_descriptor"), PH_NOISY_CC); } ZEPHIR_OBS_VAR(username); if (zephir_array_isset_string_fetch(&username, descriptor, SS("username"), 0 TSRMLS_CC)) { zephir_array_unset_string(&descriptor, SS("username"), PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(username); ZVAL_NULL(username); } ZEPHIR_OBS_VAR(password); if (zephir_array_isset_string_fetch(&password, descriptor, SS("password"), 0 TSRMLS_CC)) { zephir_array_unset_string(&descriptor, SS("password"), PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(password); ZVAL_NULL(password); } ZEPHIR_OBS_VAR(options); if (zephir_array_isset_string_fetch(&options, descriptor, SS("options"), 0 TSRMLS_CC)) { zephir_array_unset_string(&descriptor, SS("options"), PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(options); array_init(options); } ZEPHIR_OBS_VAR(dsnAttributes); if (!(zephir_array_isset_string_fetch(&dsnAttributes, descriptor, SS("dsn"), 0 TSRMLS_CC))) { ZEPHIR_INIT_VAR(dsnParts); array_init(dsnParts); zephir_is_iterable(descriptor, &_1, &_0, 0, 0, "phalcon/db/adapter/pdo.zep", 130); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HMKEY(key, _1, _0); ZEPHIR_GET_HVALUE(value, _2); ZEPHIR_INIT_LNVAR(_3); ZEPHIR_CONCAT_VSV(_3, key, "=", value); zephir_array_append(&dsnParts, _3, PH_SEPARATE, "phalcon/db/adapter/pdo.zep", 128); } ZEPHIR_INIT_NVAR(dsnAttributes); zephir_fast_join_str(dsnAttributes, SL(";"), dsnParts TSRMLS_CC); } ZEPHIR_INIT_VAR(_4); ZVAL_LONG(_4, 2); zephir_array_update_long(&options, 3, &_4, PH_COPY | PH_SEPARATE, "phalcon/db/adapter/pdo.zep", 133); if (zephir_array_isset_string_fetch(&persistent, descriptor, SS("persistent"), 1 TSRMLS_CC)) { if (zephir_is_true(persistent)) { zephir_array_update_long(&options, 12, &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE, "phalcon/db/adapter/pdo.zep", 140); } } ZEPHIR_INIT_VAR(_5); object_init_ex(_5, php_pdo_get_dbh_ce()); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); ZEPHIR_INIT_LNVAR(_3); ZEPHIR_CONCAT_VSV(_3, _6, ":", dsnAttributes); ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, _3, username, password, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_pdo"), _5 TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Executes a prepared statement binding. This function uses integer indexes starting from zero * *<code> * $statement = $db->prepare('SELECT * FROM robots WHERE name = :name'); * $result = $connection->executePrepared($statement, array('name' => 'Voltron')); *</code> * * @param \PDOStatement statement * @param array placeholders * @param array dataTypes * @return \PDOStatement */ PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared) { zephir_fcall_cache_entry *_3 = NULL; int ZEPHIR_LAST_CALL_STATUS; HashTable *_1; HashPosition _0; zval *statement, *placeholders, *dataTypes, *wildcard = NULL, *value = NULL, *type = NULL, *castValue = NULL, *parameter = NULL, **_2; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &statement, &placeholders, &dataTypes); if (Z_TYPE_P(placeholders) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Placeholders must be an array", "phalcon/db/adapter/pdo.zep", 181); return; } zephir_is_iterable(placeholders, &_1, &_0, 0, 0, "phalcon/db/adapter/pdo.zep", 225); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HMKEY(wildcard, _1, _0); ZEPHIR_GET_HVALUE(value, _2); if (Z_TYPE_P(wildcard) == IS_LONG) { ZEPHIR_INIT_NVAR(parameter); ZVAL_LONG(parameter, (zephir_get_numberval(wildcard) + 1)); } else { if (Z_TYPE_P(wildcard) == IS_STRING) { ZEPHIR_CPY_WRT(parameter, wildcard); } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid bind parameter (1)", "phalcon/db/adapter/pdo.zep", 192); return; } } if (Z_TYPE_P(dataTypes) == IS_ARRAY) { ZEPHIR_OBS_NVAR(type); if (!(zephir_array_isset_fetch(&type, dataTypes, wildcard, 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid bind type parameter (2)", "phalcon/db/adapter/pdo.zep", 199); return; } if (ZEPHIR_IS_LONG(type, 32)) { ZEPHIR_INIT_NVAR(castValue); ZVAL_DOUBLE(castValue, zephir_get_doubleval(value)); ZEPHIR_INIT_NVAR(type); ZVAL_LONG(type, 1024); } else { ZEPHIR_CPY_WRT(castValue, value); } if (ZEPHIR_IS_LONG(type, 1024)) { ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_3, parameter, castValue); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_3, parameter, castValue, type); zephir_check_call_status(); } } else { ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_3, parameter, value); zephir_check_call_status(); } } ZEPHIR_CALL_METHOD(NULL, statement, "execute", NULL); zephir_check_call_status(); RETVAL_ZVAL(statement, 1, 0); RETURN_MM(); }
/** * Stores cached content into the file backend and stops the frontend * * @param int|string keyName * @param string content * @param long lifetime * @param boolean stopBuffer */ PHP_METHOD(Phalcon_Cache_Backend_Xcache, save) { zephir_fcall_cache_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; zend_bool stopBuffer; zval *keyName = NULL, *content = NULL, *lifetime = NULL, *stopBuffer_param = NULL, *lastKey = NULL, *frontend, *cachedContent = NULL, *preparedContent = NULL, *tmp, *tt1 = NULL, *success = NULL, *isBuffering = NULL, *options, *keys = NULL, *specialKey, *_0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 4, &keyName, &content, &lifetime, &stopBuffer_param); if (!keyName) { keyName = ZEPHIR_GLOBAL(global_null); } if (!content) { content = ZEPHIR_GLOBAL(global_null); } if (!lifetime) { lifetime = ZEPHIR_GLOBAL(global_null); } if (!stopBuffer_param) { stopBuffer = 1; } else { stopBuffer = zephir_get_boolval(stopBuffer_param); } if (!(zephir_is_true(keyName))) { ZEPHIR_OBS_VAR(lastKey); zephir_read_property_this(&lastKey, this_ptr, SL("_lastKey"), PH_NOISY_CC); } else { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(lastKey); ZEPHIR_CONCAT_SVV(lastKey, "_PHCX", _0, keyName); } if (!(zephir_is_true(lastKey))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cache must be started first", "phalcon/cache/backend/xcache.zep", 119); return; } ZEPHIR_OBS_VAR(frontend); zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC); if (!(zephir_is_true(content))) { ZEPHIR_CALL_METHOD(&cachedContent, frontend, "getcontent", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(cachedContent, content); } if (!(zephir_is_numeric(cachedContent))) { ZEPHIR_CALL_METHOD(&preparedContent, frontend, "beforestore", NULL, 0, cachedContent); zephir_check_call_status(); } if (!(zephir_is_true(lifetime))) { ZEPHIR_OBS_VAR(tmp); zephir_read_property_this(&tmp, this_ptr, SL("_lastLifetime"), PH_NOISY_CC); if (!(zephir_is_true(tmp))) { ZEPHIR_CALL_METHOD(&tt1, frontend, "getlifetime", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(tt1, tmp); } } else { ZEPHIR_CPY_WRT(tt1, lifetime); } if (zephir_is_numeric(cachedContent)) { ZEPHIR_CALL_FUNCTION(&success, "xcache_set", &_1, 82, lastKey, cachedContent, tt1); zephir_check_call_status(); } else { ZEPHIR_CALL_FUNCTION(&success, "xcache_set", &_1, 82, lastKey, preparedContent, tt1); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&isBuffering, frontend, "isbuffering", NULL, 0); zephir_check_call_status(); if (stopBuffer == 1) { ZEPHIR_CALL_METHOD(NULL, frontend, "stop", NULL, 0); zephir_check_call_status(); } if (ZEPHIR_IS_TRUE_IDENTICAL(isBuffering)) { zend_print_zval(cachedContent, 0); } zephir_update_property_this(this_ptr, SL("_started"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); if (zephir_is_true(success)) { ZEPHIR_OBS_VAR(options); zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_OBS_VAR(specialKey); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); if (!(zephir_array_isset_string_fetch(&specialKey, _0, SS("statsKey"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/xcache.zep", 169); return; } ZEPHIR_CALL_FUNCTION(&keys, "xcache_get", NULL, 81, specialKey); zephir_check_call_status(); if (Z_TYPE_P(keys) != IS_ARRAY) { ZEPHIR_INIT_NVAR(keys); array_init(keys); } zephir_array_update_zval(&keys, lastKey, &tt1, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_FUNCTION(NULL, "xcache_set", &_1, 82, specialKey, keys); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); }
/** * Returns a complete resultset as an array, if the resultset has a big number of rows * it could consume more memory than currently it does. Export the resultset to an array * couldn't be faster with a large number of records */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) { zephir_fcall_cache_entry *_10 = NULL; HashTable *_3, *_6; HashPosition _2, _5; int ZEPHIR_LAST_CALL_STATUS; zval *renameColumns_param = NULL, *result = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords, *columnMap, *_0, *_1, **_4, **_7, *_8 = NULL, *_9 = NULL; zend_bool renameColumns; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &renameColumns_param); if (!renameColumns_param) { renameColumns = 1; } else { renameColumns = zephir_get_boolval(renameColumns_param); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); if (zephir_is_true(_0)) { ZEPHIR_OBS_VAR(result); zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); if (Z_TYPE_P(result) == IS_OBJECT) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC); if (Z_TYPE_P(_1) != IS_NULL) { ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(records); array_init(records); } } else { ZEPHIR_OBS_NVAR(records); zephir_read_property_this(&records, this_ptr, SL("_rows"), PH_NOISY_CC); if (Z_TYPE_P(records) != IS_ARRAY) { ZEPHIR_OBS_NVAR(result); zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); if (Z_TYPE_P(result) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(records); array_init(records); } } } if (renameColumns) { ZEPHIR_OBS_VAR(columnMap); zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); if (Z_TYPE_P(columnMap) != IS_ARRAY) { RETURN_CCTOR(records); } ZEPHIR_INIT_VAR(renamedRecords); array_init(renamedRecords); if (Z_TYPE_P(records) == IS_ARRAY) { zephir_is_iterable(records, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 263); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(record, _4); ZEPHIR_INIT_NVAR(renamed); array_init(renamed); zephir_is_iterable(record, &_6, &_5, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 261); for ( ; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS ; zephir_hash_move_forward_ex(_6, &_5) ) { ZEPHIR_GET_HMKEY(key, _6, _5); ZEPHIR_GET_HVALUE(value, _7); ZEPHIR_OBS_NVAR(renamedKey); if (!(zephir_array_isset_fetch(&renamedKey, columnMap, key, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_8); object_init_ex(_8, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVS(_9, "Column '", key, "' is not part of the column map"); ZEPHIR_CALL_METHOD(NULL, _8, "__construct", &_10, _9); zephir_check_call_status(); zephir_throw_exception_debug(_8, "phalcon/mvc/model/resultset/simple.zep", 249 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } zephir_array_update_zval(&renamed, renamedKey, &value, PH_COPY | PH_SEPARATE); } zephir_array_append(&renamedRecords, renamed, PH_SEPARATE, "phalcon/mvc/model/resultset/simple.zep", 261); } } RETURN_CCTOR(renamedRecords); } RETURN_CCTOR(records); }
/** * Returns current row in the resultset */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) { zephir_nts_static zephir_fcall_cache_entry *_6 = NULL, *_8 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *result, *row = NULL, *hydrateMode, *columnMap, *activeRow = NULL, *_0, *_1, *_2 = NULL, *_3, *_4, *_5, *_7; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(activeRow); zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); if (Z_TYPE_P(activeRow) != IS_NULL) { RETURN_CCTOR(activeRow); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); if (zephir_is_true(_0)) { ZEPHIR_OBS_VAR(row); zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); } else { _1 = zephir_fetch_nproperty_this(this_ptr, SL("_rows"), PH_NOISY_CC); if (Z_TYPE_P(_1) == IS_NULL) { ZEPHIR_OBS_VAR(result); zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); if (Z_TYPE_P(result) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&_2, result, "fetchall", NULL); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_rows"), _2 TSRMLS_CC); } } ZEPHIR_OBS_VAR(_3); zephir_read_property_this(&_3, this_ptr, SL("_rows"), PH_NOISY_CC); if (Z_TYPE_P(_3) == IS_ARRAY) { ZEPHIR_OBS_NVAR(row); _4 = zephir_fetch_nproperty_this(this_ptr, SL("_rows"), PH_NOISY_CC); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC); if (!(zephir_array_isset_fetch(&row, _4, _5, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(row); ZVAL_BOOL(row, 0); } } else { ZEPHIR_INIT_NVAR(row); ZVAL_BOOL(row, 0); } } if (Z_TYPE_P(row) != IS_ARRAY) { zephir_update_property_this(this_ptr, SL("_activeRow"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); RETURN_MM_BOOL(0); } ZEPHIR_OBS_VAR(hydrateMode); zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); ZEPHIR_OBS_VAR(columnMap); zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); do { if (ZEPHIR_IS_LONG(hydrateMode, 0)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); _4 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_7); ZVAL_LONG(_7, 0); ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_6, _1, row, columnMap, _7, _4); zephir_check_call_status(); break; } ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_8, row, columnMap, hydrateMode); zephir_check_call_status(); break; } while(0); zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); RETURN_CCTOR(activeRow); }
/** * Reconfigure the route adding a new pattern and a set of paths * * @param string pattern * @param array paths */ PHP_METHOD(Phalcon_Mvc_Router_Route, reConfigure) { int _0, ZEPHIR_LAST_CALL_STATUS; zval *pattern_param = NULL, *paths = NULL, *moduleName = NULL, *controllerName = NULL, *actionName = NULL, *parts, *routePaths = NULL, *realClassName = NULL, *namespaceName, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_1 = NULL, *_2; zval *pattern = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &pattern_param, &paths); if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { zephir_get_strval(pattern, pattern_param); } else { ZEPHIR_INIT_VAR(pattern); ZVAL_EMPTY_STRING(pattern); } if (!paths) { paths = ZEPHIR_GLOBAL(global_null); } if (Z_TYPE_P(paths) != IS_NULL) { if (Z_TYPE_P(paths) == IS_STRING) { ZEPHIR_INIT_VAR(moduleName); ZVAL_NULL(moduleName); ZEPHIR_INIT_VAR(controllerName); ZVAL_NULL(controllerName); ZEPHIR_INIT_VAR(actionName); ZVAL_NULL(actionName); ZEPHIR_INIT_VAR(parts); zephir_fast_explode_str(parts, SL("::"), paths, LONG_MAX TSRMLS_CC); do { _0 = zephir_fast_count_int(parts TSRMLS_CC); if (_0 == 3) { ZEPHIR_OBS_NVAR(moduleName); zephir_array_fetch_long(&moduleName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 316 TSRMLS_CC); ZEPHIR_OBS_NVAR(controllerName); zephir_array_fetch_long(&controllerName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 317 TSRMLS_CC); ZEPHIR_OBS_NVAR(actionName); zephir_array_fetch_long(&actionName, parts, 2, PH_NOISY, "phalcon/mvc/router/route.zep", 318 TSRMLS_CC); break; } if (_0 == 2) { ZEPHIR_OBS_NVAR(controllerName); zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 321 TSRMLS_CC); ZEPHIR_OBS_NVAR(actionName); zephir_array_fetch_long(&actionName, parts, 1, PH_NOISY, "phalcon/mvc/router/route.zep", 322 TSRMLS_CC); break; } if (_0 == 1) { ZEPHIR_OBS_NVAR(controllerName); zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 325 TSRMLS_CC); break; } } while(0); ZEPHIR_INIT_VAR(routePaths); array_init(routePaths); if (Z_TYPE_P(moduleName) != IS_NULL) { zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(controllerName) != IS_NULL) { if (zephir_memnstr_str(controllerName, SL("\\"), "phalcon/mvc/router/route.zep", 340)) { ZEPHIR_INIT_VAR(realClassName); zephir_get_class_ns(realClassName, controllerName, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(namespaceName); zephir_get_ns_class(namespaceName, controllerName, 0 TSRMLS_CC); if (zephir_is_true(namespaceName)) { zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); } } else { ZEPHIR_CPY_WRT(realClassName, controllerName); } ZEPHIR_INIT_VAR(_1); zephir_uncamelize(_1, realClassName); zephir_array_update_string(&routePaths, SL("controller"), &_1, PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(actionName) != IS_NULL) { zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); } } else { ZEPHIR_CPY_WRT(routePaths, paths); } } else { ZEPHIR_INIT_NVAR(routePaths); array_init(routePaths); } if (Z_TYPE_P(routePaths) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "The route contains invalid paths", "phalcon/mvc/router/route.zep", 372); return; } if (!(zephir_start_with_str(pattern, SL("#")))) { if (zephir_memnstr_str(pattern, SL("{"), "phalcon/mvc/router/route.zep", 380)) { ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, pattern); zephir_check_call_status(); ZEPHIR_OBS_VAR(pcrePattern); zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 385 TSRMLS_CC); ZEPHIR_INIT_NVAR(_1); zephir_array_fetch_long(&_2, extracted, 1, PH_NOISY | PH_READONLY, "phalcon/mvc/router/route.zep", 386 TSRMLS_CC); zephir_fast_array_merge(_1, &(routePaths), &(_2) TSRMLS_CC); ZEPHIR_CPY_WRT(routePaths, _1); } else { ZEPHIR_CPY_WRT(pcrePattern, pattern); } ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, pcrePattern); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(compiledPattern, pattern); } zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Commits the active transaction in the connection */ PHP_METHOD(Phalcon_Db_Adapter_Pdo, commit) { int transactionLevel, ZEPHIR_LAST_CALL_STATUS; zval *nesting_param = NULL, *pdo, *eventsManager = NULL, *savepointName = NULL, *_0, *_1, *_2 = NULL, *_5 = NULL; zend_bool nesting, _3, _4; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &nesting_param); if (!nesting_param) { nesting = 1; } else { nesting = zephir_get_boolval(nesting_param); } ZEPHIR_OBS_VAR(pdo); zephir_read_property_this(&pdo, this_ptr, SL("_pdo"), PH_NOISY_CC); if (Z_TYPE_P(pdo) != IS_OBJECT) { RETURN_MM_BOOL(0); } ZEPHIR_OBS_VAR(_0); zephir_read_property_this(&_0, this_ptr, SL("_transactionLevel"), PH_NOISY_CC); transactionLevel = zephir_get_intval(_0); if (!(transactionLevel)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "There is no active transaction", "phalcon/db/adapter/pdo.zep", 626); return; } if (transactionLevel == 1) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC); ZEPHIR_CPY_WRT(eventsManager, _1); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "db:commitTransaction", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, _2, this_ptr); zephir_check_temp_parameter(_2); zephir_check_call_status(); } RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_transactionLevel") TSRMLS_CC)); ZEPHIR_RETURN_CALL_METHOD(pdo, "commit", NULL); zephir_check_call_status(); RETURN_MM(); } else { _3 = (transactionLevel) ? 1 : 0; if (_3) { _3 = nesting; } _4 = _3; if (_4) { ZEPHIR_CALL_METHOD(&_5, this_ptr, "isnestedtransactionswithsavepoints", NULL); zephir_check_call_status(); _4 = zephir_is_true(_5); } if (_4) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC); ZEPHIR_CPY_WRT(eventsManager, _1); ZEPHIR_CALL_METHOD(&savepointName, this_ptr, "getnestedtransactionsavepointname", NULL); zephir_check_call_status(); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_2); ZVAL_STRING(_2, "db:releaseSavepoint", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, _2, this_ptr, savepointName); zephir_check_temp_parameter(_2); zephir_check_call_status(); } RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_transactionLevel") TSRMLS_CC)); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "releasesavepoint", NULL, savepointName); zephir_check_call_status(); RETURN_MM(); } } if (transactionLevel > 0) { RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("_transactionLevel") TSRMLS_CC)); } RETURN_MM_BOOL(0); }
/** * Logs messages to the internal logger. Appends logs to the logger */ PHP_METHOD(Phalcon_Logger_Adapter, log) { zend_bool _0, _1$$4; int ZEPHIR_LAST_CALL_STATUS; zval *context = NULL; zval *type, *message = NULL, *context_param = NULL, *timestamp = NULL, *toggledMessage = NULL, *toggledType = NULL, *_2, *_3$$8, *_4$$9; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &type, &message, &context_param); if (!message) { message = ZEPHIR_GLOBAL(global_null); } if (!context_param) { ZEPHIR_INIT_VAR(context); array_init(context); } else { context = context_param; } _0 = Z_TYPE_P(type) == IS_STRING; if (_0) { _0 = Z_TYPE_P(message) == IS_LONG; } if (_0) { ZEPHIR_CPY_WRT(toggledMessage, type); ZEPHIR_CPY_WRT(toggledType, message); } else { _1$$4 = Z_TYPE_P(type) == IS_STRING; if (_1$$4) { _1$$4 = Z_TYPE_P(message) == IS_NULL; } if (_1$$4) { ZEPHIR_CPY_WRT(toggledMessage, type); ZEPHIR_CPY_WRT(toggledType, message); } else { ZEPHIR_CPY_WRT(toggledMessage, message); ZEPHIR_CPY_WRT(toggledType, type); } } if (Z_TYPE_P(toggledType) == IS_NULL) { ZEPHIR_INIT_NVAR(toggledType); ZVAL_LONG(toggledType, 7); } _2 = zephir_fetch_nproperty_this(this_ptr, SL("_logLevel"), PH_NOISY_CC); if (ZEPHIR_GE(_2, toggledType)) { ZEPHIR_INIT_VAR(timestamp); zephir_time(timestamp); _3$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_transaction"), PH_NOISY_CC); if (zephir_is_true(_3$$8)) { ZEPHIR_INIT_VAR(_4$$9); object_init_ex(_4$$9, phalcon_logger_item_ce); ZEPHIR_CALL_METHOD(NULL, _4$$9, "__construct", NULL, 25, toggledMessage, toggledType, timestamp, context); zephir_check_call_status(); zephir_update_property_array_append(this_ptr, SL("_queue"), _4$$9 TSRMLS_CC); } else { ZEPHIR_CALL_METHOD(NULL, this_ptr, "loginternal", NULL, 0, toggledMessage, toggledType, timestamp, context); zephir_check_call_status(); } } RETURN_THIS(); }
/** * Returns a slice of the resultset to show in the pagination */ PHP_METHOD(Phalcon_Paginator_Adapter_QueryBuilder, getPaginate) { zval *_4$$8; zval *originalBuilder = NULL, *builder = NULL, *totalBuilder = NULL, *totalPages = NULL, *limit = NULL, *number = NULL, *query = NULL, *page = NULL, *items = NULL, *totalQuery = NULL, *result = NULL, *row = NULL, *rowcount = NULL, *next = NULL, *_0, *_1 = NULL, *groups = NULL, *_6, _7, _8, *_9, *groupColumn$$8 = NULL, *_2$$8 = NULL, *_3$$8, *_5$$8; int ZEPHIR_LAST_CALL_STATUS, numberPage = 0, before = 0; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(originalBuilder); zephir_read_property_this(&originalBuilder, this_ptr, SL("_builder"), PH_NOISY_CC); ZEPHIR_INIT_VAR(builder); if (zephir_clone(builder, originalBuilder TSRMLS_CC) == FAILURE) { RETURN_MM(); } ZEPHIR_INIT_VAR(totalBuilder); if (zephir_clone(totalBuilder, builder TSRMLS_CC) == FAILURE) { RETURN_MM(); } ZEPHIR_OBS_VAR(limit); zephir_read_property_this(&limit, this_ptr, SL("_limitRows"), PH_NOISY_CC); ZEPHIR_OBS_VAR(_0); zephir_read_property_this(&_0, this_ptr, SL("_page"), PH_NOISY_CC); numberPage = zephir_get_intval(_0); if (!(numberPage)) { numberPage = 1; } ZEPHIR_INIT_VAR(number); ZVAL_LONG(number, (zephir_get_numberval(limit) * ((numberPage - 1)))); if (ZEPHIR_LT(number, limit)) { ZEPHIR_CALL_METHOD(NULL, builder, "limit", NULL, 0, limit); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(NULL, builder, "limit", NULL, 0, limit, number); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&query, builder, "getquery", NULL, 0); zephir_check_call_status(); if (numberPage == 1) { before = 1; } else { before = (numberPage - 1); } ZEPHIR_CALL_METHOD(&items, query, "execute", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "COUNT(*) [rowcount]", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, totalBuilder, "columns", NULL, 0, _1); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&groups, totalBuilder, "getgroupby", NULL, 0); zephir_check_call_status(); if (!(ZEPHIR_IS_EMPTY(groups))) { if (Z_TYPE_P(groups) == IS_ARRAY) { ZEPHIR_INIT_VAR(groupColumn$$8); zephir_fast_join_str(groupColumn$$8, SL(", "), groups TSRMLS_CC); } else { ZEPHIR_CPY_WRT(groupColumn$$8, groups); } ZEPHIR_INIT_VAR(_3$$8); ZVAL_NULL(_3$$8); ZEPHIR_CALL_METHOD(&_2$$8, totalBuilder, "groupby", NULL, 0, _3$$8); zephir_check_call_status(); ZEPHIR_INIT_VAR(_4$$8); zephir_create_array(_4$$8, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_5$$8); ZEPHIR_CONCAT_SVS(_5$$8, "COUNT(DISTINCT ", groupColumn$$8, ") AS rowcount"); zephir_array_fast_append(_4$$8, _5$$8); ZEPHIR_CALL_METHOD(NULL, _2$$8, "columns", NULL, 0, _4$$8); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_1); ZVAL_NULL(_1); ZEPHIR_CALL_METHOD(NULL, totalBuilder, "orderby", NULL, 0, _1); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&totalQuery, totalBuilder, "getquery", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&result, totalQuery, "execute", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&row, result, "getfirst", NULL, 0); zephir_check_call_status(); if (zephir_is_true(row)) { ZEPHIR_OBS_VAR(_6); zephir_read_property(&_6, row, SL("rowcount"), PH_NOISY_CC); ZEPHIR_INIT_VAR(rowcount); ZVAL_LONG(rowcount, zephir_get_intval(_6)); } else { ZEPHIR_INIT_NVAR(rowcount); ZVAL_LONG(rowcount, 0); } ZEPHIR_SINIT_VAR(_7); div_function(&_7, rowcount, limit TSRMLS_CC); ZEPHIR_SINIT_VAR(_8); ZVAL_DOUBLE(&_8, zephir_ceil(&_7 TSRMLS_CC)); ZEPHIR_INIT_VAR(totalPages); ZVAL_LONG(totalPages, zephir_get_intval(&_8)); if (ZEPHIR_GT_LONG(totalPages, numberPage)) { ZEPHIR_INIT_VAR(next); ZVAL_LONG(next, (numberPage + 1)); } else { ZEPHIR_CPY_WRT(next, totalPages); } ZEPHIR_INIT_VAR(page); object_init(page); zephir_update_property_zval(page, SL("items"), items TSRMLS_CC); ZEPHIR_INIT_ZVAL_NREF(_9); ZVAL_LONG(_9, 1); zephir_update_property_zval(page, SL("first"), _9 TSRMLS_CC); ZEPHIR_INIT_ZVAL_NREF(_9); ZVAL_LONG(_9, before); zephir_update_property_zval(page, SL("before"), _9 TSRMLS_CC); ZEPHIR_INIT_ZVAL_NREF(_9); ZVAL_LONG(_9, numberPage); zephir_update_property_zval(page, SL("current"), _9 TSRMLS_CC); zephir_update_property_zval(page, SL("last"), totalPages TSRMLS_CC); zephir_update_property_zval(page, SL("next"), next TSRMLS_CC); zephir_update_property_zval(page, SL("total_pages"), totalPages TSRMLS_CC); zephir_update_property_zval(page, SL("total_items"), rowcount TSRMLS_CC); _9 = zephir_fetch_nproperty_this(this_ptr, SL("_limitRows"), PH_NOISY_CC); zephir_update_property_zval(page, SL("limit"), _9 TSRMLS_CC); RETURN_CCTOR(page); }
/** * Creates a table */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, createTable) { HashTable *_2$$6; HashPosition _1$$6; zephir_fcall_cache_entry *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *definition = NULL; zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL, *sql = NULL, *queries = NULL, *query = NULL, *exception = NULL, *columns = NULL, *_0, **_3$$6, *_4$$7 = NULL, *_6$$5, *_7$$10, *_8$$10; zval *tableName = NULL, *schemaName = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_param); if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { zephir_get_strval(tableName, tableName_param); } else { ZEPHIR_INIT_VAR(tableName); ZVAL_EMPTY_STRING(tableName); } if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { zephir_get_strval(schemaName, schemaName_param); } else { ZEPHIR_INIT_VAR(schemaName); ZVAL_EMPTY_STRING(schemaName); } definition = definition_param; ZEPHIR_OBS_VAR(columns); if (!(zephir_array_isset_string_fetch(&columns, definition, SS("columns"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The table must contain at least one column", "phalcon/db/adapter/pdo/postgresql.zep", 292); return; } if (!(zephir_fast_count_int(columns TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The table must contain at least one column", "phalcon/db/adapter/pdo/postgresql.zep", 296); return; } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&sql, _0, "createtable", NULL, 0, tableName, schemaName, definition); zephir_check_call_status(); ZEPHIR_INIT_VAR(queries); zephir_fast_explode_str(queries, SL(";"), sql, LONG_MAX TSRMLS_CC); if (zephir_fast_count_int(queries TSRMLS_CC) > 1) { /* try_start_1: */ ZEPHIR_CALL_METHOD(NULL, this_ptr, "begin", NULL, 0); zephir_check_call_status_or_jump(try_end_1); zephir_is_iterable(queries, &_2$$6, &_1$$6, 0, 0, "phalcon/db/adapter/pdo/postgresql.zep", 312); for ( ; zend_hash_get_current_data_ex(_2$$6, (void**) &_3$$6, &_1$$6) == SUCCESS ; zend_hash_move_forward_ex(_2$$6, &_1$$6) ) { ZEPHIR_GET_HVALUE(query, _3$$6); if (ZEPHIR_IS_EMPTY(query)) { continue; } ZEPHIR_INIT_LNVAR(_4$$7); ZEPHIR_CONCAT_VS(_4$$7, query, ";"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "query", &_5, 0, _4$$7); zephir_check_call_status_or_jump(try_end_1); } ZEPHIR_RETURN_CALL_METHOD(this_ptr, "commit", NULL, 0); zephir_check_call_status_or_jump(try_end_1); RETURN_MM(); try_end_1: if (EG(exception)) { ZEPHIR_INIT_VAR(_6$$5); ZEPHIR_CPY_WRT(_6$$5, EG(exception)); if (zephir_instance_of_ev(_6$$5, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CPY_WRT(exception, _6$$5); ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); zephir_check_call_status(); zephir_throw_exception_debug(exception, "phalcon/db/adapter/pdo/postgresql.zep", 316 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } else { zephir_array_fetch_long(&_7$$10, queries, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 319 TSRMLS_CC); ZEPHIR_INIT_VAR(_8$$10); ZEPHIR_CONCAT_VS(_8$$10, _7$$10, ";"); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, _8$$10); zephir_check_call_status(); RETURN_MM(); } RETURN_MM_BOOL(1); }
/** * Builds a Phalcon\Mvc\Model\Criteria based on an input array like _POST */ PHP_METHOD(Phalcon_Mvc_Model_Criteria, fromInput) { zend_bool _6$$4, _7$$7; HashTable *_4$$3; HashPosition _3$$3; zend_class_entry *_2$$3; int ZEPHIR_LAST_CALL_STATUS; zval *data = NULL; zval *modelName = NULL, *operator = NULL, *_12$$10; zval *dependencyInjector, *modelName_param = NULL, *data_param = NULL, *operator_param = NULL, *attribute = NULL, *conditions = NULL, *field = NULL, *value = NULL, *type = NULL, *metaData = NULL, *model = NULL, *dataTypes = NULL, *bind = NULL, *criteria = NULL, *columnMap = NULL, *_0$$3 = NULL, *_1$$3 = NULL, **_5$$3, *_8$$9 = NULL, *_9$$9 = NULL, *_10$$8 = NULL, *_11$$10; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &dependencyInjector, &modelName_param, &data_param, &operator_param); if (unlikely(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(modelName_param) == IS_STRING)) { zephir_get_strval(modelName, modelName_param); } else { ZEPHIR_INIT_VAR(modelName); ZVAL_EMPTY_STRING(modelName); } data = data_param; if (!operator_param) { ZEPHIR_INIT_VAR(operator); ZVAL_STRING(operator, "AND", 1); } else { if (unlikely(Z_TYPE_P(operator_param) != IS_STRING && Z_TYPE_P(operator_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'operator' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(operator_param) == IS_STRING)) { zephir_get_strval(operator, operator_param); } else { ZEPHIR_INIT_VAR(operator); ZVAL_EMPTY_STRING(operator); } } ZEPHIR_INIT_VAR(conditions); array_init(conditions); if (zephir_fast_count_int(data TSRMLS_CC)) { ZEPHIR_INIT_VAR(_0$$3); ZVAL_STRING(_0$$3, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&metaData, dependencyInjector, "getshared", NULL, 0, _0$$3); zephir_check_temp_parameter(_0$$3); zephir_check_call_status(); ZEPHIR_INIT_VAR(model); zephir_fetch_safe_class(_1$$3, modelName); _2$$3 = zend_fetch_class(Z_STRVAL_P(_1$$3), Z_STRLEN_P(_1$$3), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(model, _2$$3); if (zephir_has_constructor(model TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_0$$3); ZVAL_NULL(_0$$3); ZEPHIR_CALL_METHOD(NULL, model, "__construct", NULL, 0, _0$$3, dependencyInjector); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&dataTypes, metaData, "getdatatypes", NULL, 0, model); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&columnMap, metaData, "getreversecolumnmap", NULL, 0, model); zephir_check_call_status(); ZEPHIR_INIT_VAR(bind); array_init(bind); zephir_is_iterable(data, &_4$$3, &_3$$3, 0, 0, "phalcon/mvc/model/criteria.zep", 711); for ( ; zephir_hash_get_current_data_ex(_4$$3, (void**) &_5$$3, &_3$$3) == SUCCESS ; zephir_hash_move_forward_ex(_4$$3, &_3$$3) ) { ZEPHIR_GET_HMKEY(field, _4$$3, _3$$3); ZEPHIR_GET_HVALUE(value, _5$$3); _6$$4 = Z_TYPE_P(columnMap) == IS_ARRAY; if (_6$$4) { _6$$4 = ((zephir_fast_count_int(columnMap TSRMLS_CC)) ? 1 : 0); } if (_6$$4) { ZEPHIR_OBS_NVAR(attribute); zephir_array_fetch(&attribute, columnMap, field, PH_NOISY, "phalcon/mvc/model/criteria.zep", 688 TSRMLS_CC); } else { ZEPHIR_CPY_WRT(attribute, field); } ZEPHIR_OBS_NVAR(type); if (zephir_array_isset_fetch(&type, dataTypes, attribute, 0 TSRMLS_CC)) { _7$$7 = Z_TYPE_P(value) != IS_NULL; if (_7$$7) { _7$$7 = !ZEPHIR_IS_STRING_IDENTICAL(value, ""); } if (_7$$7) { if (ZEPHIR_IS_LONG(type, 2)) { ZEPHIR_INIT_LNVAR(_8$$9); ZEPHIR_CONCAT_SVSVS(_8$$9, "[", field, "] LIKE :", field, ":"); zephir_array_append(&conditions, _8$$9, PH_SEPARATE, "phalcon/mvc/model/criteria.zep", 700); ZEPHIR_INIT_LNVAR(_9$$9); ZEPHIR_CONCAT_SVS(_9$$9, "%", value, "%"); zephir_array_update_zval(&bind, field, &_9$$9, PH_COPY | PH_SEPARATE); continue; } ZEPHIR_INIT_LNVAR(_10$$8); ZEPHIR_CONCAT_SVSVS(_10$$8, "[", field, "] = :", field, ":"); zephir_array_append(&conditions, _10$$8, PH_SEPARATE, "phalcon/mvc/model/criteria.zep", 707); zephir_array_update_zval(&bind, field, &value, PH_COPY | PH_SEPARATE); } } } } ZEPHIR_INIT_VAR(criteria); object_init_ex(criteria, phalcon_mvc_model_criteria_ce); if (zephir_has_constructor(criteria TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, criteria, "__construct", NULL, 0); zephir_check_call_status(); } if (zephir_fast_count_int(conditions TSRMLS_CC)) { ZEPHIR_INIT_VAR(_11$$10); ZEPHIR_INIT_VAR(_12$$10); ZEPHIR_CONCAT_SVS(_12$$10, " ", operator, " "); zephir_fast_join(_11$$10, _12$$10, conditions TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, criteria, "where", NULL, 328, _11$$10); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, criteria, "bind", NULL, 329, bind); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 320, modelName); zephir_check_call_status(); RETURN_CCTOR(criteria); }
/** * Handle the whole command-line tasks */ PHP_METHOD(Phalcon_Cli_Console, handle) { zend_bool _5; zend_long ZEPHIR_LAST_CALL_STATUS; zval *arguments_param = NULL, __$false, dependencyInjector, router, eventsManager, moduleName, modules, module, path, className, moduleObject, dispatcher, task, _0, _3, _4, _15, _16, _17, _18, _1$$4, _2$$4, _6$$6, _7$$10, _8$$10, _9$$12, _10$$12, _11$$17, _12$$17, _13$$18, _14$$18, _19$$20, _20$$20, _21$$22; zval arguments; zval *this_ptr = getThis(); ZVAL_UNDEF(&arguments); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&dependencyInjector); ZVAL_UNDEF(&router); ZVAL_UNDEF(&eventsManager); ZVAL_UNDEF(&moduleName); ZVAL_UNDEF(&modules); ZVAL_UNDEF(&module); ZVAL_UNDEF(&path); ZVAL_UNDEF(&className); ZVAL_UNDEF(&moduleObject); ZVAL_UNDEF(&dispatcher); ZVAL_UNDEF(&task); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_15); ZVAL_UNDEF(&_16); ZVAL_UNDEF(&_17); ZVAL_UNDEF(&_18); ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$4); ZVAL_UNDEF(&_6$$6); ZVAL_UNDEF(&_7$$10); ZVAL_UNDEF(&_8$$10); ZVAL_UNDEF(&_9$$12); ZVAL_UNDEF(&_10$$12); ZVAL_UNDEF(&_11$$17); ZVAL_UNDEF(&_12$$17); ZVAL_UNDEF(&_13$$18); ZVAL_UNDEF(&_14$$18); ZVAL_UNDEF(&_19$$20); ZVAL_UNDEF(&_20$$20); ZVAL_UNDEF(&_21$$22); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &arguments_param); if (!arguments_param) { ZEPHIR_INIT_VAR(&arguments); array_init(&arguments); } else { zephir_get_arrval(&arguments, arguments_param); } ZEPHIR_OBS_VAR(&dependencyInjector); zephir_read_property(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); if (Z_TYPE_P(&dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_console_exception_ce, "A dependency injection object is required to access internal services", "phalcon/cli/console.zep", 42); return; } zephir_read_property(&_0, this_ptr, SL("_eventsManager"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&eventsManager, &_0); if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(&_2$$4); ZVAL_STRING(&_2$$4, "console:boot"); ZEPHIR_CALL_METHOD(&_1$$4, &eventsManager, "fire", NULL, 0, &_2$$4, this_ptr); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&_1$$4)) { RETURN_MM_BOOL(0); } } ZEPHIR_INIT_VAR(&_4); ZVAL_STRING(&_4, "router"); ZEPHIR_CALL_METHOD(&_3, &dependencyInjector, "getshared", NULL, 0, &_4); zephir_check_call_status(); ZEPHIR_CPY_WRT(&router, &_3); _5 = !(zephir_fast_count_int(&arguments TSRMLS_CC)); if (_5) { zephir_read_property(&_0, this_ptr, SL("_arguments"), PH_NOISY_CC | PH_READONLY); _5 = zephir_is_true(&_0); } if (_5) { zephir_read_property(&_6$$6, this_ptr, SL("_arguments"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(NULL, &router, "handle", NULL, 0, &_6$$6); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(NULL, &router, "handle", NULL, 0, &arguments); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&moduleName, &router, "getmodulename", NULL, 0); zephir_check_call_status(); if (!(zephir_is_true(&moduleName))) { ZEPHIR_OBS_NVAR(&moduleName); zephir_read_property(&moduleName, this_ptr, SL("_defaultModule"), PH_NOISY_CC); } if (zephir_is_true(&moduleName)) { if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(&_8$$10); ZVAL_STRING(&_8$$10, "console:beforeStartModule"); ZEPHIR_CALL_METHOD(&_7$$10, &eventsManager, "fire", NULL, 0, &_8$$10, this_ptr, &moduleName); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&_7$$10)) { RETURN_MM_BOOL(0); } } ZEPHIR_OBS_VAR(&modules); zephir_read_property(&modules, this_ptr, SL("_modules"), PH_NOISY_CC); if (!(zephir_array_isset(&modules, &moduleName))) { ZEPHIR_INIT_VAR(&_9$$12); object_init_ex(&_9$$12, phalcon_cli_console_exception_ce); ZEPHIR_INIT_VAR(&_10$$12); ZEPHIR_CONCAT_SVS(&_10$$12, "Module '", &moduleName, "' isn't registered in the console container"); ZEPHIR_CALL_METHOD(NULL, &_9$$12, "__construct", NULL, 4, &_10$$12); zephir_check_call_status(); zephir_throw_exception_debug(&_9$$12, "phalcon/cli/console.zep", 82 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_OBS_VAR(&module); zephir_array_fetch(&module, &modules, &moduleName, PH_NOISY, "phalcon/cli/console.zep", 85 TSRMLS_CC); if (Z_TYPE_P(&module) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_console_exception_ce, "Invalid module definition path", "phalcon/cli/console.zep", 87); return; } ZEPHIR_OBS_VAR(&className); if (!(zephir_array_isset_string_fetch(&className, &module, SL("className"), 0))) { ZEPHIR_INIT_NVAR(&className); ZVAL_STRING(&className, "Module"); } ZEPHIR_OBS_VAR(&path); if (zephir_array_isset_string_fetch(&path, &module, SL("path"), 0)) { if (!(zephir_class_exists(&className, zephir_is_true(&__$false) TSRMLS_CC))) { if (!((zephir_file_exists(&path TSRMLS_CC) == SUCCESS))) { ZEPHIR_INIT_VAR(&_11$$17); object_init_ex(&_11$$17, phalcon_cli_console_exception_ce); ZEPHIR_INIT_VAR(&_12$$17); ZEPHIR_CONCAT_SVS(&_12$$17, "Module definition path '", &path, "' doesn't exist"); ZEPHIR_CALL_METHOD(NULL, &_11$$17, "__construct", NULL, 4, &_12$$17); zephir_check_call_status(); zephir_throw_exception_debug(&_11$$17, "phalcon/cli/console.zep", 97 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (zephir_require_zval(&path TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } } } ZEPHIR_CALL_METHOD(&moduleObject, &dependencyInjector, "get", NULL, 0, &className); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &moduleObject, "registerautoloaders", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &moduleObject, "registerservices", NULL, 0, &dependencyInjector); zephir_check_call_status(); if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(&_14$$18); ZVAL_STRING(&_14$$18, "console:afterStartModule"); ZEPHIR_CALL_METHOD(&_13$$18, &eventsManager, "fire", NULL, 0, &_14$$18, this_ptr, &moduleObject); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&_13$$18)) { RETURN_MM_BOOL(0); } } } ZEPHIR_INIT_NVAR(&_4); ZVAL_STRING(&_4, "dispatcher"); ZEPHIR_CALL_METHOD(&_3, &dependencyInjector, "getshared", NULL, 0, &_4); zephir_check_call_status(); ZEPHIR_CPY_WRT(&dispatcher, &_3); ZEPHIR_CALL_METHOD(&_3, &router, "getmodulename", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setmodulename", NULL, 0, &_3); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_15, &router, "gettaskname", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &dispatcher, "settaskname", NULL, 0, &_15); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_16, &router, "getactionname", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setactionname", NULL, 0, &_16); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_17, &router, "getparams", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setparams", NULL, 0, &_17); zephir_check_call_status(); zephir_read_property(&_18, this_ptr, SL("_options"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setoptions", NULL, 0, &_18); zephir_check_call_status(); if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(&_20$$20); ZVAL_STRING(&_20$$20, "console:beforeHandleTask"); ZEPHIR_CALL_METHOD(&_19$$20, &eventsManager, "fire", NULL, 0, &_20$$20, this_ptr, &dispatcher); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&_19$$20)) { RETURN_MM_BOOL(0); } } ZEPHIR_CALL_METHOD(&task, &dispatcher, "dispatch", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(&_21$$22); ZVAL_STRING(&_21$$22, "console:afterHandleTask"); ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_21$$22, this_ptr, &task); zephir_check_call_status(); } RETURN_CCTOR(&task); }
/** * Appends an IN condition to the current conditions * * <code> * $criteria->inWhere("id", [1, 2, 3]); * </code> */ PHP_METHOD(Phalcon_Mvc_Model_Criteria, inWhere) { HashTable *_3; HashPosition _2; zephir_fcall_cache_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *values = NULL; zval *expr_param = NULL, *values_param = NULL, *hiddenParam = NULL, *bindParams = NULL, *bindKeys = NULL, *value = NULL, *key = NULL, *queryKey = NULL, **_4, *_5, *_6; zval *expr = NULL, *_0$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &expr_param, &values_param); if (unlikely(Z_TYPE_P(expr_param) != IS_STRING && Z_TYPE_P(expr_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'expr' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(expr_param) == IS_STRING)) { zephir_get_strval(expr, expr_param); } else { ZEPHIR_INIT_VAR(expr); ZVAL_EMPTY_STRING(expr); } values = values_param; if (!(zephir_fast_count_int(values TSRMLS_CC))) { ZEPHIR_INIT_VAR(_0$$3); ZEPHIR_CONCAT_VSV(_0$$3, expr, " != ", expr); ZEPHIR_CALL_METHOD(NULL, this_ptr, "andwhere", &_1, 0, _0$$3); zephir_check_call_status(); RETURN_THIS(); } ZEPHIR_OBS_VAR(hiddenParam); zephir_read_property_this(&hiddenParam, this_ptr, SL("_hiddenParamNumber"), PH_NOISY_CC); ZEPHIR_INIT_VAR(bindParams); array_init(bindParams); ZEPHIR_INIT_VAR(bindKeys); array_init(bindKeys); zephir_is_iterable(values, &_3, &_2, 0, 0, "phalcon/mvc/model/criteria.zep", 418); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(value, _4); ZEPHIR_INIT_NVAR(key); ZEPHIR_CONCAT_SV(key, "ACP", hiddenParam); ZEPHIR_INIT_NVAR(queryKey); ZEPHIR_CONCAT_SVS(queryKey, ":", key, ":"); zephir_array_append(&bindKeys, queryKey, PH_SEPARATE, "phalcon/mvc/model/criteria.zep", 409); zephir_array_update_zval(&bindParams, key, &value, PH_COPY | PH_SEPARATE); ZEPHIR_SEPARATE(hiddenParam); zephir_increment(hiddenParam); } ZEPHIR_INIT_VAR(_5); zephir_fast_join_str(_5, SL(", "), bindKeys TSRMLS_CC); ZEPHIR_INIT_VAR(_6); ZEPHIR_CONCAT_VSVS(_6, expr, " IN (", _5, ")"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "andwhere", &_1, 0, _6, bindParams); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_hiddenParamNumber"), hiddenParam TSRMLS_CC); RETURN_THIS(); }
/** * Executes the validation */ PHP_METHOD(Phalcon_Validation_Validator_File, validate) { zend_bool _2, _3, _4, _6, _7, _16, _17, _18, _20, _21, _23, _30, _31, _62, _69$$21, _77$$26; zephir_fcall_cache_entry *_12 = NULL, *_14 = NULL, *_43 = 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, *_0 = NULL, *_1, *_5, *_8, *_15 = NULL, *_19, *_22, *_24, *_25 = NULL, *_36 = NULL, *_53 = NULL, *_61 = NULL, *_63 = NULL, *_9$$4 = NULL, *_11$$4 = NULL, *_13$$4, *_10$$5, *_26$$7 = NULL, *_28$$7 = NULL, *_29$$7, *_27$$8, *_32$$9 = NULL, *_34$$9 = NULL, *_35$$9, *_33$$10, *_37$$11 = NULL, *_38$$11, *_39$$11, *_40$$11, *_41$$11, *_42$$11 = NULL, *_44$$11, *_45$$11, _46$$11, *_47$$11, *_48$$11 = NULL, *_49$$13 = NULL, *_51$$13 = NULL, *_52$$13, *_50$$14, *_54$$15, _55$$17, *_56$$17, *_57$$19 = NULL, *_59$$19 = NULL, *_60$$19, *_58$$20, *_64$$21, *_65$$21 = NULL, *_66$$21 = NULL, *_74$$21 = NULL, *_67$$22 = NULL, *_68$$22, *_70$$24 = NULL, *_71$$24 = NULL, *_73$$24, *_72$$25, *_75$$26 = NULL, *_76$$26, *_78$$27 = NULL, *_79$$27 = NULL, *_81$$27, *_80$$28; 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_VAR(_9$$4); ZVAL_STRING(_9$$4, "messageIniSize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _9$$4); zephir_check_temp_parameter(_9$$4); 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_VAR(_10$$5); ZVAL_STRING(_10$$5, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _10$$5); zephir_check_temp_parameter(_10$$5); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_9$$4); object_init_ex(_9$$4, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_11$$4, "strtr", &_12, 55, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_13$$4); ZVAL_STRING(_13$$4, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _9$$4, "__construct", &_14, 434, _11$$4, field, _13$$4); zephir_check_temp_parameter(_13$$4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _9$$4); zephir_check_call_status(); RETURN_MM_BOOL(0); } ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_15, this_ptr, "issetoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); _16 = zephir_is_true(_15); if (_16) { _17 = ZEPHIR_IS_EMPTY(value); if (!(_17)) { _18 = zephir_array_isset_string(value, SS("error")); if (_18) { zephir_array_fetch_string(&_19, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 75 TSRMLS_CC); _18 = ZEPHIR_IS_LONG_IDENTICAL(_19, 4); } _17 = _18; } _16 = _17; } if (_16) { RETURN_MM_BOOL(1); } _20 = !(zephir_array_isset_string(value, SS("error"))); if (!(_20)) { _20 = !(zephir_array_isset_string(value, SS("tmp_name"))); } _21 = _20; if (!(_21)) { zephir_array_fetch_string(&_22, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 79 TSRMLS_CC); _21 = !ZEPHIR_IS_LONG_IDENTICAL(_22, 0); } _23 = _21; if (!(_23)) { zephir_array_fetch_string(&_24, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 79 TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_25, "is_uploaded_file", NULL, 229, _24); zephir_check_call_status(); _23 = !zephir_is_true(_25); } if (_23) { ZEPHIR_INIT_VAR(_26$$7); ZVAL_STRING(_26$$7, "messageEmpty", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _26$$7); zephir_check_temp_parameter(_26$$7); 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_VAR(_27$$8); ZVAL_STRING(_27$$8, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _27$$8); zephir_check_temp_parameter(_27$$8); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_26$$7); object_init_ex(_26$$7, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_28$$7, "strtr", &_12, 55, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_29$$7); ZVAL_STRING(_29$$7, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _26$$7, "__construct", &_14, 434, _28$$7, field, _29$$7); zephir_check_temp_parameter(_29$$7); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _26$$7); zephir_check_call_status(); RETURN_MM_BOOL(0); } _30 = !(zephir_array_isset_string(value, SS("name"))); if (!(_30)) { _30 = !(zephir_array_isset_string(value, SS("type"))); } _31 = _30; if (!(_31)) { _31 = !(zephir_array_isset_string(value, SS("size"))); } if (_31) { ZEPHIR_INIT_VAR(_32$$9); ZVAL_STRING(_32$$9, "messageValid", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _32$$9); zephir_check_temp_parameter(_32$$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 (ZEPHIR_IS_EMPTY(message)) { ZEPHIR_INIT_VAR(_33$$10); ZVAL_STRING(_33$$10, "FileValid", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _33$$10); zephir_check_temp_parameter(_33$$10); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_32$$9); object_init_ex(_32$$9, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_34$$9, "strtr", &_12, 55, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_35$$9); ZVAL_STRING(_35$$9, "FileValid", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _32$$9, "__construct", &_14, 434, _34$$9, field, _35$$9); zephir_check_temp_parameter(_35$$9); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _32$$9); 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, "issetoption", 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$$11); ZVAL_STRING(_37$$11, "maxSize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&maxSize, this_ptr, "getoption", NULL, 0, _37$$11); zephir_check_temp_parameter(_37$$11); zephir_check_call_status(); ZEPHIR_INIT_VAR(matches); ZVAL_NULL(matches); ZEPHIR_INIT_VAR(unit); ZVAL_STRING(unit, "B", 1); ZEPHIR_INIT_NVAR(_37$$11); ZEPHIR_INIT_VAR(_38$$11); ZEPHIR_INIT_VAR(_39$$11); zephir_array_keys(_39$$11, byteUnits TSRMLS_CC); zephir_fast_join_str(_38$$11, SL("|"), _39$$11 TSRMLS_CC); ZEPHIR_INIT_VAR(_40$$11); ZEPHIR_CONCAT_SVS(_40$$11, "/^([0-9]+(?:\\.[0-9]+)?)(", _38$$11, ")?$/Di"); zephir_preg_match(_37$$11, _40$$11, 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(&_41$$11, matches, 1, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 118 TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_42$$11, "floatval", &_43, 301, _41$$11); zephir_check_call_status(); ZEPHIR_INIT_VAR(_44$$11); zephir_array_fetch(&_45$$11, byteUnits, unit, PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 118 TSRMLS_CC); ZEPHIR_SINIT_VAR(_46$$11); ZVAL_LONG(&_46$$11, 2); zephir_pow_function(_44$$11, &_46$$11, _45$$11); ZEPHIR_INIT_VAR(bytes); mul_function(bytes, _42$$11, _44$$11 TSRMLS_CC); zephir_array_fetch_string(&_47$$11, value, SL("size"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 120 TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_42$$11, "floatval", &_43, 301, _47$$11); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_48$$11, "floatval", &_43, 301, bytes); zephir_check_call_status(); if (ZEPHIR_GT(_42$$11, _48$$11)) { ZEPHIR_INIT_VAR(_49$$13); ZVAL_STRING(_49$$13, "messageSize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _49$$13); zephir_check_temp_parameter(_49$$13); 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_VAR(_50$$14); ZVAL_STRING(_50$$14, "FileSize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _50$$14); zephir_check_temp_parameter(_50$$14); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_49$$13); object_init_ex(_49$$13, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_51$$13, "strtr", &_12, 55, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_52$$13); ZVAL_STRING(_52$$13, "FileSize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _49$$13, "__construct", &_14, 434, _51$$13, field, _52$$13); zephir_check_temp_parameter(_52$$13); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _49$$13); zephir_check_call_status(); RETURN_MM_BOOL(0); } } ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "allowedTypes", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_53, this_ptr, "issetoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); if (zephir_is_true(_53)) { ZEPHIR_INIT_VAR(_54$$15); ZVAL_STRING(_54$$15, "allowedTypes", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&types, this_ptr, "getoption", NULL, 0, _54$$15); zephir_check_temp_parameter(_54$$15); 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_VAR(_55$$17); ZVAL_LONG(&_55$$17, 16); ZEPHIR_CALL_FUNCTION(&tmp, "finfo_open", NULL, 226, &_55$$17); zephir_check_call_status(); zephir_array_fetch_string(&_56$$17, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 143 TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&mime, "finfo_file", NULL, 227, tmp, _56$$17); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(NULL, "finfo_close", NULL, 228, 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_VAR(_57$$19); ZVAL_STRING(_57$$19, "messageType", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _57$$19); zephir_check_temp_parameter(_57$$19); 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(_57$$19); zephir_fast_join_str(_57$$19, SL(", "), types TSRMLS_CC); zephir_array_update_string(&replacePairs, SL(":types"), &_57$$19, PH_COPY | PH_SEPARATE); if (ZEPHIR_IS_EMPTY(message)) { ZEPHIR_INIT_VAR(_58$$20); ZVAL_STRING(_58$$20, "FileType", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _58$$20); zephir_check_temp_parameter(_58$$20); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_57$$19); object_init_ex(_57$$19, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_59$$19, "strtr", &_12, 55, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_60$$19); ZVAL_STRING(_60$$19, "FileType", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _57$$19, "__construct", &_14, 434, _59$$19, field, _60$$19); zephir_check_temp_parameter(_60$$19); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _57$$19); zephir_check_call_status(); RETURN_MM_BOOL(0); } } ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "minResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_61, this_ptr, "issetoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); _62 = zephir_is_true(_61); if (!(_62)) { ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "maxResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_63, this_ptr, "issetoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); _62 = zephir_is_true(_63); } if (_62) { zephir_array_fetch_string(&_64$$21, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 164 TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 237, _64$$21); 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_VAR(_66$$21); ZVAL_STRING(_66$$21, "minResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_65$$21, this_ptr, "issetoption", NULL, 0, _66$$21); zephir_check_temp_parameter(_66$$21); zephir_check_call_status(); if (zephir_is_true(_65$$21)) { ZEPHIR_INIT_VAR(_68$$22); ZVAL_STRING(_68$$22, "minResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_67$$22, this_ptr, "getoption", NULL, 0, _68$$22); zephir_check_temp_parameter(_68$$22); zephir_check_call_status(); ZEPHIR_INIT_VAR(minResolution); zephir_fast_explode_str(minResolution, SL("x"), _67$$22, 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); } _69$$21 = ZEPHIR_LT(width, minWidth); if (!(_69$$21)) { _69$$21 = ZEPHIR_LT(height, minHeight); } if (_69$$21) { ZEPHIR_INIT_VAR(_70$$24); ZVAL_STRING(_70$$24, "messageMinResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _70$$24); zephir_check_temp_parameter(_70$$24); 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(_70$$24); ZVAL_STRING(_70$$24, "minResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_71$$24, this_ptr, "getoption", NULL, 0, _70$$24); zephir_check_temp_parameter(_70$$24); zephir_check_call_status(); zephir_array_update_string(&replacePairs, SL(":min"), &_71$$24, PH_COPY | PH_SEPARATE); if (ZEPHIR_IS_EMPTY(message)) { ZEPHIR_INIT_VAR(_72$$25); ZVAL_STRING(_72$$25, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _72$$25); zephir_check_temp_parameter(_72$$25); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_70$$24); object_init_ex(_70$$24, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_71$$24, "strtr", &_12, 55, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_73$$24); ZVAL_STRING(_73$$24, "FileMinResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _70$$24, "__construct", &_14, 434, _71$$24, field, _73$$24); zephir_check_temp_parameter(_73$$24); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _70$$24); zephir_check_call_status(); RETURN_MM_BOOL(0); } ZEPHIR_INIT_NVAR(_66$$21); ZVAL_STRING(_66$$21, "maxResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_74$$21, this_ptr, "issetoption", NULL, 0, _66$$21); zephir_check_temp_parameter(_66$$21); zephir_check_call_status(); if (zephir_is_true(_74$$21)) { ZEPHIR_INIT_VAR(_76$$26); ZVAL_STRING(_76$$26, "maxResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_75$$26, this_ptr, "getoption", NULL, 0, _76$$26); zephir_check_temp_parameter(_76$$26); zephir_check_call_status(); ZEPHIR_INIT_VAR(maxResolution); zephir_fast_explode_str(maxResolution, SL("x"), _75$$26, 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); _77$$26 = ZEPHIR_GT(width, maxWidth); if (!(_77$$26)) { _77$$26 = ZEPHIR_GT(height, maxHeight); } if (_77$$26) { ZEPHIR_INIT_VAR(_78$$27); ZVAL_STRING(_78$$27, "messageMaxResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _78$$27); zephir_check_temp_parameter(_78$$27); 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(_78$$27); ZVAL_STRING(_78$$27, "maxResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_79$$27, this_ptr, "getoption", NULL, 0, _78$$27); zephir_check_temp_parameter(_78$$27); zephir_check_call_status(); zephir_array_update_string(&replacePairs, SL(":max"), &_79$$27, PH_COPY | PH_SEPARATE); if (ZEPHIR_IS_EMPTY(message)) { ZEPHIR_INIT_VAR(_80$$28); ZVAL_STRING(_80$$28, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _80$$28); zephir_check_temp_parameter(_80$$28); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_78$$27); object_init_ex(_78$$27, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_79$$27, "strtr", &_12, 55, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_81$$27); ZVAL_STRING(_81$$27, "FileMaxResolution", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _78$$27, "__construct", &_14, 434, _79$$27, field, _81$$27); zephir_check_temp_parameter(_81$$27); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _78$$27); zephir_check_call_status(); RETURN_MM_BOOL(0); } } } RETURN_MM_BOOL(1); }
/** * Lists table indexes * * <code> * print_r($connection->describeIndexes('robots_parts')); * </code> * * @param string table * @param string schema * @return \Phalcon\Db\IndexInterface[] */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeIndexes) { HashTable *_5, *_28, *_15$$3; HashPosition _4, _27, _14$$3; zephir_fcall_cache_entry *_20 = NULL, *_33 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *table, *schema = NULL, *indexes = NULL, *index = NULL, *keyName = NULL, *indexObjects = NULL, *name = NULL, *columns = NULL, *describeIndex = NULL, *indexSql = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3, **_6, **_29, *_7$$4 = NULL, *_8$$3, *_10$$3 = NULL, *_11$$3, *_12$$3 = NULL, *_13$$3 = NULL, **_16$$3, *_18$$3, *_19$$3 = NULL, *_21$$3, *_9$$6, *_17$$7, *_22$$8 = NULL, *_23$$8 = NULL, _24$$8 = zval_used_for_init, *_25$$9 = NULL, *_26$$10 = NULL, *_30$$12 = NULL, *_31$$12, *_32$$12; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table, &schema); if (!schema) { schema = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(indexes); array_init(indexes); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describeindexes", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 2); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 341); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(index, _6); ZEPHIR_OBS_NVAR(keyName); zephir_array_fetch_string(&keyName, index, SL("name"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 311 TSRMLS_CC); if (!(zephir_array_isset(indexes, keyName))) { ZEPHIR_INIT_NVAR(_7$$4); array_init(_7$$4); zephir_array_update_zval(&indexes, keyName, &_7$$4, PH_COPY | PH_SEPARATE); } zephir_array_fetch(&_8$$3, indexes, keyName, PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 317 TSRMLS_CC); if (!(zephir_array_isset_string(_8$$3, SS("columns")))) { ZEPHIR_INIT_NVAR(columns); array_init(columns); } else { zephir_array_fetch(&_9$$6, indexes, keyName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 320 TSRMLS_CC); ZEPHIR_OBS_NVAR(columns); zephir_array_fetch_string(&columns, _9$$6, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 320 TSRMLS_CC); } _11$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_12$$3, _11$$3, "describeindex", NULL, 0, keyName); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_13$$3); ZVAL_LONG(_13$$3, 2); ZEPHIR_CALL_METHOD(&_10$$3, this_ptr, "fetchall", NULL, 0, _12$$3, _13$$3); zephir_check_call_status(); zephir_is_iterable(_10$$3, &_15$$3, &_14$$3, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 327); for ( ; zephir_hash_get_current_data_ex(_15$$3, (void**) &_16$$3, &_14$$3) == SUCCESS ; zephir_hash_move_forward_ex(_15$$3, &_14$$3) ) { ZEPHIR_GET_HVALUE(describeIndex, _16$$3); zephir_array_fetch_string(&_17$$7, describeIndex, SL("name"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 324 TSRMLS_CC); zephir_array_append(&columns, _17$$7, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 324); } zephir_array_update_multi(&indexes, &columns TSRMLS_CC, SL("zs"), 3, keyName, SL("columns")); _18$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_19$$3, _18$$3, "listindexessql", NULL, 0, table, schema, keyName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&indexSql, this_ptr, "fetchcolumn", &_20, 0, _19$$3); zephir_check_call_status(); zephir_array_fetch_string(&_21$$3, index, SL("unique"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 330 TSRMLS_CC); if (zephir_is_true(_21$$3)) { ZEPHIR_INIT_NVAR(_22$$8); ZEPHIR_INIT_NVAR(_23$$8); ZEPHIR_SINIT_NVAR(_24$$8); ZVAL_STRING(&_24$$8, "# UNIQUE #i", 0); zephir_preg_match(_23$$8, &_24$$8, indexSql, _22$$8, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_23$$8)) { ZEPHIR_INIT_NVAR(_25$$9); ZVAL_STRING(_25$$9, "UNIQUE", 1); zephir_array_update_multi(&indexes, &_25$$9 TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } else { ZEPHIR_INIT_NVAR(_26$$10); ZVAL_STRING(_26$$10, "PRIMARY", 1); zephir_array_update_multi(&indexes, &_26$$10 TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } } else { zephir_array_update_multi(&indexes, &ZEPHIR_GLOBAL(global_null) TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } } ZEPHIR_INIT_VAR(indexObjects); array_init(indexObjects); zephir_is_iterable(indexes, &_28, &_27, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 346); for ( ; zephir_hash_get_current_data_ex(_28, (void**) &_29, &_27) == SUCCESS ; zephir_hash_move_forward_ex(_28, &_27) ) { ZEPHIR_GET_HMKEY(name, _28, _27); ZEPHIR_GET_HVALUE(index, _29); ZEPHIR_INIT_NVAR(_30$$12); object_init_ex(_30$$12, phalcon_db_index_ce); zephir_array_fetch_string(&_31$$12, index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 343 TSRMLS_CC); zephir_array_fetch_string(&_32$$12, index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 343 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, _30$$12, "__construct", &_33, 15, name, _31$$12, _32$$12); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, name, &_30$$12, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(indexObjects); }
/** * Executes the validation */ PHP_METHOD(Phalcon_Validation_Validator_Regex, validate) { int ZEPHIR_LAST_CALL_STATUS; zend_bool failed, _2; zval *field = NULL; zval *validation, *field_param = NULL, *matches, *message = NULL, *value = NULL, *label = NULL, *replacePairs, *_0 = NULL, *_1 = NULL, *_3 = NULL, *_4 = NULL, *_5, *_6 = NULL, *_7; 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_INIT_VAR(matches); ZVAL_NULL(matches); ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_0, this_ptr, "issetoption", NULL, 0, _1); zephir_check_temp_parameter(_1); zephir_check_call_status(); _2 = zephir_is_true(_0); if (_2) { _2 = ZEPHIR_IS_EMPTY(value); } if (_2) { RETURN_MM_BOOL(1); } ZEPHIR_INIT_NVAR(_1); ZEPHIR_INIT_VAR(_4); ZVAL_STRING(_4, "pattern", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_3, this_ptr, "getoption", NULL, 0, _4); zephir_check_temp_parameter(_4); zephir_check_call_status(); zephir_preg_match(_1, _3, value, matches, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_1)) { zephir_array_fetch_long(&_5, matches, 0, PH_NOISY | PH_READONLY, "phalcon/validation/validator/regex.zep", 62 TSRMLS_CC); failed = !ZEPHIR_IS_EQUAL(_5, value); } else { failed = 1; } if (failed == 1) { ZEPHIR_INIT_NVAR(_4); ZVAL_STRING(_4, "label", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _4); zephir_check_temp_parameter(_4); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(label)) { ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_4); ZVAL_STRING(_4, "message", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _4); zephir_check_temp_parameter(_4); 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(_4); ZVAL_STRING(_4, "Regex", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _4); zephir_check_temp_parameter(_4); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_4); object_init_ex(_4, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_6, "strtr", NULL, 54, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_7); ZVAL_STRING(_7, "Regex", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL, 436, _6, field, _7); zephir_check_temp_parameter(_7); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _4); zephir_check_call_status(); RETURN_MM_BOOL(0); } RETURN_MM_BOOL(1); }
/** * Lists table references * * @param string table * @param string schema * @return Phalcon\Db\ReferenceInterface[] */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeReferences) { zval *_13$$3 = NULL, *_18$$6 = NULL; HashTable *_5, *_15; HashPosition _4, _14; zephir_fcall_cache_entry *_20 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *table, *schema = NULL, *references = NULL, *reference = NULL, *arrayReference = NULL, *constraintName = NULL, *referenceObjects = NULL, *name = NULL, *referencedSchema = NULL, *referencedTable = NULL, *columns = NULL, *referencedColumns = NULL, *number = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3, **_6, **_16, *_7$$5, *_8$$5, *_9$$5, *_10$$5, *_11$$3, *_12$$3, *_17$$6 = NULL, *_19$$6 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table, &schema); if (!schema) { schema = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(references); array_init(references); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describereferences", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 391); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HMKEY(number, _5, _4); ZEPHIR_GET_HVALUE(reference, _6); ZEPHIR_INIT_NVAR(constraintName); ZEPHIR_CONCAT_SV(constraintName, "foreign_key_", number); if (!(zephir_array_isset(references, constraintName))) { ZEPHIR_INIT_NVAR(referencedSchema); ZVAL_NULL(referencedSchema); ZEPHIR_OBS_NVAR(referencedTable); zephir_array_fetch_long(&referencedTable, reference, 2, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 370 TSRMLS_CC); ZEPHIR_INIT_NVAR(columns); array_init(columns); ZEPHIR_INIT_NVAR(referencedColumns); array_init(referencedColumns); } else { zephir_array_fetch(&_7$$5, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 374 TSRMLS_CC); ZEPHIR_OBS_NVAR(referencedSchema); zephir_array_fetch_string(&referencedSchema, _7$$5, SL("referencedSchema"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 374 TSRMLS_CC); zephir_array_fetch(&_8$$5, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 375 TSRMLS_CC); ZEPHIR_OBS_NVAR(referencedTable); zephir_array_fetch_string(&referencedTable, _8$$5, SL("referencedTable"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 375 TSRMLS_CC); zephir_array_fetch(&_9$$5, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 376 TSRMLS_CC); ZEPHIR_OBS_NVAR(columns); zephir_array_fetch_string(&columns, _9$$5, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 376 TSRMLS_CC); zephir_array_fetch(&_10$$5, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 377 TSRMLS_CC); ZEPHIR_OBS_NVAR(referencedColumns); zephir_array_fetch_string(&referencedColumns, _10$$5, SL("referencedColumns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 377 TSRMLS_CC); } zephir_array_fetch_long(&_11$$3, reference, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 380 TSRMLS_CC); zephir_array_append(&columns, _11$$3, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 380); zephir_array_fetch_long(&_12$$3, reference, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 381 TSRMLS_CC); zephir_array_append(&referencedColumns, _12$$3, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 381); ZEPHIR_INIT_NVAR(_13$$3); zephir_create_array(_13$$3, 4, 0 TSRMLS_CC); zephir_array_update_string(&_13$$3, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_13$$3, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_13$$3, SL("columns"), &columns, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_13$$3, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); zephir_array_update_zval(&references, constraintName, &_13$$3, PH_COPY | PH_SEPARATE); } ZEPHIR_INIT_VAR(referenceObjects); array_init(referenceObjects); zephir_is_iterable(references, &_15, &_14, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 401); for ( ; zephir_hash_get_current_data_ex(_15, (void**) &_16, &_14) == SUCCESS ; zephir_hash_move_forward_ex(_15, &_14) ) { ZEPHIR_GET_HMKEY(name, _15, _14); ZEPHIR_GET_HVALUE(arrayReference, _16); ZEPHIR_INIT_NVAR(_17$$6); object_init_ex(_17$$6, phalcon_db_reference_ce); ZEPHIR_INIT_NVAR(_18$$6); zephir_create_array(_18$$6, 4, 0 TSRMLS_CC); ZEPHIR_OBS_NVAR(_19$$6); zephir_array_fetch_string(&_19$$6, arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 394 TSRMLS_CC); zephir_array_update_string(&_18$$6, SL("referencedSchema"), &_19$$6, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_19$$6); zephir_array_fetch_string(&_19$$6, arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 395 TSRMLS_CC); zephir_array_update_string(&_18$$6, SL("referencedTable"), &_19$$6, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_19$$6); zephir_array_fetch_string(&_19$$6, arrayReference, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 396 TSRMLS_CC); zephir_array_update_string(&_18$$6, SL("columns"), &_19$$6, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_19$$6); zephir_array_fetch_string(&_19$$6, arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 398 TSRMLS_CC); zephir_array_update_string(&_18$$6, SL("referencedColumns"), &_19$$6, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, _17$$6, "__construct", &_20, 16, name, _18$$6); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, name, &_17$$6, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(referenceObjects); }
/** * Handle the creation of the authorization code. * * @param string client_id Client identifier related to the authorization code * @param string user_id User ID associated with the authorization code * @param string redirect_uri An absolute URI to which the authorization server will redirect the * user-agent to when the end-user authorization step is completed. * @param string scope (optional) Scopes to be stored in space-separated string. * @return strin * * @see http://tools.ietf.org/html/rfc6749#section-4 * @ingroup oauth2_section_4 */ PHP_METHOD(OAuth2_ResponseType_AuthorizationCode, createAuthorizationCode) { int ZEPHIR_LAST_CALL_STATUS; zval *client_id_param = NULL, *user_id_param = NULL, *redirect_uri_param = NULL, *scope_param = NULL, *code = NULL, *_0, *_1 = NULL, *_2, *_3, *_4; zval *client_id = NULL, *user_id = NULL, *redirect_uri = NULL, *scope = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &client_id_param, &user_id_param, &redirect_uri_param, &scope_param); if (unlikely(Z_TYPE_P(client_id_param) != IS_STRING && Z_TYPE_P(client_id_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'client_id' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(client_id_param) == IS_STRING)) { zephir_get_strval(client_id, client_id_param); } else { ZEPHIR_INIT_VAR(client_id); ZVAL_EMPTY_STRING(client_id); } if (unlikely(Z_TYPE_P(user_id_param) != IS_STRING && Z_TYPE_P(user_id_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'user_id' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(user_id_param) == IS_STRING)) { zephir_get_strval(user_id, user_id_param); } else { ZEPHIR_INIT_VAR(user_id); ZVAL_EMPTY_STRING(user_id); } if (unlikely(Z_TYPE_P(redirect_uri_param) != IS_STRING && Z_TYPE_P(redirect_uri_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'redirect_uri' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(redirect_uri_param) == IS_STRING)) { zephir_get_strval(redirect_uri, redirect_uri_param); } else { ZEPHIR_INIT_VAR(redirect_uri); ZVAL_EMPTY_STRING(redirect_uri); } if (!scope_param) { ZEPHIR_INIT_VAR(scope); ZVAL_EMPTY_STRING(scope); } else { if (unlikely(Z_TYPE_P(scope_param) != IS_STRING && Z_TYPE_P(scope_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'scope' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(scope_param) == IS_STRING)) { zephir_get_strval(scope, scope_param); } else { ZEPHIR_INIT_VAR(scope); ZVAL_EMPTY_STRING(scope); } } ZEPHIR_CALL_METHOD(&code, this_ptr, "generateauthorizationcode", NULL); zephir_check_call_status(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("storage"), PH_NOISY_CC); ZEPHIR_CALL_FUNCTION(&_1, "time", NULL); zephir_check_call_status(); _2 = zephir_fetch_nproperty_this(this_ptr, SL("config"), PH_NOISY_CC); zephir_array_fetch_string(&_3, _2, SL("auth_code_lifetime"), PH_NOISY | PH_READONLY, "oauth2/responsetype/authorizationcode.zep", 64 TSRMLS_CC); ZEPHIR_INIT_VAR(_4); zephir_add_function(_4, _1, _3 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, _0, "setauthorizationcode", NULL, code, client_id, user_id, redirect_uri, _4, scope); zephir_check_call_status(); RETURN_CCTOR(code); }
/** * Returns an array of Phalcon\Db\Column objects describing a table * * <code> * print_r($connection->describeColumns("posts")); * </code> */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) { zend_bool _11$$4, _36$$3; HashTable *_5; HashPosition _4; zephir_fcall_cache_entry *_35 = NULL, *_42 = NULL, *_44 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema_param = NULL, *columns = NULL, *columnType = NULL, *field = NULL, *definition = NULL, *oldColumn = NULL, *sizePattern = NULL, *matches = NULL, *matchOne = NULL, *matchTwo = NULL, *columnName = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3, **_6, *_7$$5 = NULL, *_8$$5 = NULL, *_9$$6 = NULL, *_10$$6 = NULL, *_26$$4 = NULL, *_12$$7 = NULL, *_13$$7 = NULL, *_14$$7, *_15$$9 = NULL, *_16$$10 = NULL, *_17$$11 = NULL, *_18$$12 = NULL, *_19$$12 = NULL, *_20$$13 = NULL, *_21$$14 = NULL, *_22$$15 = NULL, *_23$$16 = NULL, *_24$$16 = NULL, *_25$$17 = NULL, *_27$$18 = NULL, *_28$$20 = NULL, *_29$$21 = NULL, *_30$$3, *_31$$3, *_32$$3, _33$$3 = zval_used_for_init, *_34$$3 = NULL, *_37$$3, *_43$$3 = NULL, *_38$$27, *_39$$27 = NULL, *_40$$27 = NULL, *_41$$27 = NULL; zval *table = NULL, *schema = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema_param); zephir_get_strval(table, table_param); if (!schema_param) { ZEPHIR_INIT_VAR(schema); ZVAL_EMPTY_STRING(schema); } else { zephir_get_strval(schema, schema_param); } ZEPHIR_INIT_VAR(oldColumn); ZVAL_NULL(oldColumn); ZEPHIR_INIT_VAR(sizePattern); ZVAL_STRING(sizePattern, "#\\(([0-9]+)(?:,\\s*([0-9]+))*\\)#", 1); ZEPHIR_INIT_VAR(columns); array_init(columns); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describecolumns", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 291); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(field, _6); ZEPHIR_INIT_NVAR(definition); zephir_create_array(definition, 1, 0 TSRMLS_CC); add_assoc_long_ex(definition, SS("bindType"), 2); ZEPHIR_OBS_NVAR(columnType); zephir_array_fetch_long(&columnType, field, 2, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 108 TSRMLS_CC); while (1) { if (zephir_memnstr_str(columnType, SL("tinyint(1)"), "phalcon/db/adapter/pdo/sqlite.zep", 115)) { ZEPHIR_INIT_NVAR(_7$$5); ZVAL_LONG(_7$$5, 8); zephir_array_update_string(&definition, SL("type"), &_7$$5, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8$$5); ZVAL_LONG(_8$$5, 5); zephir_array_update_string(&definition, SL("bindType"), &_8$$5, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(columnType); ZVAL_STRING(columnType, "boolean", 1); break; } if (zephir_memnstr_str(columnType, SL("bigint"), "phalcon/db/adapter/pdo/sqlite.zep", 125)) { ZEPHIR_INIT_NVAR(_9$$6); ZVAL_LONG(_9$$6, 14); zephir_array_update_string(&definition, SL("type"), &_9$$6, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_10$$6); ZVAL_LONG(_10$$6, 1); zephir_array_update_string(&definition, SL("bindType"), &_10$$6, PH_COPY | PH_SEPARATE); break; } _11$$4 = zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/sqlite.zep", 135); if (!(_11$$4)) { _11$$4 = zephir_memnstr_str(columnType, SL("INT"), "phalcon/db/adapter/pdo/sqlite.zep", 135); } if (_11$$4) { ZEPHIR_INIT_NVAR(_12$$7); ZVAL_LONG(_12$$7, 0); zephir_array_update_string(&definition, SL("type"), &_12$$7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_13$$7); ZVAL_LONG(_13$$7, 1); zephir_array_update_string(&definition, SL("bindType"), &_13$$7, PH_COPY | PH_SEPARATE); zephir_array_fetch_long(&_14$$7, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 141 TSRMLS_CC); if (zephir_is_true(_14$$7)) { zephir_array_update_string(&definition, SL("autoIncrement"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } break; } if (zephir_memnstr_str(columnType, SL("varchar"), "phalcon/db/adapter/pdo/sqlite.zep", 150)) { ZEPHIR_INIT_NVAR(_15$$9); ZVAL_LONG(_15$$9, 2); zephir_array_update_string(&definition, SL("type"), &_15$$9, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/sqlite.zep", 158)) { ZEPHIR_INIT_NVAR(_16$$10); ZVAL_LONG(_16$$10, 1); zephir_array_update_string(&definition, SL("type"), &_16$$10, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("timestamp"), "phalcon/db/adapter/pdo/sqlite.zep", 166)) { ZEPHIR_INIT_NVAR(_17$$11); ZVAL_LONG(_17$$11, 17); zephir_array_update_string(&definition, SL("type"), &_17$$11, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("decimal"), "phalcon/db/adapter/pdo/sqlite.zep", 174)) { ZEPHIR_INIT_NVAR(_18$$12); ZVAL_LONG(_18$$12, 3); zephir_array_update_string(&definition, SL("type"), &_18$$12, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_19$$12); ZVAL_LONG(_19$$12, 32); zephir_array_update_string(&definition, SL("bindType"), &_19$$12, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/sqlite.zep", 184)) { ZEPHIR_INIT_NVAR(_20$$13); ZVAL_LONG(_20$$13, 5); zephir_array_update_string(&definition, SL("type"), &_20$$13, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("datetime"), "phalcon/db/adapter/pdo/sqlite.zep", 192)) { ZEPHIR_INIT_NVAR(_21$$14); ZVAL_LONG(_21$$14, 4); zephir_array_update_string(&definition, SL("type"), &_21$$14, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("text"), "phalcon/db/adapter/pdo/sqlite.zep", 200)) { ZEPHIR_INIT_NVAR(_22$$15); ZVAL_LONG(_22$$15, 6); zephir_array_update_string(&definition, SL("type"), &_22$$15, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("float"), "phalcon/db/adapter/pdo/sqlite.zep", 208)) { ZEPHIR_INIT_NVAR(_23$$16); ZVAL_LONG(_23$$16, 7); zephir_array_update_string(&definition, SL("type"), &_23$$16, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_24$$16); ZVAL_LONG(_24$$16, 3); zephir_array_update_string(&definition, SL("bindType"), &_24$$16, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("enum"), "phalcon/db/adapter/pdo/sqlite.zep", 218)) { ZEPHIR_INIT_NVAR(_25$$17); ZVAL_LONG(_25$$17, 5); zephir_array_update_string(&definition, SL("type"), &_25$$17, PH_COPY | PH_SEPARATE); break; } ZEPHIR_INIT_NVAR(_26$$4); ZVAL_LONG(_26$$4, 2); zephir_array_update_string(&definition, SL("type"), &_26$$4, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("("), "phalcon/db/adapter/pdo/sqlite.zep", 233)) { ZEPHIR_INIT_NVAR(matches); ZVAL_NULL(matches); ZEPHIR_INIT_NVAR(_27$$18); zephir_preg_match(_27$$18, sizePattern, columnType, matches, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_27$$18)) { ZEPHIR_OBS_NVAR(matchOne); if (zephir_array_isset_long_fetch(&matchOne, matches, 1, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_28$$20); ZVAL_LONG(_28$$20, zephir_get_intval(matchOne)); zephir_array_update_string(&definition, SL("size"), &_28$$20, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(matchTwo); if (zephir_array_isset_long_fetch(&matchTwo, matches, 2, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_29$$21); ZVAL_LONG(_29$$21, zephir_get_intval(matchTwo)); zephir_array_update_string(&definition, SL("scale"), &_29$$21, PH_COPY | PH_SEPARATE); } } } if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/sqlite.zep", 248)) { zephir_array_update_string(&definition, SL("unsigned"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(oldColumn) == IS_NULL) { zephir_array_update_string(&definition, SL("first"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } else { zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_30$$3, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 264 TSRMLS_CC); if (zephir_is_true(_30$$3)) { zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_31$$3, field, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 271 TSRMLS_CC); if (zephir_is_true(_31$$3)) { zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_32$$3, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 279 TSRMLS_CC); ZEPHIR_SINIT_NVAR(_33$$3); ZVAL_STRING(&_33$$3, "null", 0); ZEPHIR_CALL_FUNCTION(&_34$$3, "strcasecmp", &_35, 19, _32$$3, &_33$$3); zephir_check_call_status(); _36$$3 = !ZEPHIR_IS_LONG(_34$$3, 0); if (_36$$3) { zephir_array_fetch_long(&_37$$3, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 279 TSRMLS_CC); _36$$3 = !ZEPHIR_IS_STRING(_37$$3, ""); } if (_36$$3) { zephir_array_fetch_long(&_38$$27, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 280 TSRMLS_CC); ZEPHIR_INIT_NVAR(_39$$27); ZVAL_STRING(_39$$27, "/^'|'$/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_40$$27); ZVAL_STRING(_40$$27, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_41$$27, "preg_replace", &_42, 29, _39$$27, _40$$27, _38$$27); zephir_check_temp_parameter(_39$$27); zephir_check_temp_parameter(_40$$27); zephir_check_call_status(); zephir_array_update_string(&definition, SL("default"), &_41$$27, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&columnName, field, 1, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 286 TSRMLS_CC); ZEPHIR_INIT_NVAR(_43$$3); object_init_ex(_43$$3, phalcon_db_column_ce); ZEPHIR_CALL_METHOD(NULL, _43$$3, "__construct", &_44, 137, columnName, definition); zephir_check_call_status(); zephir_array_append(&columns, _43$$3, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 287); ZEPHIR_CPY_WRT(oldColumn, columnName); } RETURN_CCTOR(columns); }
/** * Executes the validator */ PHP_METHOD(Phalcon_Mvc_Model_Validator_StringLength, validate) { zval *_6$$9, *_10$$12; zend_bool _1, _3; zend_long ZEPHIR_LAST_CALL_STATUS; zval *record, *field = NULL, *isSetMin = NULL, *isSetMax = NULL, *value = NULL, *length = NULL, *maximum = NULL, *minimum = NULL, *message = NULL, *_0 = NULL, *_2 = NULL, *_4$$8, *_5$$9 = NULL, *_7$$9 = NULL, *_8$$11, *_9$$12 = NULL, *_11$$12 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &record); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); if (Z_TYPE_P(field) != IS_STRING) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/stringlength.zep", 75); return; } ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "min", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&isSetMin, this_ptr, "issetoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "max", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&isSetMax, this_ptr, "issetoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); _1 = !zephir_is_true(isSetMin); if (_1) { _1 = !zephir_is_true(isSetMax); } if (_1) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A minimum or maximum must be set", "phalcon/mvc/model/validator/stringlength.zep", 85); return; } ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, 0, field); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); _3 = zephir_is_true(_2); if (_3) { _3 = ZEPHIR_IS_EMPTY(value); } if (_3) { RETURN_MM_BOOL(1); } if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 391, value); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(length); ZVAL_LONG(length, zephir_fast_strlen_ev(value)); } if (zephir_is_true(isSetMax)) { ZEPHIR_INIT_VAR(_4$$8); ZVAL_STRING(_4$$8, "max", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&maximum, this_ptr, "getoption", NULL, 0, _4$$8); zephir_check_temp_parameter(_4$$8); zephir_check_call_status(); if (ZEPHIR_GT(length, maximum)) { ZEPHIR_INIT_VAR(_5$$9); ZVAL_STRING(_5$$9, "messageMaximum", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$9); zephir_check_temp_parameter(_5$$9); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(message)) { ZEPHIR_INIT_NVAR(message); ZVAL_STRING(message, "Value of field ':field' exceeds the maximum :max characters", 1); } ZEPHIR_INIT_VAR(_6$$9); zephir_create_array(_6$$9, 2, 0 TSRMLS_CC); zephir_array_update_string(&_6$$9, SL(":field"), &field, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_6$$9, SL(":max"), &maximum, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_FUNCTION(&_7$$9, "strtr", NULL, 27, message, _6$$9); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_5$$9); ZVAL_STRING(_5$$9, "TooLong", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _7$$9, field, _5$$9); zephir_check_temp_parameter(_5$$9); zephir_check_call_status(); RETURN_MM_BOOL(0); } } if (zephir_is_true(isSetMin)) { ZEPHIR_INIT_VAR(_8$$11); ZVAL_STRING(_8$$11, "min", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&minimum, this_ptr, "getoption", NULL, 0, _8$$11); zephir_check_temp_parameter(_8$$11); zephir_check_call_status(); if (ZEPHIR_LT(length, minimum)) { ZEPHIR_INIT_VAR(_9$$12); ZVAL_STRING(_9$$12, "messageMinimum", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _9$$12); zephir_check_temp_parameter(_9$$12); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(message)) { ZEPHIR_INIT_NVAR(message); ZVAL_STRING(message, "Value of field ':field' is less than the minimum :min characters", 1); } ZEPHIR_INIT_VAR(_10$$12); zephir_create_array(_10$$12, 2, 0 TSRMLS_CC); zephir_array_update_string(&_10$$12, SL(":field"), &field, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_10$$12, SL(":min"), &minimum, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_FUNCTION(&_11$$12, "strtr", NULL, 27, message, _10$$12); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_9$$12); ZVAL_STRING(_9$$12, "TooShort", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _11$$12, field, _9$$12); zephir_check_temp_parameter(_9$$12); zephir_check_call_status(); RETURN_MM_BOOL(0); } } RETURN_MM_BOOL(1); }
/** * Checks for annotations in the public methods of the controller * * @param string module * @param string namespaceName * @param string controller * @param string action * @param Phalcon\Annotations\Annotation annotation */ PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation) { zephir_fcall_cache_entry *_7 = NULL, *_11 = NULL; HashTable *_5, *_9; HashPosition _4, _8; int ZEPHIR_LAST_CALL_STATUS; zend_bool isRoute; zval *module_param = NULL, *namespaceName_param = NULL, *controller_param = NULL, *action_param = NULL, *annotation, *name = NULL, *actionName, *routePrefix, *paths = NULL, *value = NULL, *uri = NULL, *route = NULL, *methods = NULL, *converts = NULL, *param = NULL, *convert = NULL, *conversorParam = NULL, *routeName = NULL, *_0, *_1, _2, *_3 = NULL, **_6, **_10; zval *module = NULL, *namespaceName = NULL, *controller = NULL, *action = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 5, 0, &module_param, &namespaceName_param, &controller_param, &action_param, &annotation); if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(module_param) == IS_STRING)) { zephir_get_strval(module, module_param); } else { ZEPHIR_INIT_VAR(module); ZVAL_EMPTY_STRING(module); } if (unlikely(Z_TYPE_P(namespaceName_param) != IS_STRING && Z_TYPE_P(namespaceName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'namespaceName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(namespaceName_param) == IS_STRING)) { zephir_get_strval(namespaceName, namespaceName_param); } else { ZEPHIR_INIT_VAR(namespaceName); ZVAL_EMPTY_STRING(namespaceName); } if (unlikely(Z_TYPE_P(controller_param) != IS_STRING && Z_TYPE_P(controller_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controller' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(controller_param) == IS_STRING)) { zephir_get_strval(controller, controller_param); } else { ZEPHIR_INIT_VAR(controller); ZVAL_EMPTY_STRING(controller); } if (unlikely(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(action_param) == IS_STRING)) { zephir_get_strval(action, action_param); } else { ZEPHIR_INIT_VAR(action); ZVAL_EMPTY_STRING(action); } isRoute = 0; ZEPHIR_INIT_VAR(methods); ZVAL_NULL(methods); ZEPHIR_CALL_METHOD(&name, annotation, "getname", NULL); zephir_check_call_status(); if (ZEPHIR_IS_STRING(name, "Route")) { isRoute = 1; } else { if (ZEPHIR_IS_STRING(name, "Get")) { isRoute = 1; ZEPHIR_INIT_NVAR(methods); ZVAL_STRING(methods, "GET", 1); } else { if (ZEPHIR_IS_STRING(name, "Post")) { isRoute = 1; ZEPHIR_INIT_NVAR(methods); ZVAL_STRING(methods, "POST", 1); } else { if (ZEPHIR_IS_STRING(name, "Put")) { isRoute = 1; ZEPHIR_INIT_NVAR(methods); ZVAL_STRING(methods, "PUT", 1); } else { if (ZEPHIR_IS_STRING(name, "Options")) { isRoute = 1; ZEPHIR_INIT_NVAR(methods); ZVAL_STRING(methods, "OPTIONS", 1); } } } } } if (isRoute == 1) { ZEPHIR_INIT_VAR(actionName); ZEPHIR_INIT_VAR(_0); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_actionSuffix"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "", 0); zephir_fast_str_replace(&_0, _1, &_2, action TSRMLS_CC); zephir_fast_strtolower(actionName, _0); ZEPHIR_OBS_VAR(routePrefix); zephir_read_property_this(&routePrefix, this_ptr, SL("_routePrefix"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3); ZVAL_STRING(_3, "paths", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&paths, annotation, "getnamedargument", NULL, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); if (Z_TYPE_P(paths) != IS_ARRAY) { ZEPHIR_INIT_NVAR(paths); array_init(paths); } if (!(ZEPHIR_IS_EMPTY(module))) { zephir_array_update_string(&paths, SL("module"), &module, PH_COPY | PH_SEPARATE); } if (!(ZEPHIR_IS_EMPTY(namespaceName))) { zephir_array_update_string(&paths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); } zephir_array_update_string(&paths, SL("controller"), &controller, PH_COPY | PH_SEPARATE); zephir_array_update_string(&paths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 0); ZEPHIR_CALL_METHOD(&value, annotation, "getargument", NULL, _3); zephir_check_call_status(); if (Z_TYPE_P(value) != IS_NULL) { if (!ZEPHIR_IS_STRING(value, "/")) { ZEPHIR_INIT_VAR(uri); ZEPHIR_CONCAT_VV(uri, routePrefix, value); } else { ZEPHIR_CPY_WRT(uri, routePrefix); } } else { ZEPHIR_INIT_NVAR(uri); ZEPHIR_CONCAT_VV(uri, routePrefix, actionName); } ZEPHIR_CALL_METHOD(&route, this_ptr, "add", NULL, uri, paths); zephir_check_call_status(); if (Z_TYPE_P(methods) != IS_NULL) { ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, methods); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "methods", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&methods, annotation, "getnamedargument", NULL, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); if (Z_TYPE_P(methods) == IS_ARRAY) { ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, methods); zephir_check_call_status(); } else { if (Z_TYPE_P(methods) == IS_STRING) { ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, methods); zephir_check_call_status(); } } } ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "converts", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); if (Z_TYPE_P(converts) == IS_ARRAY) { zephir_is_iterable(converts, &_5, &_4, 0, 0, "phalcon/mvc/router/annotations.zep", 348); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HMKEY(param, _5, _4); ZEPHIR_GET_HVALUE(convert, _6); ZEPHIR_CALL_METHOD(NULL, route, "convert", &_7, param, convert); zephir_check_call_status(); } } ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "conversors", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); if (Z_TYPE_P(converts) == IS_ARRAY) { zephir_is_iterable(converts, &_9, &_8, 0, 0, "phalcon/mvc/router/annotations.zep", 358); for ( ; zephir_hash_get_current_data_ex(_9, (void**) &_10, &_8) == SUCCESS ; zephir_hash_move_forward_ex(_9, &_8) ) { ZEPHIR_GET_HMKEY(conversorParam, _9, _8); ZEPHIR_GET_HVALUE(convert, _10); ZEPHIR_CALL_METHOD(NULL, route, "convert", &_11, conversorParam, convert); zephir_check_call_status(); } } ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "name", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&routeName, annotation, "getnamedargument", NULL, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); if (Z_TYPE_P(routeName) == IS_STRING) { ZEPHIR_CALL_METHOD(NULL, route, "setname", NULL, routeName); zephir_check_call_status(); } RETURN_MM_BOOL(1); } ZEPHIR_MM_RESTORE(); }