PHP_METHOD(Test_RegexDNA, process) { HashTable *_26; HashPosition _25; zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard, *_0, *_1, *_2, *_3, *_4, *_5, *_6, *_7, *_8, *_9, *_10, *_11, *_12, *_13, *_14, *_15, *_16, *_17, *_18, *_19, *_20, *_21, *_22, _23, *_24 = NULL, **_27, *_28 = NULL, *_29; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(variants); array_init(variants); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "agggtaaa|tttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "[cgt]gggtaaa|tttaccc[acg]", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "a[act]ggtaaa|tttacc[agt]t", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "ag[act]gtaaa|tttac[agt]ct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agg[act]taaa|ttta[agt]cct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "aggg[acg]aaa|ttt[cgt]ccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggt[cgt]aa|tt[acg]accct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggta[cgt]a|t[acg]taccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggtaa[cgt]|[acg]ttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_VAR(vIUB); array_init(vIUB); ZEPHIR_INIT_VAR(vIUBnew); array_init(vIUBnew); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/B/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "(c|g|t)", 1); zephir_array_append(&vIUBnew, _1, PH_SEPARATE); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "/D/S", 1); zephir_array_append(&vIUB, _2, PH_SEPARATE); ZEPHIR_INIT_VAR(_3); ZVAL_STRING(_3, "(a|g|t)", 1); zephir_array_append(&vIUBnew, _3, PH_SEPARATE); ZEPHIR_INIT_VAR(_4); ZVAL_STRING(_4, "/H/S", 1); zephir_array_append(&vIUB, _4, PH_SEPARATE); ZEPHIR_INIT_VAR(_5); ZVAL_STRING(_5, "(a|c|t)", 1); zephir_array_append(&vIUBnew, _5, PH_SEPARATE); ZEPHIR_INIT_VAR(_6); ZVAL_STRING(_6, "/K/S", 1); zephir_array_append(&vIUB, _6, PH_SEPARATE); ZEPHIR_INIT_VAR(_7); ZVAL_STRING(_7, "(g|t)", 1); zephir_array_append(&vIUBnew, _7, PH_SEPARATE); ZEPHIR_INIT_VAR(_8); ZVAL_STRING(_8, "/M/S", 1); zephir_array_append(&vIUB, _8, PH_SEPARATE); ZEPHIR_INIT_VAR(_9); ZVAL_STRING(_9, "(a|c)", 1); zephir_array_append(&vIUBnew, _9, PH_SEPARATE); ZEPHIR_INIT_VAR(_10); ZVAL_STRING(_10, "/N/S", 1); zephir_array_append(&vIUB, _10, PH_SEPARATE); ZEPHIR_INIT_VAR(_11); ZVAL_STRING(_11, "(a|c|g|t)", 1); zephir_array_append(&vIUBnew, _11, PH_SEPARATE); ZEPHIR_INIT_VAR(_12); ZVAL_STRING(_12, "/R/S", 1); zephir_array_append(&vIUB, _12, PH_SEPARATE); ZEPHIR_INIT_VAR(_13); ZVAL_STRING(_13, "(a|g)", 1); zephir_array_append(&vIUBnew, _13, PH_SEPARATE); ZEPHIR_INIT_VAR(_14); ZVAL_STRING(_14, "/S/S", 1); zephir_array_append(&vIUB, _14, PH_SEPARATE); ZEPHIR_INIT_VAR(_15); ZVAL_STRING(_15, "(c|g)", 1); zephir_array_append(&vIUBnew, _15, PH_SEPARATE); ZEPHIR_INIT_VAR(_16); ZVAL_STRING(_16, "/V/S", 1); zephir_array_append(&vIUB, _16, PH_SEPARATE); ZEPHIR_INIT_VAR(_17); ZVAL_STRING(_17, "(a|c|g)", 1); zephir_array_append(&vIUBnew, _17, PH_SEPARATE); ZEPHIR_INIT_VAR(_18); ZVAL_STRING(_18, "/W/S", 1); zephir_array_append(&vIUB, _18, PH_SEPARATE); ZEPHIR_INIT_VAR(_19); ZVAL_STRING(_19, "(a|t)", 1); zephir_array_append(&vIUBnew, _19, PH_SEPARATE); ZEPHIR_INIT_VAR(_20); ZVAL_STRING(_20, "/Y/S", 1); zephir_array_append(&vIUB, _20, PH_SEPARATE); ZEPHIR_INIT_VAR(_21); ZVAL_STRING(_21, "(c|t)", 1); zephir_array_append(&vIUBnew, _21, PH_SEPARATE); ZEPHIR_INIT_VAR(stuffToRemove); ZVAL_STRING(stuffToRemove, "^>.*$|\n", 1); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(contents); zephir_call_func_p1(contents, "file_get_contents", path); ZEPHIR_INIT_VAR(initialLength); ZVAL_LONG(initialLength, zephir_fast_strlen_ev(contents)); ZEPHIR_INIT_VAR(_22); ZEPHIR_CONCAT_SVS(_22, "/", stuffToRemove, "/mS"); ZEPHIR_SINIT_VAR(_23); ZVAL_STRING(&_23, "", 0); ZEPHIR_INIT_VAR(_24); zephir_call_func_p3(_24, "preg_replace", _22, &_23, contents); ZEPHIR_CPY_WRT(contents, _24); ZEPHIR_INIT_VAR(codeLength); ZVAL_LONG(codeLength, zephir_fast_strlen_ev(contents)); zephir_is_iterable(variants, &_26, &_25, 0, 0); for ( ; zend_hash_get_current_data_ex(_26, (void**) &_27, &_25) == SUCCESS ; zend_hash_move_forward_ex(_26, &_25) ) { ZEPHIR_GET_HVALUE(regex, _27); zend_print_zval(regex, 0); php_printf(" "); ZEPHIR_INIT_LNVAR(_28); ZEPHIR_CONCAT_SVS(_28, "/", regex, "/iS"); Z_SET_ISREF_P(discard); ZEPHIR_INIT_NVAR(_24); zephir_call_func_p3(_24, "preg_match_all", _28, contents, discard); zend_print_zval(_24, 0); php_printf("%c", '\n'); } ZEPHIR_INIT_VAR(_29); zephir_call_func_p3(_29, "preg_replace", vIUB, vIUBnew, contents); ZEPHIR_CPY_WRT(contents, _29); php_printf("%c", '\n'); zend_print_zval(initialLength, 0); php_printf("%c", '\n'); zend_print_zval(codeLength, 0); php_printf("%c", '\n'); php_printf("%d", zephir_fast_strlen_ev(contents)); php_printf("%c", '\n'); ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Test_FortyTwo, proof) { zend_bool _5; HashTable *_3; HashPosition _2; zval *_0; int i, j, _6, _7; zval *box, *side = NULL, *_1, **_4, *_8; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(box); array_init_size(box, 19); ZEPHIR_INIT_VAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 10); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 24); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 8); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 8); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 15); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 19); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 19); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 17); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 6); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 6); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 16); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 20); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 20); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 13); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 9); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 9); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 11); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 22); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 22); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 2); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 18); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 18); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 4); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 20); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 5); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 21); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 16); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 16); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 3); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 23); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 23); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 7); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 12); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 12); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 25); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 5); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 24); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 7); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 11); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 11); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 27); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 4); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); ZEPHIR_INIT_BNVAR(_0); array_init_size(_0, 5); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 11); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 27); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 4); zephir_array_fast_append(_0, _1); zephir_array_fast_append(box, _0); zephir_is_iterable(box, &_3, &_2, 0, 0); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(side, _4); j = 0; _7 = 2; _6 = 0; _5 = 0; if ((_6 <= _7)) { while (1) { if (_5) { _6++; if (!((_6 <= _7))) { break; } } else { _5 = 1; } i = _6; zephir_array_fetch_long(&_8, side, i, PH_NOISY | PH_READONLY TSRMLS_CC); j += zephir_get_numberval(_8); } } if ((j != 42)) { ZEPHIR_THROW_EXCEPTION_STR(test_exception_ce, "not true"); return; } } ZEPHIR_MM_RESTORE(); }
/** * Gets the column name in SQLite */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, getColumnDefinition) { zephir_nts_static zephir_fcall_cache_entry *_7 = NULL; HashTable *_4; HashPosition _3; int ZEPHIR_LAST_CALL_STATUS; zval *column, *columnSql, *type = NULL, *typeValues = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *value = NULL, *valueSql, **_5, _6 = zval_used_for_init, _8 = zval_used_for_init, *_9, *_10 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &column); ZEPHIR_INIT_VAR(columnSql); ZVAL_STRING(columnSql, "", 1); ZEPHIR_CALL_METHOD(&type, column, "gettype", NULL); zephir_check_call_status(); if (Z_TYPE_P(type) == IS_STRING) { zephir_concat_self(&columnSql, type TSRMLS_CC); ZEPHIR_CALL_METHOD(&type, column, "gettypereference", NULL); zephir_check_call_status(); } do { if (ZEPHIR_IS_LONG(type, 0)) { if (ZEPHIR_IS_EMPTY(columnSql)) { zephir_concat_self_str(&columnSql, SL("INT") TSRMLS_CC); } break; } if (ZEPHIR_IS_LONG(type, 1)) { if (ZEPHIR_IS_EMPTY(columnSql)) { zephir_concat_self_str(&columnSql, SL("DATE") TSRMLS_CC); } break; } if (ZEPHIR_IS_LONG(type, 2)) { if (ZEPHIR_IS_EMPTY(columnSql)) { zephir_concat_self_str(&columnSql, SL("VARCHAR") TSRMLS_CC); } ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL); zephir_check_call_status(); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "(", _0, ")"); zephir_concat_self(&columnSql, _1 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(type, 3)) { if (ZEPHIR_IS_EMPTY(columnSql)) { zephir_concat_self_str(&columnSql, SL("NUMERIC") TSRMLS_CC); } ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_2, column, "getscale", NULL); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_1); ZEPHIR_CONCAT_SVSVS(_1, "(", _0, ",", _2, ")"); zephir_concat_self(&columnSql, _1 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(type, 4)) { if (ZEPHIR_IS_EMPTY(columnSql)) { zephir_concat_self_str(&columnSql, SL("TIMESTAMP") TSRMLS_CC); } break; } if (ZEPHIR_IS_LONG(type, 5)) { if (ZEPHIR_IS_EMPTY(columnSql)) { zephir_concat_self_str(&columnSql, SL("CHARACTER") TSRMLS_CC); } ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_1); ZEPHIR_CONCAT_SVS(_1, "(", _0, ")"); zephir_concat_self(&columnSql, _1 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(type, 6)) { if (ZEPHIR_IS_EMPTY(columnSql)) { zephir_concat_self_str(&columnSql, SL("TEXT") TSRMLS_CC); } break; } if (ZEPHIR_IS_LONG(type, 7)) { if (ZEPHIR_IS_EMPTY(columnSql)) { zephir_concat_self_str(&columnSql, SL("FLOAT") TSRMLS_CC); } break; } if (ZEPHIR_IS_EMPTY(columnSql)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Unrecognized SQLite data type", "phalcon/db/dialect/sqlite.zep", 112); return; } ZEPHIR_CALL_METHOD(&typeValues, column, "gettypevalues", NULL); zephir_check_call_status(); if (!(ZEPHIR_IS_EMPTY(typeValues))) { if (Z_TYPE_P(typeValues) == IS_ARRAY) { ZEPHIR_INIT_VAR(valueSql); ZVAL_STRING(valueSql, "", 1); zephir_is_iterable(typeValues, &_4, &_3, 0, 0, "phalcon/db/dialect/sqlite.zep", 123); for ( ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zephir_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HVALUE(value, _5); ZEPHIR_SINIT_NVAR(_6); ZVAL_STRING(&_6, "\"", 0); ZEPHIR_CALL_FUNCTION(&_0, "addcslashes", &_7, value, &_6); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_1); ZEPHIR_CONCAT_SVS(_1, "\"", _0, "\", "); zephir_concat_self(&valueSql, _1 TSRMLS_CC); } ZEPHIR_SINIT_NVAR(_6); ZVAL_LONG(&_6, 0); ZEPHIR_SINIT_VAR(_8); ZVAL_LONG(&_8, -2); ZEPHIR_INIT_VAR(_9); zephir_substr(_9, valueSql, 0 , -2 , 0); ZEPHIR_INIT_VAR(_10); ZEPHIR_CONCAT_SVS(_10, "(", _9, ")"); zephir_concat_self(&columnSql, _10 TSRMLS_CC); } else { ZEPHIR_SINIT_NVAR(_8); ZVAL_STRING(&_8, "\"", 0); ZEPHIR_CALL_FUNCTION(&_2, "addcslashes", &_7, typeValues, &_8); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_10); ZEPHIR_CONCAT_SVS(_10, "(\"", _2, "\")"); zephir_concat_self(&columnSql, _10 TSRMLS_CC); } } } while(0); RETURN_CCTOR(columnSql); }
/** * Produces a recursive representation of an array */ PHP_METHOD(Phalcon_Debug, _getArrayDump) { HashTable *_2; HashPosition _1; zend_bool _0; zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *argument_param = NULL, *n = NULL, *numberArguments = NULL, *dump = NULL, *varDump = NULL, *k = NULL, *v = NULL, **_3, *_5$$8 = NULL, *_6$$8 = NULL, *_8$$9 = NULL, *_9$$5 = NULL; zval *argument = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &argument_param, &n); argument = argument_param; if (!n) { ZEPHIR_INIT_VAR(n); ZVAL_LONG(n, 0); } ZEPHIR_INIT_VAR(numberArguments); ZVAL_LONG(numberArguments, zephir_fast_count_int(argument TSRMLS_CC)); _0 = ZEPHIR_GE_LONG(n, 3); if (!(_0)) { _0 = ZEPHIR_IS_LONG(numberArguments, 0); } if (_0) { RETURN_MM_NULL(); } if (ZEPHIR_GE_LONG(numberArguments, 10)) { RETURN_CCTOR(numberArguments); } ZEPHIR_INIT_VAR(dump); array_init(dump); zephir_is_iterable(argument, &_2, &_1, 0, 0, "phalcon/debug.zep", 189); for ( ; zend_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zend_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(k, _2, _1); ZEPHIR_GET_HVALUE(v, _3); if (ZEPHIR_IS_STRING(v, "")) { ZEPHIR_INIT_NVAR(varDump); ZVAL_STRING(varDump, "(empty string)", 1); } else if (zephir_is_scalar(v)) { ZEPHIR_CALL_METHOD(&varDump, this_ptr, "_escapestring", &_4, 0, v); zephir_check_call_status(); } else if (Z_TYPE_P(v) == IS_ARRAY) { ZEPHIR_INIT_NVAR(_6$$8); ZVAL_LONG(_6$$8, (zephir_get_numberval(n) + 1)); ZEPHIR_CALL_METHOD(&_5$$8, this_ptr, "_getarraydump", &_7, 159, v, _6$$8); zephir_check_call_status(); ZEPHIR_INIT_NVAR(varDump); ZEPHIR_CONCAT_SVS(varDump, "Array(", _5$$8, ")"); } else if (Z_TYPE_P(v) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_8$$9); zephir_get_class(_8$$9, v, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(varDump); ZEPHIR_CONCAT_SVS(varDump, "Object(", _8$$9, ")"); } else if (Z_TYPE_P(v) == IS_NULL) { ZEPHIR_INIT_NVAR(varDump); ZVAL_STRING(varDump, "null", 1); } else { ZEPHIR_CPY_WRT(varDump, v); } ZEPHIR_INIT_LNVAR(_9$$5); ZEPHIR_CONCAT_SVSV(_9$$5, "[", k, "] => ", varDump); zephir_array_append(&dump, _9$$5, PH_SEPARATE, "phalcon/debug.zep", 186); } zephir_fast_join_str(return_value, SL(", "), dump TSRMLS_CC); RETURN_MM(); }
/** * Handles uncaught exceptions */ PHP_METHOD(Phalcon_Debug, onUncaughtException) { HashTable *_12$$5, *_17$$5, *_24$$5, *_31$$5, *_37$$13; HashPosition _11$$5, _16$$5, _23$$5, _30$$5, _36$$13; zephir_fcall_cache_entry *_15 = NULL, *_21 = NULL, *_27 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *exception, *_REQUEST, *_SERVER, *obLevel = NULL, *className = NULL, *escapedMessage = NULL, *html = NULL, *showBackTrace = NULL, *dataVars = NULL, *n = NULL, *traceItem = NULL, *keyRequest = NULL, *value = NULL, *keyServer = NULL, *keyFile = NULL, *keyVar = NULL, *dataVar = NULL, *_0, *_2 = NULL, *_3 = NULL, *_4, *_5 = NULL, *_6, *_7 = NULL, *_8 = NULL, *_9, *_42 = NULL, *_43, *_1$$4 = NULL, *_10$$5 = NULL, **_13$$5, **_18$$5, **_25$$5, *_29$$5 = NULL, **_32$$5, *_34$$5 = NULL, *_35$$5, *_14$$7 = NULL, *_19$$9 = NULL, *_20$$10 = NULL, *_22$$10 = NULL, *_26$$11 = NULL, *_28$$11 = NULL, *_33$$12 = NULL, **_38$$13, *_39$$14 = NULL, *_40$$14, *_41$$14 = NULL; ZEPHIR_MM_GROW(); zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC); zephir_get_global(&_REQUEST, SS("_REQUEST") TSRMLS_CC); zephir_fetch_params(1, 1, 0, &exception); ZEPHIR_CALL_FUNCTION(&obLevel, "ob_get_level", NULL, 168); zephir_check_call_status(); if (ZEPHIR_GT_LONG(obLevel, 0)) { ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 128); zephir_check_call_status(); } _0 = zephir_fetch_static_property_ce(phalcon_debug_ce, SL("_isActive") TSRMLS_CC); if (zephir_is_true(_0)) { ZEPHIR_CALL_METHOD(&_1$$4, exception, "getmessage", NULL, 0); zephir_check_call_status(); zend_print_zval(_1$$4, 0); RETURN_MM_NULL(); } zephir_update_static_property_ce(phalcon_debug_ce, SL("_isActive"), &ZEPHIR_GLOBAL(global_true) TSRMLS_CC); ZEPHIR_INIT_VAR(className); zephir_get_class(className, exception, 0 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_2, exception, "getmessage", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&escapedMessage, this_ptr, "_escapestring", NULL, 0, _2); zephir_check_call_status(); ZEPHIR_INIT_VAR(html); ZEPHIR_CONCAT_SVSVS(html, "<html><head><title>", className, ": ", escapedMessage, "</title>"); ZEPHIR_CALL_METHOD(&_3, this_ptr, "getcsssources", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_4); ZEPHIR_CONCAT_VS(_4, _3, "</head><body>"); zephir_concat_self(&html, _4 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_5, this_ptr, "getversion", NULL, 0); zephir_check_call_status(); zephir_concat_self(&html, _5 TSRMLS_CC); zephir_concat_self_str(&html, SL("<div align=\"center\"><div class=\"error-main\">") TSRMLS_CC); ZEPHIR_INIT_VAR(_6); ZEPHIR_CONCAT_SVSVS(_6, "<h1>", className, ": ", escapedMessage, "</h1>"); zephir_concat_self(&html, _6 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_7, exception, "getfile", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_8, exception, "getline", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_9); ZEPHIR_CONCAT_SVSVS(_9, "<span class=\"error-file\">", _7, " (", _8, ")</span>"); zephir_concat_self(&html, _9 TSRMLS_CC); zephir_concat_self_str(&html, SL("</div>") TSRMLS_CC); ZEPHIR_OBS_VAR(showBackTrace); zephir_read_property_this(&showBackTrace, this_ptr, SL("_showBackTrace"), PH_NOISY_CC); if (zephir_is_true(showBackTrace)) { ZEPHIR_OBS_VAR(dataVars); zephir_read_property_this(&dataVars, this_ptr, SL("_data"), PH_NOISY_CC); zephir_concat_self_str(&html, SL("<div class=\"error-info\"><div id=\"tabs\"><ul>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-1\">Backtrace</a></li>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-2\">Request</a></li>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-3\">Server</a></li>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-4\">Included Files</a></li>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-5\">Memory</a></li>") TSRMLS_CC); if (Z_TYPE_P(dataVars) == IS_ARRAY) { zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-6\">Variables</a></li>") TSRMLS_CC); } zephir_concat_self_str(&html, SL("</ul>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<div id=\"error-tabs-1\"><table cellspacing=\"0\" align=\"center\" width=\"100%\">") TSRMLS_CC); ZEPHIR_CALL_METHOD(&_10$$5, exception, "gettrace", NULL, 0); zephir_check_call_status(); zephir_is_iterable(_10$$5, &_12$$5, &_11$$5, 0, 0, "phalcon/debug.zep", 659); for ( ; zend_hash_get_current_data_ex(_12$$5, (void**) &_13$$5, &_11$$5) == SUCCESS ; zend_hash_move_forward_ex(_12$$5, &_11$$5) ) { ZEPHIR_GET_HMKEY(n, _12$$5, _11$$5); ZEPHIR_GET_HVALUE(traceItem, _13$$5); ZEPHIR_CALL_METHOD(&_14$$7, this_ptr, "showtraceitem", &_15, 169, n, traceItem); zephir_check_call_status(); zephir_concat_self(&html, _14$$7 TSRMLS_CC); } zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<div id=\"error-tabs-2\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC); zephir_concat_self_str(&html, SL("<tr><th>Key</th><th>Value</th></tr>") TSRMLS_CC); zephir_is_iterable(_REQUEST, &_17$$5, &_16$$5, 0, 0, "phalcon/debug.zep", 673); for ( ; zend_hash_get_current_data_ex(_17$$5, (void**) &_18$$5, &_16$$5) == SUCCESS ; zend_hash_move_forward_ex(_17$$5, &_16$$5) ) { ZEPHIR_GET_HMKEY(keyRequest, _17$$5, _16$$5); ZEPHIR_GET_HVALUE(value, _18$$5); if (Z_TYPE_P(value) != IS_ARRAY) { ZEPHIR_INIT_LNVAR(_19$$9); ZEPHIR_CONCAT_SVSVS(_19$$9, "<tr><td class=\"key\">", keyRequest, "</td><td>", value, "</td></tr>"); zephir_concat_self(&html, _19$$9 TSRMLS_CC); } else { ZEPHIR_CALL_FUNCTION(&_20$$10, "print_r", &_21, 170, value, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_22$$10); ZEPHIR_CONCAT_SVSVS(_22$$10, "<tr><td class=\"key\">", keyRequest, "</td><td>", _20$$10, "</td></tr>"); zephir_concat_self(&html, _22$$10 TSRMLS_CC); } } zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<div id=\"error-tabs-3\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC); zephir_concat_self_str(&html, SL("<tr><th>Key</th><th>Value</th></tr>") TSRMLS_CC); zephir_is_iterable(_SERVER, &_24$$5, &_23$$5, 0, 0, "phalcon/debug.zep", 683); for ( ; zend_hash_get_current_data_ex(_24$$5, (void**) &_25$$5, &_23$$5) == SUCCESS ; zend_hash_move_forward_ex(_24$$5, &_23$$5) ) { ZEPHIR_GET_HMKEY(keyServer, _24$$5, _23$$5); ZEPHIR_GET_HVALUE(value, _25$$5); ZEPHIR_CALL_METHOD(&_26$$11, this_ptr, "_getvardump", &_27, 0, value); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_28$$11); ZEPHIR_CONCAT_SVSVS(_28$$11, "<tr><td class=\"key\">", keyServer, "</td><td>", _26$$11, "</td></tr>"); zephir_concat_self(&html, _28$$11 TSRMLS_CC); } zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<div id=\"error-tabs-4\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC); zephir_concat_self_str(&html, SL("<tr><th>#</th><th>Path</th></tr>") TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_29$$5, "get_included_files", NULL, 171); zephir_check_call_status(); zephir_is_iterable(_29$$5, &_31$$5, &_30$$5, 0, 0, "phalcon/debug.zep", 693); for ( ; zend_hash_get_current_data_ex(_31$$5, (void**) &_32$$5, &_30$$5) == SUCCESS ; zend_hash_move_forward_ex(_31$$5, &_30$$5) ) { ZEPHIR_GET_HMKEY(keyFile, _31$$5, _30$$5); ZEPHIR_GET_HVALUE(value, _32$$5); ZEPHIR_INIT_LNVAR(_33$$12); ZEPHIR_CONCAT_SVSVS(_33$$12, "<tr><td>", keyFile, "</th><td>", value, "</td></tr>"); zephir_concat_self(&html, _33$$12 TSRMLS_CC); } zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<div id=\"error-tabs-5\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_34$$5, "memory_get_usage", NULL, 172, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); ZEPHIR_INIT_VAR(_35$$5); ZEPHIR_CONCAT_SVS(_35$$5, "<tr><th colspan=\"2\">Memory</th></tr><tr><td>Usage</td><td>", _34$$5, "</td></tr>"); zephir_concat_self(&html, _35$$5 TSRMLS_CC); zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); if (Z_TYPE_P(dataVars) == IS_ARRAY) { zephir_concat_self_str(&html, SL("<div id=\"error-tabs-6\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC); zephir_concat_self_str(&html, SL("<tr><th>Key</th><th>Value</th></tr>") TSRMLS_CC); zephir_is_iterable(dataVars, &_37$$13, &_36$$13, 0, 0, "phalcon/debug.zep", 711); for ( ; zend_hash_get_current_data_ex(_37$$13, (void**) &_38$$13, &_36$$13) == SUCCESS ; zend_hash_move_forward_ex(_37$$13, &_36$$13) ) { ZEPHIR_GET_HMKEY(keyVar, _37$$13, _36$$13); ZEPHIR_GET_HVALUE(dataVar, _38$$13); zephir_array_fetch_long(&_40$$14, dataVar, 0, PH_NOISY | PH_READONLY, "phalcon/debug.zep", 709 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_39$$14, this_ptr, "_getvardump", &_27, 0, _40$$14); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_41$$14); ZEPHIR_CONCAT_SVSVS(_41$$14, "<tr><td class=\"key\">", keyVar, "</td><td>", _39$$14, "</td></tr>"); zephir_concat_self(&html, _41$$14 TSRMLS_CC); } zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); } zephir_concat_self_str(&html, SL("</div>") TSRMLS_CC); } ZEPHIR_CALL_METHOD(&_42, this_ptr, "getjssources", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_43); ZEPHIR_CONCAT_VS(_43, _42, "</div></body></html>"); zephir_concat_self(&html, _43 TSRMLS_CC); zend_print_zval(html, 0); zephir_update_static_property_ce(phalcon_debug_ce, SL("_isActive"), &ZEPHIR_GLOBAL(global_false) TSRMLS_CC); 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) { zephir_fcall_cache_entry *_16 = NULL; zval *_11 = NULL; HashTable *_5, *_13; HashPosition _4, _12; int ZEPHIR_LAST_CALL_STATUS; zval *table, *schema = NULL, *references, *reference = NULL, *arrayReference = NULL, *constraintName = NULL, *referenceObjects, *name = NULL, *referencedSchema = NULL, *referencedTable = NULL, *columns = NULL, *referencedColumns = NULL, *number = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7, *_8, *_9, *_10, **_14, *_15 = 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", 373); 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", 352 TSRMLS_CC); ZEPHIR_INIT_NVAR(columns); array_init(columns); ZEPHIR_INIT_NVAR(referencedColumns); array_init(referencedColumns); } else { zephir_array_fetch(&_7, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 356 TSRMLS_CC); ZEPHIR_OBS_NVAR(referencedSchema); zephir_array_fetch_string(&referencedSchema, _7, SL("referencedSchema"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 356 TSRMLS_CC); zephir_array_fetch(&_8, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 357 TSRMLS_CC); ZEPHIR_OBS_NVAR(referencedTable); zephir_array_fetch_string(&referencedTable, _8, SL("referencedTable"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 357 TSRMLS_CC); zephir_array_fetch(&_9, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 358 TSRMLS_CC); ZEPHIR_OBS_NVAR(columns); zephir_array_fetch_string(&columns, _9, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 358 TSRMLS_CC); zephir_array_fetch(&_10, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 359 TSRMLS_CC); ZEPHIR_OBS_NVAR(referencedColumns); zephir_array_fetch_string(&referencedColumns, _10, SL("referencedColumns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 359 TSRMLS_CC); } zephir_array_fetch_long(&_7, reference, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 362 TSRMLS_CC); zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 362); zephir_array_fetch_long(&_8, reference, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 363 TSRMLS_CC); zephir_array_append(&referencedColumns, _8, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 363); ZEPHIR_INIT_NVAR(_11); zephir_create_array(_11, 4, 0 TSRMLS_CC); zephir_array_update_string(&_11, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_11, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_11, SL("columns"), &columns, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_11, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); zephir_array_update_zval(&references, constraintName, &_11, PH_COPY | PH_SEPARATE); } ZEPHIR_INIT_VAR(referenceObjects); array_init(referenceObjects); zephir_is_iterable(references, &_13, &_12, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 383); for ( ; zephir_hash_get_current_data_ex(_13, (void**) &_14, &_12) == SUCCESS ; zephir_hash_move_forward_ex(_13, &_12) ) { ZEPHIR_GET_HMKEY(name, _13, _12); ZEPHIR_GET_HVALUE(arrayReference, _14); ZEPHIR_INIT_NVAR(_3); object_init_ex(_3, phalcon_db_reference_ce); ZEPHIR_INIT_NVAR(_11); zephir_create_array(_11, 4, 0 TSRMLS_CC); ZEPHIR_OBS_NVAR(_15); zephir_array_fetch_string(&_15, arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 376 TSRMLS_CC); zephir_array_update_string(&_11, SL("referencedSchema"), &_15, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_15); zephir_array_fetch_string(&_15, arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 377 TSRMLS_CC); zephir_array_update_string(&_11, SL("referencedTable"), &_15, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_15); zephir_array_fetch_string(&_15, arrayReference, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 378 TSRMLS_CC); zephir_array_update_string(&_11, SL("columns"), &_15, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_15); zephir_array_fetch_string(&_15, arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 380 TSRMLS_CC); zephir_array_update_string(&_11, SL("referencedColumns"), &_15, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_16, 16, name, _11); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, name, &_3, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(referenceObjects); }
/** * Loads registered template engines, if none is registered it will use Phalcon\Mvc\View\Engine\Php * * @return array */ PHP_METHOD(Phalcon_Mvc_View_Simple, _loadTemplateEngines) { zephir_fcall_cache_entry *_4 = NULL, *_6 = NULL; HashTable *_2; HashPosition _1; int ZEPHIR_LAST_CALL_STATUS; zval *engines = NULL, *dependencyInjector, *registeredEngines, *arguments, *extension = NULL, *engineService = NULL, *engineObject = NULL, *_0 = NULL, **_3, *_5 = NULL; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(engines); zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(engines)) { ZEPHIR_OBS_VAR(dependencyInjector); zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(engines); array_init(engines); ZEPHIR_OBS_VAR(registeredEngines); zephir_read_property_this(®isteredEngines, this_ptr, SL("_registeredEngines"), PH_NOISY_CC); if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { ZEPHIR_INIT_VAR(_0); object_init_ex(_0, phalcon_mvc_view_engine_php_ce); ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 370, this_ptr, dependencyInjector); zephir_check_call_status(); zephir_array_update_string(&engines, SL(".phtml"), &_0, PH_COPY | PH_SEPARATE); } else { if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the application services", "phalcon/mvc/view/simple.zep", 139); return; } ZEPHIR_INIT_VAR(arguments); zephir_create_array(arguments, 2, 0 TSRMLS_CC); zephir_array_fast_append(arguments, this_ptr); zephir_array_fast_append(arguments, dependencyInjector); zephir_is_iterable(registeredEngines, &_2, &_1, 0, 0, "phalcon/mvc/view/simple.zep", 171); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(extension, _2, _1); ZEPHIR_GET_HVALUE(engineService, _3); if (Z_TYPE_P(engineService) == IS_OBJECT) { if (zephir_instance_of_ev(engineService, zend_ce_closure TSRMLS_CC)) { ZEPHIR_INIT_NVAR(engineObject); ZEPHIR_CALL_USER_FUNC_ARRAY(engineObject, engineService, arguments); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(engineObject, engineService); } } else { if (Z_TYPE_P(engineService) == IS_STRING) { ZEPHIR_CALL_METHOD(&engineObject, dependencyInjector, "getshared", &_4, 0, engineService, arguments); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(_0); object_init_ex(_0, phalcon_mvc_view_exception_ce); ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SV(_5, "Invalid template engine registration for extension: ", extension); ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_6, 9, _5); zephir_check_call_status(); zephir_throw_exception_debug(_0, "phalcon/mvc/view/simple.zep", 165 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } zephir_array_update_zval(&engines, extension, &engineObject, PH_COPY | PH_SEPARATE); } } zephir_update_property_this(this_ptr, SL("_engines"), engines TSRMLS_CC); } else { ZEPHIR_OBS_NVAR(engines); zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); } RETURN_CCTOR(engines); }
PHP_METHOD(Test_RegexDNA, process) { HashTable *_5; HashPosition _4; int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard = NULL, *_0 = NULL, *_1, *_2 = NULL, **_6, *_7 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(variants); zephir_create_array(variants, 9, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "agggtaaa|tttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "[cgt]gggtaaa|tttaccc[acg]", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "a[act]ggtaaa|tttacc[agt]t", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "ag[act]gtaaa|tttac[agt]ct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agg[act]taaa|ttta[agt]cct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "aggg[acg]aaa|ttt[cgt]ccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agggt[cgt]aa|tt[acg]accct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agggta[cgt]a|t[acg]taccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agggtaa[cgt]|[acg]ttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_VAR(vIUB); array_init(vIUB); ZEPHIR_INIT_VAR(vIUBnew); array_init(vIUBnew); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/B/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 30); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 30); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/D/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 31); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 31); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/H/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 32); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 32); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/K/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 33); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 33); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/M/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 34); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 34); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/N/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 35); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 35); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/R/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 36); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 36); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/S/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 37); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 37); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/V/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 38); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 38); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/W/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 39); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 39); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/Y/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 40); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 40); ZEPHIR_INIT_VAR(stuffToRemove); ZVAL_STRING(stuffToRemove, "^>.*$|\n", 1); ZEPHIR_INIT_NVAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(contents); zephir_file_get_contents(contents, path TSRMLS_CC); ZEPHIR_INIT_VAR(initialLength); ZVAL_LONG(initialLength, zephir_fast_strlen_ev(contents)); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "/", stuffToRemove, "/mS"); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 53, _1, _0, contents); zephir_check_temp_parameter(_0); zephir_check_call_status(); ZEPHIR_CPY_WRT(contents, _2); ZEPHIR_INIT_VAR(codeLength); ZVAL_LONG(codeLength, zephir_fast_strlen_ev(contents)); zephir_is_iterable(variants, &_5, &_4, 0, 0, "test/regexdna.zep", 59); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(regex, _6); zend_print_zval(regex, 0); php_printf("%s", " "); ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_LNVAR(_7); ZEPHIR_CONCAT_SVS(_7, "/", regex, "/iS"); zephir_preg_match(_0, _7, contents, discard, 1, 0 , 0 TSRMLS_CC); zend_print_zval(_0, 0); php_printf("%c", '\n'); } ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 53, vIUB, vIUBnew, contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(contents, _2); php_printf("%c", '\n'); zend_print_zval(initialLength, 0); php_printf("%c", '\n'); zend_print_zval(codeLength, 0); php_printf("%c", '\n'); php_printf("%d", zephir_fast_strlen_ev(contents)); php_printf("%c", '\n'); ZEPHIR_MM_RESTORE(); }
/** * Validate a set of data according to a set of rules * * @param array|object data * @param object entity * @return Phalcon\Validation\Message\Group */ PHP_METHOD(Phalcon_Validation, validate) { HashTable *_2; HashPosition _1; zend_bool _0; int ZEPHIR_LAST_CALL_STATUS; zval *data = NULL, *entity = NULL, *validators, *messages = NULL, *scope = NULL, *field = NULL, *validator = NULL, *status = NULL, **_3, *_4 = NULL, *_5 = NULL, *_6 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 2, &data, &entity); if (!data) { data = ZEPHIR_GLOBAL(global_null); } if (!entity) { entity = ZEPHIR_GLOBAL(global_null); } ZEPHIR_OBS_VAR(validators); zephir_read_property_this(&validators, this_ptr, SL("_validators"), PH_NOISY_CC); if (Z_TYPE_P(validators) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "There are no validators to validate", "phalcon/validation.zep", 83); return; } zephir_update_property_this(this_ptr, SL("_values"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); ZEPHIR_INIT_VAR(messages); object_init_ex(messages, phalcon_validation_message_group_ce); ZEPHIR_CALL_METHOD(NULL, messages, "__construct", NULL, 173); zephir_check_call_status(); if ((zephir_method_exists_ex(this_ptr, SS("beforevalidation") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&status, this_ptr, "beforevalidation", NULL, 0, data, entity, messages); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { RETURN_CCTOR(status); } } zephir_update_property_this(this_ptr, SL("_messages"), messages TSRMLS_CC); _0 = Z_TYPE_P(data) == IS_ARRAY; if (!(_0)) { _0 = Z_TYPE_P(data) == IS_OBJECT; } if (_0) { zephir_update_property_this(this_ptr, SL("_data"), data TSRMLS_CC); } zephir_is_iterable(validators, &_2, &_1, 0, 0, "phalcon/validation.zep", 138); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(scope, _3); if (Z_TYPE_P(scope) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "The validator scope is not valid", "phalcon/validation.zep", 115); return; } ZEPHIR_OBS_NVAR(field); zephir_array_fetch_long(&field, scope, 0, PH_NOISY, "phalcon/validation.zep", 118 TSRMLS_CC); ZEPHIR_OBS_NVAR(validator); zephir_array_fetch_long(&validator, scope, 1, PH_NOISY, "phalcon/validation.zep", 119 TSRMLS_CC); if (Z_TYPE_P(validator) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "One of the validators is not valid", "phalcon/validation.zep", 122); return; } ZEPHIR_CALL_METHOD(&_4, validator, "validate", NULL, 0, this_ptr, field); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_4)) { ZEPHIR_INIT_NVAR(_6); ZVAL_STRING(_6, "cancelOnFail", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_5, validator, "getoption", NULL, 0, _6); zephir_check_temp_parameter(_6); zephir_check_call_status(); if (zephir_is_true(_5)) { break; } } } ZEPHIR_OBS_NVAR(messages); zephir_read_property_this(&messages, this_ptr, SL("_messages"), PH_NOISY_CC); if ((zephir_method_exists_ex(this_ptr, SS("aftervalidation") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "aftervalidation", NULL, 0, data, entity, messages); zephir_check_call_status(); } RETURN_CCTOR(messages); }
/** * 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 *_4 = NULL; int ZEPHIR_LAST_CALL_STATUS; zend_bool _3; HashTable *_1; HashPosition _0; zval *placeholders = NULL; zval *statement, *placeholders_param = NULL, *dataTypes, *wildcard = NULL, *value = NULL, *type = NULL, *castValue = NULL, *parameter = NULL, **_2; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &statement, &placeholders_param, &dataTypes); placeholders = placeholders_param; zephir_is_iterable(placeholders, &_1, &_0, 0, 0, "phalcon/db/adapter/pdo.zep", 215); 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", 188); return; } } _3 = Z_TYPE_P(dataTypes) == IS_ARRAY; if (_3) { ZEPHIR_OBS_NVAR(type); _3 = zephir_array_isset_fetch(&type, dataTypes, wildcard, 0 TSRMLS_CC); } if (_3) { 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", &_4, 0, parameter, castValue); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_4, 0, parameter, castValue, type); zephir_check_call_status(); } } else { ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_4, 0, parameter, value); zephir_check_call_status(); } } ZEPHIR_CALL_METHOD(NULL, statement, "execute", NULL, 0); zephir_check_call_status(); RETVAL_ZVAL(statement, 1, 0); RETURN_MM(); }
/** * Converts bound parameters such as :name: or ?1 into PDO bind params ? * *<code> * print_r($connection->convertBoundParams('SELECT * FROM robots WHERE name = :name:', array('Bender'))); *</code> */ PHP_METHOD(Phalcon_Db_Adapter_Pdo, convertBoundParams) { HashTable *_3; HashPosition _2; int setOrder, ZEPHIR_LAST_CALL_STATUS; zval *params = NULL; zval *sql_param = NULL, *params_param = NULL, *boundSql = NULL, *placeHolders, *bindPattern, *matches, *placeMatch = NULL, *value = NULL, *_0 = NULL, *_1 = NULL, **_4, *_5, *_6; zval *sql = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &sql_param, ¶ms_param); if (unlikely(Z_TYPE_P(sql_param) != IS_STRING && Z_TYPE_P(sql_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sql' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(sql_param) == IS_STRING)) { zephir_get_strval(sql, sql_param); } else { ZEPHIR_INIT_VAR(sql); ZVAL_EMPTY_STRING(sql); } if (!params_param) { ZEPHIR_INIT_VAR(params); array_init(params); } else { zephir_get_arrval(params, params_param); } ZEPHIR_INIT_VAR(placeHolders); array_init(placeHolders); ZEPHIR_INIT_VAR(bindPattern); ZVAL_STRING(bindPattern, "/\\?([0-9]+)|:([a-zA-Z0-9_]+):/", 1); ZEPHIR_INIT_VAR(matches); ZVAL_NULL(matches); setOrder = 2; ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, setOrder); Z_SET_ISREF_P(matches); ZEPHIR_CALL_FUNCTION(&_1, "preg_match_all", NULL, 81, bindPattern, sql, matches, _0); Z_UNSET_ISREF_P(matches); zephir_check_call_status(); if (zephir_is_true(_1)) { zephir_is_iterable(matches, &_3, &_2, 0, 0, "phalcon/db/adapter/pdo.zep", 427); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(placeMatch, _4); ZEPHIR_OBS_NVAR(value); zephir_array_fetch_long(&_5, placeMatch, 1, PH_READONLY, "phalcon/db/adapter/pdo.zep", 413 TSRMLS_CC); if (!(zephir_array_isset_fetch(&value, params, _5, 0 TSRMLS_CC))) { if (zephir_array_isset_long(placeMatch, 2)) { ZEPHIR_OBS_NVAR(value); zephir_array_fetch_long(&_6, placeMatch, 2, PH_READONLY, "phalcon/db/adapter/pdo.zep", 415 TSRMLS_CC); if (!(zephir_array_isset_fetch(&value, params, _6, 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter wasn't found in parameters list", "phalcon/db/adapter/pdo.zep", 416); return; } } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter wasn't found in parameters list", "phalcon/db/adapter/pdo.zep", 419); return; } } zephir_array_append(&placeHolders, value, PH_SEPARATE, "phalcon/db/adapter/pdo.zep", 423); } ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "?", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&boundSql, "preg_replace", NULL, 82, bindPattern, _0, sql); zephir_check_temp_parameter(_0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(boundSql, sql); } zephir_create_array(return_value, 2, 0 TSRMLS_CC); zephir_array_update_string(&return_value, SL("sql"), &boundSql, PH_COPY | PH_SEPARATE); zephir_array_update_string(&return_value, SL("params"), &placeHolders, PH_COPY | PH_SEPARATE); RETURN_MM(); }
/** * 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, 0, _3, username, password, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_pdo"), _5 TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Phalcon\Config\Adapter\Ini constructor */ PHP_METHOD(Phalcon_Config_Adapter_Ini, __construct) { HashTable *_4, *_7$$6; HashPosition _3, _6$$6; zephir_fcall_cache_entry *_11 = NULL, *_15 = NULL, *_16 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *filePath_param = NULL, *mode = NULL, *iniConfig = NULL, *config = NULL, *section = NULL, *sections = NULL, *directives = NULL, *path = NULL, *lastValue = NULL, **_5, *_0$$4, *_1$$4, *_2$$4, **_8$$6, *_9$$7 = NULL, *_12$$8 = NULL, _13$$8 = zval_used_for_init, *_14$$9 = NULL; zval *filePath = NULL, *_10$$7 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &filePath_param, &mode); if (unlikely(Z_TYPE_P(filePath_param) != IS_STRING && Z_TYPE_P(filePath_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'filePath' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(filePath_param) == IS_STRING)) { zephir_get_strval(filePath, filePath_param); } else { ZEPHIR_INIT_VAR(filePath); ZVAL_EMPTY_STRING(filePath); } if (!mode) { ZEPHIR_CPY_WRT(mode, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(mode); } if (Z_TYPE_P(mode) == IS_NULL) { ZEPHIR_INIT_NVAR(mode); ZVAL_LONG(mode, 1); } ZEPHIR_CALL_FUNCTION(&iniConfig, "parse_ini_file", NULL, 136, filePath, ZEPHIR_GLOBAL(global_true), mode); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(iniConfig)) { ZEPHIR_INIT_VAR(_0$$4); object_init_ex(_0$$4, phalcon_config_exception_ce); ZEPHIR_INIT_VAR(_1$$4); zephir_basename(_1$$4, filePath TSRMLS_CC); ZEPHIR_INIT_VAR(_2$$4); ZEPHIR_CONCAT_SVS(_2$$4, "Configuration file ", _1$$4, " can't be loaded"); ZEPHIR_CALL_METHOD(NULL, _0$$4, "__construct", NULL, 9, _2$$4); zephir_check_call_status(); zephir_throw_exception_debug(_0$$4, "phalcon/config/adapter/ini.zep", 81 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(config); array_init(config); zephir_is_iterable(iniConfig, &_4, &_3, 0, 0, "phalcon/config/adapter/ini.zep", 102); for ( ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zephir_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HMKEY(section, _4, _3); ZEPHIR_GET_HVALUE(directives, _5); if (Z_TYPE_P(directives) == IS_ARRAY) { ZEPHIR_INIT_NVAR(sections); array_init(sections); zephir_is_iterable(directives, &_7$$6, &_6$$6, 0, 0, "phalcon/config/adapter/ini.zep", 94); for ( ; zephir_hash_get_current_data_ex(_7$$6, (void**) &_8$$6, &_6$$6) == SUCCESS ; zephir_hash_move_forward_ex(_7$$6, &_6$$6) ) { ZEPHIR_GET_HMKEY(path, _7$$6, _6$$6); ZEPHIR_GET_HVALUE(lastValue, _8$$6); zephir_get_strval(_10$$7, path); ZEPHIR_CALL_METHOD(&_9$$7, this_ptr, "_parseinistring", &_11, 0, _10$$7, lastValue); zephir_check_call_status(); zephir_array_append(§ions, _9$$7, PH_SEPARATE, "phalcon/config/adapter/ini.zep", 92); } if (zephir_fast_count_int(sections TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_12$$8); ZEPHIR_SINIT_NVAR(_13$$8); ZVAL_STRING(&_13$$8, "array_merge_recursive", 0); ZEPHIR_CALL_USER_FUNC_ARRAY(_12$$8, &_13$$8, sections); zephir_check_call_status(); zephir_array_update_zval(&config, section, &_12$$8, PH_COPY | PH_SEPARATE); } } else { ZEPHIR_CALL_METHOD(&_14$$9, this_ptr, "_cast", &_15, 137, directives); zephir_check_call_status(); zephir_array_update_zval(&config, section, &_14$$9, PH_COPY | PH_SEPARATE); } } ZEPHIR_CALL_PARENT(NULL, phalcon_config_adapter_ini_ce, this_ptr, "__construct", &_16, 19, config); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * We have to cast values manually because parse_ini_file() has a poor implementation. * * @param mixed ini The array casted by `parse_ini_file` */ PHP_METHOD(Phalcon_Config_Adapter_Ini, _cast) { zend_bool _5$$5, _6$$5, _8$$5, _9$$5; HashTable *_1$$3; HashPosition _0$$3; zephir_fcall_cache_entry *_4 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *ini, *key = NULL, *val = NULL, **_2$$3, *_3$$4 = NULL, *_7$$5, *_10$$5, *_11$$9, *_12$$9, _13$$9; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &ini); ZEPHIR_SEPARATE_PARAM(ini); if (Z_TYPE_P(ini) == IS_ARRAY) { zephir_is_iterable(ini, &_1$$3, &_0$$3, 1, 0, "phalcon/config/adapter/ini.zep", 148); for ( ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS ; zephir_hash_move_forward_ex(_1$$3, &_0$$3) ) { ZEPHIR_GET_HMKEY(key, _1$$3, _0$$3); ZEPHIR_GET_HVALUE(val, _2$$3); ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "_cast", &_4, 137, val); zephir_check_call_status(); zephir_array_update_zval(&ini, key, &_3$$4, PH_COPY | PH_SEPARATE); } zend_hash_destroy(_1$$3); FREE_HASHTABLE(_1$$3); } if (Z_TYPE_P(ini) == IS_STRING) { _5$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "true"); if (!(_5$$5)) { _5$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "yes"); } _6$$5 = _5$$5; if (!(_6$$5)) { ZEPHIR_INIT_VAR(_7$$5); zephir_fast_strtolower(_7$$5, ini); _6$$5 = ZEPHIR_IS_STRING_IDENTICAL(_7$$5, "on"); } if (_6$$5) { RETURN_MM_BOOL(1); } _8$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "false"); if (!(_8$$5)) { _8$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "no"); } _9$$5 = _8$$5; if (!(_9$$5)) { ZEPHIR_INIT_VAR(_10$$5); zephir_fast_strtolower(_10$$5, ini); _9$$5 = ZEPHIR_IS_STRING_IDENTICAL(_10$$5, "off"); } if (_9$$5) { RETURN_MM_BOOL(0); } if (ZEPHIR_IS_STRING_IDENTICAL(ini, "null")) { RETURN_MM_NULL(); } if (zephir_is_numeric(ini)) { ZEPHIR_INIT_VAR(_11$$9); ZEPHIR_INIT_VAR(_12$$9); ZEPHIR_SINIT_VAR(_13$$9); ZVAL_STRING(&_13$$9, "/[.]+/", 0); zephir_preg_match(_12$$9, &_13$$9, ini, _11$$9, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_12$$9)) { RETURN_MM_DOUBLE(zephir_get_doubleval(ini)); } else { RETURN_MM_LONG(zephir_get_intval(ini)); } } } RETVAL_ZVAL(ini, 1, 0); RETURN_MM(); }
/** * Handles routing information received from command-line arguments * * @param array arguments */ PHP_METHOD(Phalcon_Cli_Router, handle) { zval *_16 = NULL; zval *_6 = NULL, *_11 = NULL; zephir_nts_static zephir_fcall_cache_entry *_5 = NULL, *_19 = NULL; int ZEPHIR_LAST_CALL_STATUS; HashTable *_3, *_8; HashPosition _2, _7; zend_bool _0; zval *arguments = NULL, *moduleName = NULL, *taskName = NULL, *actionName = NULL, *params = NULL, *route = NULL, *parts = NULL, *pattern = NULL, *routeFound = NULL, *matches, *paths = NULL, *beforeMatch = NULL, *converters = NULL, *converter = NULL, *part = NULL, *position = NULL, *matchPosition = NULL, *strParams, *_1, **_4, **_9, *_10 = NULL, *_12, *_13, *_14, *_15, _17, *_18 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &arguments); if (!arguments) { arguments = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(routeFound); ZVAL_BOOL(routeFound, 0); ZEPHIR_INIT_VAR(parts); array_init(parts); ZEPHIR_INIT_VAR(params); array_init(params); ZEPHIR_INIT_VAR(matches); ZVAL_NULL(matches); zephir_update_property_this(this_ptr, SL("_wasMatched"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_matchedRoute"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); if (Z_TYPE_P(arguments) != IS_ARRAY) { _0 = Z_TYPE_P(arguments) != IS_STRING; if (_0) { _0 = Z_TYPE_P(arguments) != IS_NULL; } if (_0) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "Arguments must be an array or string", "phalcon/cli/router.zep", 223); return; } _1 = zephir_fetch_nproperty_this(this_ptr, SL("_routes"), PH_NOISY_CC); zephir_is_iterable(_1, &_3, &_2, 0, 1, "phalcon/cli/router.zep", 323); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_backwards_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(route, _4); ZEPHIR_CALL_METHOD(&pattern, route, "getcompiledpattern", NULL); zephir_check_call_status(); if (zephir_memnstr_str(pattern, SL("^"), "phalcon/cli/router.zep", 233)) { Z_SET_ISREF_P(matches); ZEPHIR_CALL_FUNCTION(&routeFound, "preg_match", &_5, pattern, arguments, matches); Z_UNSET_ISREF_P(matches); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(routeFound); ZVAL_BOOL(routeFound, ZEPHIR_IS_EQUAL(pattern, arguments)); } if (zephir_is_true(routeFound)) { ZEPHIR_CALL_METHOD(&beforeMatch, route, "getbeforematch", NULL); zephir_check_call_status(); if (Z_TYPE_P(beforeMatch) != IS_NULL) { if (!(zephir_is_callable(beforeMatch TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "Before-Match callback is not callable in matched route", "phalcon/cli/router.zep", 251); return; } ZEPHIR_INIT_NVAR(routeFound); ZEPHIR_INIT_NVAR(_6); zephir_create_array(_6, 3, 0 TSRMLS_CC); zephir_array_fast_append(_6, arguments); zephir_array_fast_append(_6, route); zephir_array_fast_append(_6, this_ptr); ZEPHIR_CALL_USER_FUNC_ARRAY(routeFound, beforeMatch, _6); zephir_check_call_status(); } } if (zephir_is_true(routeFound)) { ZEPHIR_CALL_METHOD(&paths, route, "getpaths", NULL); zephir_check_call_status(); ZEPHIR_CPY_WRT(parts, paths); if (Z_TYPE_P(matches) == IS_ARRAY) { ZEPHIR_CALL_METHOD(&converters, route, "getconverters", NULL); zephir_check_call_status(); zephir_is_iterable(paths, &_8, &_7, 0, 0, "phalcon/cli/router.zep", 312); for ( ; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS ; zephir_hash_move_forward_ex(_8, &_7) ) { ZEPHIR_GET_HMKEY(part, _8, _7); ZEPHIR_GET_HVALUE(position, _9); ZEPHIR_OBS_NVAR(matchPosition); if (zephir_array_isset_fetch(&matchPosition, matches, position, 0 TSRMLS_CC)) { if (Z_TYPE_P(converters) == IS_ARRAY) { ZEPHIR_OBS_NVAR(converter); if (zephir_array_isset_fetch(&converter, converters, part, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_10); ZEPHIR_INIT_NVAR(_6); zephir_create_array(_6, 1, 0 TSRMLS_CC); zephir_array_fast_append(_6, matchPosition); ZEPHIR_CALL_USER_FUNC_ARRAY(_10, converter, _6); zephir_check_call_status(); zephir_array_update_zval(&parts, part, &_10, PH_COPY | PH_SEPARATE); continue; } } zephir_array_update_zval(&parts, part, &matchPosition, PH_COPY | PH_SEPARATE); } else { if (Z_TYPE_P(converters) == IS_ARRAY) { ZEPHIR_OBS_NVAR(converter); if (zephir_array_isset_fetch(&converter, converters, part, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_10); ZEPHIR_INIT_NVAR(_11); zephir_create_array(_11, 1, 0 TSRMLS_CC); zephir_array_fast_append(_11, position); ZEPHIR_CALL_USER_FUNC_ARRAY(_10, converter, _11); zephir_check_call_status(); zephir_array_update_zval(&parts, part, &_10, PH_COPY | PH_SEPARATE); } } } } zephir_update_property_this(this_ptr, SL("_matches"), matches TSRMLS_CC); } zephir_update_property_this(this_ptr, SL("_matchedRoute"), route TSRMLS_CC); break; } } if (zephir_is_true(routeFound)) { zephir_update_property_this(this_ptr, SL("_wasMatched"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_wasMatched"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); _12 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultModule"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_module"), _12 TSRMLS_CC); _13 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultTask"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_task"), _13 TSRMLS_CC); _14 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAction"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_action"), _14 TSRMLS_CC); _15 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultParams"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_params"), _15 TSRMLS_CC); RETURN_THIS(); } } else { ZEPHIR_CPY_WRT(parts, arguments); } ZEPHIR_INIT_VAR(moduleName); ZVAL_NULL(moduleName); ZEPHIR_INIT_VAR(taskName); ZVAL_NULL(taskName); ZEPHIR_INIT_VAR(actionName); ZVAL_NULL(actionName); ZEPHIR_OBS_NVAR(moduleName); if (zephir_array_isset_string_fetch(&moduleName, parts, SS("module"), 0 TSRMLS_CC)) { zephir_array_unset_string(&parts, SS("module"), PH_SEPARATE); } else { ZEPHIR_OBS_NVAR(moduleName); zephir_read_property_this(&moduleName, this_ptr, SL("_defaultModule"), PH_NOISY_CC); } ZEPHIR_OBS_NVAR(taskName); if (zephir_array_isset_string_fetch(&taskName, parts, SS("task"), 0 TSRMLS_CC)) { zephir_array_unset_string(&parts, SS("task"), PH_SEPARATE); } else { ZEPHIR_OBS_NVAR(taskName); zephir_read_property_this(&taskName, this_ptr, SL("_defaultTask"), PH_NOISY_CC); } ZEPHIR_OBS_NVAR(actionName); if (zephir_array_isset_string_fetch(&actionName, parts, SS("action"), 0 TSRMLS_CC)) { zephir_array_unset_string(&parts, SS("action"), PH_SEPARATE); } else { ZEPHIR_OBS_NVAR(actionName); zephir_read_property_this(&actionName, this_ptr, SL("_defaultAction"), PH_NOISY_CC); } if (zephir_is_true(routeFound)) { ZEPHIR_OBS_NVAR(params); if (zephir_array_isset_string_fetch(¶ms, parts, SS("params"), 0 TSRMLS_CC)) { if (Z_TYPE_P(params) != IS_ARRAY) { zephir_get_strval(_16, params); ZEPHIR_SINIT_VAR(_17); ZVAL_LONG(&_17, 1); ZEPHIR_INIT_VAR(strParams); zephir_substr(strParams, _16, 1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); if (zephir_is_true(strParams)) { ZEPHIR_INIT_NVAR(params); ZEPHIR_CALL_CE_STATIC(&_18, phalcon_cli_router_route_ce, "getdelimiter", &_19); zephir_check_call_status(); zephir_fast_explode(params, _18, strParams, LONG_MAX TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(params); array_init(params); } } zephir_array_unset_string(&parts, SS("params"), PH_SEPARATE); } if (zephir_fast_count_int(params TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_10); zephir_fast_array_merge(_10, &(params), &(parts) TSRMLS_CC); ZEPHIR_CPY_WRT(params, _10); } else { ZEPHIR_CPY_WRT(params, parts); } } else { ZEPHIR_CPY_WRT(params, parts); } zephir_update_property_this(this_ptr, SL("_module"), moduleName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_task"), taskName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_action"), actionName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_params"), params TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Listens for notifications from the models manager */ PHP_METHOD(Phalcon_Mvc_Collection_Behavior_Timestampable, notify) { HashTable *_2$$12; HashPosition _1$$12; zephir_fcall_cache_entry *_4 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *type_param = NULL, *model, *options = NULL, *timestamp = NULL, *singleField = NULL, *field = NULL, *generator = NULL, *format = NULL, *_0 = NULL, **_3$$12; zval *type = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &type_param, &model); if (UNEXPECTED(Z_TYPE_P(type_param) != IS_STRING && Z_TYPE_P(type_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'type' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(type_param) == IS_STRING)) { zephir_get_strval(type, type_param); } else { ZEPHIR_INIT_VAR(type); ZVAL_EMPTY_STRING(type); } ZEPHIR_CALL_METHOD(&_0, this_ptr, "musttakeaction", NULL, 0, type); zephir_check_call_status(); if (!ZEPHIR_IS_TRUE_IDENTICAL(_0)) { RETURN_MM_NULL(); } ZEPHIR_CALL_METHOD(&options, this_ptr, "getoptions", NULL, 0, type); zephir_check_call_status(); if (Z_TYPE_P(options) == IS_ARRAY) { ZEPHIR_OBS_VAR(field); if (!(zephir_array_isset_string_fetch(&field, options, SS("field"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "The option 'field' is required", "phalcon/mvc/collection/behavior/timestampable.zep", 56); return; } ZEPHIR_INIT_VAR(timestamp); ZVAL_NULL(timestamp); ZEPHIR_OBS_VAR(format); if (zephir_array_isset_string_fetch(&format, options, SS("format"), 0 TSRMLS_CC)) { ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 316, format); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(generator); if (zephir_array_isset_string_fetch(&generator, options, SS("generator"), 0 TSRMLS_CC)) { if (Z_TYPE_P(generator) == IS_OBJECT) { if (zephir_instance_of_ev(generator, zend_ce_closure TSRMLS_CC)) { ZEPHIR_INIT_NVAR(timestamp); ZEPHIR_CALL_USER_FUNC(timestamp, generator); zephir_check_call_status(); } } } } if (Z_TYPE_P(timestamp) == IS_NULL) { ZEPHIR_INIT_NVAR(timestamp); zephir_time(timestamp); } if (Z_TYPE_P(field) == IS_ARRAY) { zephir_is_iterable(field, &_2$$12, &_1$$12, 0, 0, "phalcon/mvc/collection/behavior/timestampable.zep", 94); for ( ; zend_hash_get_current_data_ex(_2$$12, (void**) &_3$$12, &_1$$12) == SUCCESS ; zend_hash_move_forward_ex(_2$$12, &_1$$12) ) { ZEPHIR_GET_HVALUE(singleField, _3$$12); ZEPHIR_CALL_METHOD(NULL, model, "writeattribute", &_4, 0, singleField, timestamp); zephir_check_call_status(); } } else { ZEPHIR_CALL_METHOD(NULL, model, "writeattribute", NULL, 0, field, timestamp); zephir_check_call_status(); } } ZEPHIR_MM_RESTORE(); }
/** * Lists table indexes * * @param string table * @param string schema * @return Phalcon\Db\IndexInterface[] */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeIndexes) { zephir_fcall_cache_entry *_17 = NULL; HashTable *_5, *_11, *_15; HashPosition _4, _10, _14; int ZEPHIR_LAST_CALL_STATUS; zval *table, *schema = NULL, *indexes, *index = NULL, *keyName = NULL, *indexObjects, *name = NULL, *indexColumns = NULL, *columns = NULL, *describe_index = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7 = NULL, *_8, *_9 = NULL, **_12, *_13, **_16; 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, 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", 323); 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_long(&keyName, index, 1, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 309 TSRMLS_CC); if (!(zephir_array_isset(indexes, keyName))) { ZEPHIR_INIT_NVAR(columns); array_init(columns); } else { ZEPHIR_OBS_NVAR(columns); zephir_array_fetch(&columns, indexes, keyName, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 313 TSRMLS_CC); } _8 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_9, _8, "describeindex", NULL, 0, keyName); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_7, this_ptr, "fetchall", NULL, 0, _9, _3); zephir_check_call_status(); zephir_is_iterable(_7, &_11, &_10, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 320); for ( ; zephir_hash_get_current_data_ex(_11, (void**) &_12, &_10) == SUCCESS ; zephir_hash_move_forward_ex(_11, &_10) ) { ZEPHIR_GET_HVALUE(describe_index, _12); zephir_array_fetch_long(&_13, describe_index, 2, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 317 TSRMLS_CC); zephir_array_append(&columns, _13, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 317); } zephir_array_update_zval(&indexes, keyName, &columns, PH_COPY | PH_SEPARATE); } ZEPHIR_INIT_VAR(indexObjects); array_init(indexObjects); zephir_is_iterable(indexes, &_15, &_14, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 328); 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(indexColumns, _16); ZEPHIR_INIT_NVAR(_3); object_init_ex(_3, phalcon_db_index_ce); ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_17, 15, name, indexColumns); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, name, &_3, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(indexObjects); }
/** * 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) { HashTable *_2$$7, *_5$$8; HashPosition _1$$7, _4$$8; zephir_fcall_cache_entry *_9 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *renameColumns_param = NULL, *result = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords = NULL, *columnMap = NULL, *_0$$3, **_3$$7, **_6$$8, *_7$$10 = NULL, *_8$$10 = NULL, *_10$$12 = NULL, *_11$$12 = 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); } ZEPHIR_OBS_VAR(records); zephir_read_property_this(&records, this_ptr, SL("_rows"), PH_NOISY_CC); if (Z_TYPE_P(records) != IS_ARRAY) { ZEPHIR_OBS_VAR(result); zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC); if (Z_TYPE_P(_0$$3) != IS_NULL) { ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL, 0); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL, 0); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC); } 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, &_2$$7, &_1$$7, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 218); for ( ; zephir_hash_get_current_data_ex(_2$$7, (void**) &_3$$7, &_1$$7) == SUCCESS ; zephir_hash_move_forward_ex(_2$$7, &_1$$7) ) { ZEPHIR_GET_HVALUE(record, _3$$7); ZEPHIR_INIT_NVAR(renamed); array_init(renamed); zephir_is_iterable(record, &_5$$8, &_4$$8, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 216); for ( ; zephir_hash_get_current_data_ex(_5$$8, (void**) &_6$$8, &_4$$8) == SUCCESS ; zephir_hash_move_forward_ex(_5$$8, &_4$$8) ) { ZEPHIR_GET_HMKEY(key, _5$$8, _4$$8); ZEPHIR_GET_HVALUE(value, _6$$8); ZEPHIR_OBS_NVAR(renamedKey); if (!(zephir_array_isset_fetch(&renamedKey, columnMap, key, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_7$$10); object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_8$$10); ZEPHIR_CONCAT_SVS(_8$$10, "Column '", key, "' is not part of the column map"); ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_9, 9, _8$$10); zephir_check_call_status(); zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/resultset/simple.zep", 200 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(renamedKey) == IS_ARRAY) { ZEPHIR_OBS_NVAR(renamedKey); if (!(zephir_array_isset_long_fetch(&renamedKey, renamedKey, 0, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_10$$12); object_init_ex(_10$$12, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_11$$12); ZEPHIR_CONCAT_SVS(_11$$12, "Column '", key, "' is not part of the column map"); ZEPHIR_CALL_METHOD(NULL, _10$$12, "__construct", &_9, 9, _11$$12); zephir_check_call_status(); zephir_throw_exception_debug(_10$$12, "phalcon/mvc/model/resultset/simple.zep", 206 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", 216); } } RETURN_CCTOR(renamedRecords); } RETURN_CCTOR(records); }
/** * 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) { zephir_fcall_cache_entry *_16 = NULL, *_20 = NULL, *_21 = NULL; zend_bool _9; 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, *sizePattern, *matches = NULL, *matchOne = NULL, *matchTwo = NULL, *columnName, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7 = NULL, *_8 = NULL, *_10, *_11 = NULL, *_12, *_13, _14 = zval_used_for_init, *_15 = NULL, *_17, *_18, *_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(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(_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); 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(_7); ZVAL_LONG(_7, 14); 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_INIT_NVAR(_8); ZVAL_LONG(_8, 1); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } _9 = zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/sqlite.zep", 135); if (!(_9)) { _9 = zephir_memnstr_str(columnType, SL("INT"), "phalcon/db/adapter/pdo/sqlite.zep", 135); } if (_9) { 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_INIT_NVAR(_8); ZVAL_LONG(_8, 1); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); zephir_array_fetch_long(&_10, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 141 TSRMLS_CC); if (zephir_is_true(_10)) { 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(_7); ZVAL_LONG(_7, 2); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/sqlite.zep", 158)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("timestamp"), "phalcon/db/adapter/pdo/sqlite.zep", 166)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("decimal"), "phalcon/db/adapter/pdo/sqlite.zep", 174)) { 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_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/sqlite.zep", 184)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("datetime"), "phalcon/db/adapter/pdo/sqlite.zep", 192)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 4); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("text"), "phalcon/db/adapter/pdo/sqlite.zep", 200)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 6); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("float"), "phalcon/db/adapter/pdo/sqlite.zep", 208)) { 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_INIT_NVAR(_8); ZVAL_LONG(_8, 3); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("enum"), "phalcon/db/adapter/pdo/sqlite.zep", 218)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("type"), &_7, 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("("), "phalcon/db/adapter/pdo/sqlite.zep", 233)) { ZEPHIR_INIT_NVAR(matches); ZVAL_NULL(matches); ZEPHIR_INIT_NVAR(_8); zephir_preg_match(_8, sizePattern, columnType, matches, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_8)) { ZEPHIR_OBS_NVAR(matchOne); if (zephir_array_isset_long_fetch(&matchOne, matches, 1, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_11); ZVAL_LONG(_11, zephir_get_intval(matchOne)); zephir_array_update_string(&definition, SL("size"), &_11, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(matchTwo); if (zephir_array_isset_long_fetch(&matchTwo, matches, 2, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_11); ZVAL_LONG(_11, zephir_get_intval(matchTwo)); zephir_array_update_string(&definition, SL("scale"), &_11, 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(&_10, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 264 TSRMLS_CC); if (zephir_is_true(_10)) { zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_12, field, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 271 TSRMLS_CC); if (zephir_is_true(_12)) { zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_13, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 279 TSRMLS_CC); ZEPHIR_SINIT_NVAR(_14); ZVAL_STRING(&_14, "null", 0); ZEPHIR_CALL_FUNCTION(&_15, "strcasecmp", &_16, 19, _13, &_14); zephir_check_call_status(); _9 = !ZEPHIR_IS_LONG(_15, 0); if (_9) { zephir_array_fetch_long(&_17, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 279 TSRMLS_CC); _9 = !ZEPHIR_IS_STRING(_17, ""); } if (_9) { zephir_array_fetch_long(&_18, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 280 TSRMLS_CC); ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "/^'|'$/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_8); ZVAL_STRING(_8, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_19, "preg_replace", &_20, 29, _7, _8, _18); zephir_check_temp_parameter(_7); zephir_check_temp_parameter(_8); zephir_check_call_status(); zephir_array_update_string(&definition, SL("default"), &_19, 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(_7); object_init_ex(_7, phalcon_db_column_ce); ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_21, 140, columnName, definition); zephir_check_call_status(); zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 287); ZEPHIR_CPY_WRT(oldColumn, columnName); } RETURN_CCTOR(columns); }
/** * Returns current row in the resultset */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) { zephir_fcall_cache_entry *_13 = NULL, *_15 = NULL; zend_class_entry *_12; HashTable *_3, *_6; HashPosition _2, _5; int dirtyState, ZEPHIR_LAST_CALL_STATUS; zval *row, *hydrateMode, *eager, *alias = NULL, *activeRow = NULL, *type = NULL, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *modelName = NULL, *_0, *_1, **_4, **_7, *_8 = NULL, *_9 = NULL, *_10, *_11 = NULL, *_14, _16 = zval_used_for_init, _17 = zval_used_for_init; 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); } ZEPHIR_OBS_VAR(row); zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_disableHydration"), PH_NOISY_CC); if (zephir_is_true(_0)) { zephir_update_property_this(this_ptr, SL("_activeRow"), row TSRMLS_CC); RETURN_CCTOR(row); } if (Z_TYPE_P(row) != IS_ARRAY) { if (0) { zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_activeRow"), 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); do { if (ZEPHIR_IS_LONG(hydrateMode, 0)) { ZEPHIR_INIT_NVAR(activeRow); object_init_ex(activeRow, phalcon_mvc_model_row_ce); if (zephir_has_constructor(activeRow TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL, 0); zephir_check_call_status(); } break; } if (ZEPHIR_IS_LONG(hydrateMode, 1)) { ZEPHIR_INIT_NVAR(activeRow); array_init(activeRow); break; } ZEPHIR_INIT_NVAR(activeRow); object_init(activeRow); break; } while(0); dirtyState = 0; _1 = zephir_fetch_nproperty_this(this_ptr, SL("_columnTypes"), PH_NOISY_CC); zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 246); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HMKEY(alias, _3, _2); ZEPHIR_GET_HVALUE(column, _4); if (Z_TYPE_P(column) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 133); return; } ZEPHIR_OBS_NVAR(type); zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 136 TSRMLS_CC); if (ZEPHIR_IS_STRING(type, "object")) { ZEPHIR_OBS_NVAR(source); zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 142 TSRMLS_CC); ZEPHIR_OBS_NVAR(attributes); zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 143 TSRMLS_CC); ZEPHIR_OBS_NVAR(columnMap); zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 144 TSRMLS_CC); ZEPHIR_INIT_NVAR(rowModel); array_init(rowModel); zephir_is_iterable(attributes, &_6, &_5, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 162); for ( ; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS ; zephir_hash_move_forward_ex(_6, &_5) ) { ZEPHIR_GET_HVALUE(attribute, _7); ZEPHIR_OBS_NVAR(columnValue); ZEPHIR_INIT_LNVAR(_8); ZEPHIR_CONCAT_SVSV(_8, "_", source, "_", attribute); zephir_array_fetch(&columnValue, row, _8, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 155 TSRMLS_CC); zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE); } do { if (ZEPHIR_IS_LONG(hydrateMode, 0)) { ZEPHIR_OBS_NVAR(keepSnapshots); if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(keepSnapshots); ZVAL_BOOL(keepSnapshots, 0); } if (ZEPHIR_GLOBAL(orm).late_state_binding) { ZEPHIR_OBS_NVAR(_9); zephir_array_fetch_string(&_9, column, SL("instance"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 173 TSRMLS_CC); if (zephir_instance_of_ev(_9, phalcon_mvc_model_ce TSRMLS_CC)) { zephir_array_fetch_string(&_10, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 174 TSRMLS_CC); ZEPHIR_INIT_NVAR(modelName); zephir_get_class(modelName, _10, 0 TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(modelName); ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); } zephir_array_fetch_string(&_10, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC); ZEPHIR_INIT_NVAR(_11); ZVAL_LONG(_11, dirtyState); _12 = zephir_fetch_class(modelName TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&value, _12, "cloneresultmap", NULL, 0, _10, rowModel, columnMap, _11, keepSnapshots); zephir_check_call_status(); } else { zephir_array_fetch_string(&_14, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 188 TSRMLS_CC); ZEPHIR_INIT_NVAR(_11); ZVAL_LONG(_11, dirtyState); ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_13, 0, _14, rowModel, columnMap, _11, keepSnapshots); zephir_check_call_status(); } break; } ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_15, 0, rowModel, columnMap, hydrateMode); zephir_check_call_status(); break; } while(0); ZEPHIR_OBS_NVAR(attribute); zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 202 TSRMLS_CC); } else { ZEPHIR_OBS_NVAR(sqlAlias); if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) { ZEPHIR_OBS_NVAR(value); zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 210 TSRMLS_CC); } else { ZEPHIR_OBS_NVAR(value); zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC); } if (zephir_array_isset_string(column, SS("balias"))) { ZEPHIR_CPY_WRT(attribute, alias); } else { ZEPHIR_SINIT_NVAR(_16); ZVAL_STRING(&_16, "_", 0); ZEPHIR_SINIT_NVAR(_17); ZVAL_STRING(&_17, "", 0); ZEPHIR_INIT_NVAR(attribute); zephir_fast_str_replace(&attribute, &_16, &_17, alias TSRMLS_CC); } } if (!(zephir_array_isset_string_fetch(&eager, column, SS("eager"), 1 TSRMLS_CC))) { do { if (ZEPHIR_IS_LONG(hydrateMode, 1)) { zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE); break; } zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC); break; } while(0); } } zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); RETURN_CCTOR(activeRow); }
/** * Tries to render the view with every engine registered in the component * * @param string path * @param array params */ PHP_METHOD(Phalcon_Mvc_View_Simple, _internalRender) { zephir_fcall_cache_entry *_11 = NULL, *_12 = NULL; HashTable *_4; HashPosition _3; int ZEPHIR_LAST_CALL_STATUS; zend_bool notExists, mustClean, _7, _9; zval *path_param = NULL, *params, *eventsManager, *engines = NULL, *extension = NULL, *engine = NULL, *viewEnginePath = NULL, *viewsDirPath, *_0 = NULL, *_1 = NULL, *_2, **_5, *_6 = NULL, _8 = zval_used_for_init, *_10 = NULL; zval *path = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &path_param, ¶ms); if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(path_param) == IS_STRING)) { zephir_get_strval(path, path_param); } else { ZEPHIR_INIT_VAR(path); ZVAL_EMPTY_STRING(path); } ZEPHIR_OBS_VAR(eventsManager); zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_activeRenderPath"), path TSRMLS_CC); } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "view:beforeRender", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_0, eventsManager, "fire", NULL, 0, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_0)) { RETURN_MM_NULL(); } } notExists = 1; mustClean = 1; _2 = zephir_fetch_nproperty_this(this_ptr, SL("_viewsDir"), PH_NOISY_CC); ZEPHIR_INIT_VAR(viewsDirPath); ZEPHIR_CONCAT_VV(viewsDirPath, _2, path); ZEPHIR_CALL_METHOD(&engines, this_ptr, "_loadtemplateengines", NULL, 0); zephir_check_call_status(); zephir_is_iterable(engines, &_4, &_3, 0, 0, "phalcon/mvc/view/simple.zep", 261); for ( ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zephir_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HMKEY(extension, _4, _3); ZEPHIR_GET_HVALUE(engine, _5); ZEPHIR_INIT_LNVAR(_6); ZEPHIR_CONCAT_VV(_6, viewsDirPath, extension); if ((zephir_file_exists(_6 TSRMLS_CC) == SUCCESS)) { ZEPHIR_INIT_NVAR(viewEnginePath); ZEPHIR_CONCAT_VV(viewEnginePath, viewsDirPath, extension); } else { _7 = zephir_is_true(extension); if (_7) { ZEPHIR_SINIT_NVAR(_8); ZVAL_LONG(&_8, -zephir_fast_strlen_ev(extension)); ZEPHIR_INIT_NVAR(_1); zephir_substr(_1, viewsDirPath, zephir_get_intval(&_8), 0, ZEPHIR_SUBSTR_NO_LENGTH); _7 = ZEPHIR_IS_EQUAL(_1, extension); } _9 = _7; if (_9) { _9 = (zephir_file_exists(viewsDirPath TSRMLS_CC) == SUCCESS); } if (_9) { ZEPHIR_CPY_WRT(viewEnginePath, viewsDirPath); } else { ZEPHIR_INIT_NVAR(viewEnginePath); ZVAL_STRING(viewEnginePath, "", 1); } } if (zephir_is_true(viewEnginePath)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_10); ZVAL_STRING(_10, "view:beforeRenderView", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_0, eventsManager, "fire", &_11, 0, _10, this_ptr, viewEnginePath); zephir_check_temp_parameter(_10); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_0)) { continue; } } ZEPHIR_CALL_METHOD(NULL, engine, "render", NULL, 0, viewEnginePath, params, (mustClean ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false))); zephir_check_call_status(); notExists = 0; if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_10); ZVAL_STRING(_10, "view:afterRenderView", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_12, 0, _10, this_ptr); zephir_check_temp_parameter(_10); zephir_check_call_status(); } break; } } if (notExists == 1) { ZEPHIR_INIT_NVAR(_1); object_init_ex(_1, phalcon_mvc_view_exception_ce); ZEPHIR_INIT_LNVAR(_6); ZEPHIR_CONCAT_SVS(_6, "View '", viewsDirPath, "' was not found in the views directory"); ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 9, _6); zephir_check_call_status(); zephir_throw_exception_debug(_1, "phalcon/mvc/view/simple.zep", 262 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "view:afterRender", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); }
/** * Returns an array of Phalcon\Db\Column objects describing a table * * <code> * print_r($connection->describeColumns("posts")); * </code> */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns) { HashTable *_5; HashPosition _4; zephir_fcall_cache_entry *_41 = 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, *_11$$7 = NULL, *_12$$8 = NULL, *_13$$9 = NULL, *_14$$10 = NULL, *_15$$11 = NULL, *_16$$12 = NULL, *_17$$13 = NULL, *_18$$14 = NULL, *_19$$14 = NULL, *_20$$15 = NULL, *_21$$15 = NULL, *_22$$16 = NULL, *_23$$16 = NULL, *_24$$17 = NULL, *_25$$17 = NULL, *_26$$18 = NULL, *_27$$18 = NULL, *_28$$19 = NULL, *_29$$20 = NULL, *_30$$21 = NULL, *_31$$4 = NULL, *_32$$22 = NULL, *_33$$24 = NULL, *_34$$25 = NULL, *_35$$3, *_36$$3, *_37$$3, *_38$$3 = NULL, *_40$$3 = NULL, *_39$$32; 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/mysql.zep", 345); 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/mysql.zep", 119 TSRMLS_CC); while (1) { if (zephir_memnstr_str(columnType, SL("bigint"), "phalcon/db/adapter/pdo/mysql.zep", 126)) { ZEPHIR_INIT_NVAR(_7$$5); ZVAL_LONG(_7$$5, 14); zephir_array_update_string(&definition, SL("type"), &_7$$5, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8$$5); ZVAL_LONG(_8$$5, 1); zephir_array_update_string(&definition, SL("bindType"), &_8$$5, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/mysql.zep", 136)) { ZEPHIR_INIT_NVAR(_9$$6); ZVAL_LONG(_9$$6, 0); 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; } if (zephir_memnstr_str(columnType, SL("varchar"), "phalcon/db/adapter/pdo/mysql.zep", 146)) { ZEPHIR_INIT_NVAR(_11$$7); ZVAL_LONG(_11$$7, 2); zephir_array_update_string(&definition, SL("type"), &_11$$7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("datetime"), "phalcon/db/adapter/pdo/mysql.zep", 154)) { ZEPHIR_INIT_NVAR(_12$$8); ZVAL_LONG(_12$$8, 4); zephir_array_update_string(&definition, SL("type"), &_12$$8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("enum"), "phalcon/db/adapter/pdo/mysql.zep", 162)) { ZEPHIR_INIT_NVAR(_13$$9); ZVAL_LONG(_13$$9, 5); zephir_array_update_string(&definition, SL("type"), &_13$$9, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/mysql.zep", 170)) { ZEPHIR_INIT_NVAR(_14$$10); ZVAL_LONG(_14$$10, 5); zephir_array_update_string(&definition, SL("type"), &_14$$10, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/mysql.zep", 178)) { ZEPHIR_INIT_NVAR(_15$$11); ZVAL_LONG(_15$$11, 1); zephir_array_update_string(&definition, SL("type"), &_15$$11, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("timestamp"), "phalcon/db/adapter/pdo/mysql.zep", 186)) { ZEPHIR_INIT_NVAR(_16$$12); ZVAL_LONG(_16$$12, 17); zephir_array_update_string(&definition, SL("type"), &_16$$12, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("text"), "phalcon/db/adapter/pdo/mysql.zep", 194)) { ZEPHIR_INIT_NVAR(_17$$13); ZVAL_LONG(_17$$13, 6); zephir_array_update_string(&definition, SL("type"), &_17$$13, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("decimal"), "phalcon/db/adapter/pdo/mysql.zep", 202)) { ZEPHIR_INIT_NVAR(_18$$14); ZVAL_LONG(_18$$14, 3); zephir_array_update_string(&definition, SL("type"), &_18$$14, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_19$$14); ZVAL_LONG(_19$$14, 32); zephir_array_update_string(&definition, SL("bindType"), &_19$$14, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("double"), "phalcon/db/adapter/pdo/mysql.zep", 212)) { ZEPHIR_INIT_NVAR(_20$$15); ZVAL_LONG(_20$$15, 9); zephir_array_update_string(&definition, SL("type"), &_20$$15, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_21$$15); ZVAL_LONG(_21$$15, 32); zephir_array_update_string(&definition, SL("bindType"), &_21$$15, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("float"), "phalcon/db/adapter/pdo/mysql.zep", 222)) { ZEPHIR_INIT_NVAR(_22$$16); ZVAL_LONG(_22$$16, 7); zephir_array_update_string(&definition, SL("type"), &_22$$16, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_23$$16); ZVAL_LONG(_23$$16, 32); zephir_array_update_string(&definition, SL("bindType"), &_23$$16, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("bit"), "phalcon/db/adapter/pdo/mysql.zep", 232)) { ZEPHIR_INIT_NVAR(_24$$17); ZVAL_LONG(_24$$17, 8); zephir_array_update_string(&definition, SL("type"), &_24$$17, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_25$$17); ZVAL_LONG(_25$$17, 5); zephir_array_update_string(&definition, SL("bindType"), &_25$$17, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("tinyblob"), "phalcon/db/adapter/pdo/mysql.zep", 241)) { ZEPHIR_INIT_NVAR(_26$$18); ZVAL_LONG(_26$$18, 10); zephir_array_update_string(&definition, SL("type"), &_26$$18, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_27$$18); ZVAL_LONG(_27$$18, 5); zephir_array_update_string(&definition, SL("bindType"), &_27$$18, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("mediumblob"), "phalcon/db/adapter/pdo/mysql.zep", 250)) { ZEPHIR_INIT_NVAR(_28$$19); ZVAL_LONG(_28$$19, 12); zephir_array_update_string(&definition, SL("type"), &_28$$19, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("longblob"), "phalcon/db/adapter/pdo/mysql.zep", 258)) { ZEPHIR_INIT_NVAR(_29$$20); ZVAL_LONG(_29$$20, 13); zephir_array_update_string(&definition, SL("type"), &_29$$20, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("blob"), "phalcon/db/adapter/pdo/mysql.zep", 266)) { ZEPHIR_INIT_NVAR(_30$$21); ZVAL_LONG(_30$$21, 11); zephir_array_update_string(&definition, SL("type"), &_30$$21, PH_COPY | PH_SEPARATE); break; } ZEPHIR_INIT_NVAR(_31$$4); ZVAL_LONG(_31$$4, 2); zephir_array_update_string(&definition, SL("type"), &_31$$4, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("("), "phalcon/db/adapter/pdo/mysql.zep", 281)) { ZEPHIR_INIT_NVAR(matches); ZVAL_NULL(matches); ZEPHIR_INIT_NVAR(_32$$22); zephir_preg_match(_32$$22, sizePattern, columnType, matches, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_32$$22)) { ZEPHIR_OBS_NVAR(matchOne); if (zephir_array_isset_long_fetch(&matchOne, matches, 1, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_33$$24); ZVAL_LONG(_33$$24, zephir_get_intval(matchOne)); zephir_array_update_string(&definition, SL("size"), &_33$$24, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(matchTwo); if (zephir_array_isset_long_fetch(&matchTwo, matches, 2, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_34$$25); ZVAL_LONG(_34$$25, zephir_get_intval(matchTwo)); zephir_array_update_string(&definition, SL("scale"), &_34$$25, PH_COPY | PH_SEPARATE); } } } if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/mysql.zep", 296)) { 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(&_35$$3, field, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 312 TSRMLS_CC); if (ZEPHIR_IS_STRING(_35$$3, "PRI")) { zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_36$$3, field, 2, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 319 TSRMLS_CC); if (ZEPHIR_IS_STRING(_36$$3, "NO")) { zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_37$$3, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 326 TSRMLS_CC); if (ZEPHIR_IS_STRING(_37$$3, "auto_increment")) { zephir_array_update_string(&definition, SL("autoIncrement"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(_38$$3); zephir_array_fetch_long(&_38$$3, field, 4, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 333 TSRMLS_CC); if (Z_TYPE_P(_38$$3) != IS_NULL) { zephir_array_fetch_long(&_39$$32, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 334 TSRMLS_CC); zephir_array_update_string(&definition, SL("default"), &_39$$32, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&columnName, field, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 340 TSRMLS_CC); ZEPHIR_INIT_NVAR(_40$$3); object_init_ex(_40$$3, phalcon_db_column_ce); ZEPHIR_CALL_METHOD(NULL, _40$$3, "__construct", &_41, 137, columnName, definition); zephir_check_call_status(); zephir_array_append(&columns, _40$$3, PH_SEPARATE, "phalcon/db/adapter/pdo/mysql.zep", 341); ZEPHIR_CPY_WRT(oldColumn, columnName); } RETURN_CCTOR(columns); }
/** * Shows a backtrace item */ PHP_METHOD(Phalcon_Debug, showTraceItem) { zend_bool _40$$24; HashTable *_18$$14; HashPosition _17$$14; zval *_1, *_26$$16 = NULL; zephir_fcall_cache_entry *_21 = NULL, *_47 = NULL; zval *trace = NULL; zval *n_param = NULL, *trace_param = NULL, *className = NULL, *prepareInternalClass = NULL, *preparedFunctionName = NULL, *html = NULL, *classReflection = NULL, *prepareUriClass = NULL, *functionName = NULL, *functionReflection = NULL, *traceArgs = NULL, *arguments = NULL, *argument = NULL, *filez = NULL, *line = NULL, *showFiles = NULL, *lines = NULL, *numberLines = NULL, *showFileFragment = NULL, *beforeLine = NULL, *afterLine = NULL, *lastLine = NULL, *linePosition = NULL, *currentLine = NULL, *classNameWithLink = NULL, *functionNameWithLink = NULL, _0, *_16, *_2$$3, *_3$$3, _4$$3, *_11$$3, *_12$$3, _5$$4, _6$$4, *_7$$5 = NULL, *_8$$6, _9$$6, _10$$6, *_13$$10 = NULL, _14$$11, _15$$11, **_19$$14, *_23$$14, *_24$$14, *_20$$15 = NULL, *_22$$15 = NULL, *_25$$16, *_27$$16, _28$$18, _29$$18, *_30$$18, _31$$23, *_32$$23, *_33$$26 = NULL, *_34$$26 = NULL, *_35$$26 = NULL, _36$$26 = zval_used_for_init, *_37$$27 = NULL, _38$$27 = zval_used_for_init, _39$$27 = zval_used_for_init, *_41$$29 = NULL, _42$$29 = zval_used_for_init, _43$$29 = zval_used_for_init, _44$$29 = zval_used_for_init, _45$$29 = zval_used_for_init, *_46$$29 = NULL; int n, ZEPHIR_LAST_CALL_STATUS, firstLine = 0, i = 0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &n_param, &trace_param); n = zephir_get_intval(n_param); trace = trace_param; ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, n); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "<tr><td align=\"right\" valign=\"top\" class=\"error-number\">#", &_0, "</td><td>"); ZEPHIR_CPY_WRT(html, _1); ZEPHIR_OBS_VAR(className); if (zephir_array_isset_string_fetch(&className, trace, SS("class"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_2$$3); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "/^Phalcon/", 0); zephir_preg_match(_3$$3, &_4$$3, className, _2$$3, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_3$$3)) { ZEPHIR_SINIT_VAR(_5$$4); ZVAL_STRING(&_5$$4, "\\", 0); ZEPHIR_SINIT_VAR(_6$$4); ZVAL_STRING(&_6$$4, "/", 0); ZEPHIR_INIT_VAR(prepareUriClass); zephir_fast_str_replace(&prepareUriClass, &_5$$4, &_6$$4, className TSRMLS_CC); ZEPHIR_INIT_VAR(classNameWithLink); ZEPHIR_CONCAT_SVSVS(classNameWithLink, "<a target=\"_new\" href=\"//api.phalconphp.com/class/", prepareUriClass, ".html\">", className, "</a>"); } else { ZEPHIR_INIT_VAR(classReflection); object_init_ex(classReflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, classReflection, "__construct", NULL, 91, className); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7$$5, classReflection, "isinternal", NULL, 163); zephir_check_call_status(); if (zephir_is_true(_7$$5)) { ZEPHIR_INIT_VAR(_8$$6); zephir_fast_strtolower(_8$$6, className); ZEPHIR_SINIT_VAR(_9$$6); ZVAL_STRING(&_9$$6, "_", 0); ZEPHIR_SINIT_VAR(_10$$6); ZVAL_STRING(&_10$$6, "-", 0); ZEPHIR_INIT_VAR(prepareInternalClass); zephir_fast_str_replace(&prepareInternalClass, &_9$$6, &_10$$6, _8$$6 TSRMLS_CC); ZEPHIR_INIT_NVAR(classNameWithLink); ZEPHIR_CONCAT_SVSVS(classNameWithLink, "<a target=\"_new\" href=\"http://php.net/manual/en/class.", prepareInternalClass, ".php\">", className, "</a>"); } else { ZEPHIR_CPY_WRT(classNameWithLink, className); } } ZEPHIR_INIT_VAR(_11$$3); ZEPHIR_CONCAT_SVS(_11$$3, "<span class=\"error-class\">", classNameWithLink, "</span>"); zephir_concat_self(&html, _11$$3 TSRMLS_CC); zephir_array_fetch_string(&_12$$3, trace, SL("type"), PH_NOISY | PH_READONLY, "phalcon/debug.zep", 386 TSRMLS_CC); zephir_concat_self(&html, _12$$3 TSRMLS_CC); } ZEPHIR_OBS_VAR(functionName); zephir_array_fetch_string(&functionName, trace, SL("function"), PH_NOISY, "phalcon/debug.zep", 392 TSRMLS_CC); if (zephir_array_isset_string(trace, SS("class"))) { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } else { if ((zephir_function_exists(functionName TSRMLS_CC) == SUCCESS)) { ZEPHIR_INIT_VAR(functionReflection); object_init_ex(functionReflection, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, functionReflection, "__construct", NULL, 82, functionName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_13$$10, functionReflection, "isinternal", NULL, 164); zephir_check_call_status(); if (zephir_is_true(_13$$10)) { ZEPHIR_SINIT_VAR(_14$$11); ZVAL_STRING(&_14$$11, "_", 0); ZEPHIR_SINIT_VAR(_15$$11); ZVAL_STRING(&_15$$11, "-", 0); ZEPHIR_INIT_VAR(preparedFunctionName); zephir_fast_str_replace(&preparedFunctionName, &_14$$11, &_15$$11, functionName TSRMLS_CC); ZEPHIR_INIT_NVAR(functionNameWithLink); ZEPHIR_CONCAT_SVSVS(functionNameWithLink, "<a target=\"_new\" href=\"http://php.net/manual/en/function.", preparedFunctionName, ".php\">", functionName, "</a>"); } else { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } } else { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } } ZEPHIR_INIT_VAR(_16); ZEPHIR_CONCAT_SVS(_16, "<span class=\"error-function\">", functionNameWithLink, "</span>"); zephir_concat_self(&html, _16 TSRMLS_CC); ZEPHIR_OBS_VAR(traceArgs); if (zephir_array_isset_string_fetch(&traceArgs, trace, SS("args"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(arguments); array_init(arguments); zephir_is_iterable(traceArgs, &_18$$14, &_17$$14, 0, 0, "phalcon/debug.zep", 441); for ( ; zend_hash_get_current_data_ex(_18$$14, (void**) &_19$$14, &_17$$14) == SUCCESS ; zend_hash_move_forward_ex(_18$$14, &_17$$14) ) { ZEPHIR_GET_HVALUE(argument, _19$$14); ZEPHIR_CALL_METHOD(&_20$$15, this_ptr, "_getvardump", &_21, 0, argument); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_22$$15); ZEPHIR_CONCAT_SVS(_22$$15, "<span class=\"error-parameter\">", _20$$15, "</span>"); zephir_array_append(&arguments, _22$$15, PH_SEPARATE, "phalcon/debug.zep", 435); } ZEPHIR_INIT_VAR(_23$$14); zephir_fast_join_str(_23$$14, SL(", "), arguments TSRMLS_CC); ZEPHIR_INIT_VAR(_24$$14); ZEPHIR_CONCAT_SVS(_24$$14, "(", _23$$14, ")"); zephir_concat_self(&html, _24$$14 TSRMLS_CC); } ZEPHIR_OBS_VAR(filez); if (zephir_array_isset_string_fetch(&filez, trace, SS("file"), 0 TSRMLS_CC)) { ZEPHIR_OBS_VAR(_25$$16); zephir_array_fetch_string(&_25$$16, trace, SL("line"), PH_NOISY, "phalcon/debug.zep", 449 TSRMLS_CC); zephir_get_strval(_26$$16, _25$$16); ZEPHIR_CPY_WRT(line, _26$$16); ZEPHIR_INIT_VAR(_27$$16); ZEPHIR_CONCAT_SVSVS(_27$$16, "<br/><div class=\"error-file\">", filez, " (", line, ")</div>"); zephir_concat_self(&html, _27$$16 TSRMLS_CC); ZEPHIR_OBS_VAR(showFiles); zephir_read_property_this(&showFiles, this_ptr, SL("_showFiles"), PH_NOISY_CC); if (zephir_is_true(showFiles)) { ZEPHIR_CALL_FUNCTION(&lines, "file", NULL, 165, filez); zephir_check_call_status(); ZEPHIR_INIT_VAR(numberLines); ZVAL_LONG(numberLines, zephir_fast_count_int(lines TSRMLS_CC)); ZEPHIR_OBS_VAR(showFileFragment); zephir_read_property_this(&showFileFragment, this_ptr, SL("_showFileFragment"), PH_NOISY_CC); if (zephir_is_true(showFileFragment)) { ZEPHIR_INIT_VAR(beforeLine); ZVAL_LONG(beforeLine, (zephir_get_numberval(line) - 7)); if (ZEPHIR_LT_LONG(beforeLine, 1)) { firstLine = 1; } else { firstLine = zephir_get_numberval(beforeLine); } ZEPHIR_INIT_VAR(afterLine); ZVAL_LONG(afterLine, (zephir_get_numberval(line) + 5)); if (ZEPHIR_GT(afterLine, numberLines)) { ZEPHIR_CPY_WRT(lastLine, numberLines); } else { ZEPHIR_CPY_WRT(lastLine, afterLine); } ZEPHIR_SINIT_VAR(_28$$18); ZVAL_LONG(&_28$$18, firstLine); ZEPHIR_SINIT_VAR(_29$$18); ZVAL_LONG(&_29$$18, firstLine); ZEPHIR_INIT_VAR(_30$$18); ZEPHIR_CONCAT_SVSVSVS(_30$$18, "<pre class=\"prettyprint highlight:", &_28$$18, ":", line, " linenums:", &_29$$18, "\">"); zephir_concat_self(&html, _30$$18 TSRMLS_CC); } else { firstLine = 1; ZEPHIR_CPY_WRT(lastLine, numberLines); ZEPHIR_SINIT_VAR(_31$$23); ZVAL_LONG(&_31$$23, firstLine); ZEPHIR_INIT_VAR(_32$$23); ZEPHIR_CONCAT_SVSVS(_32$$23, "<pre class=\"prettyprint highlight:", &_31$$23, ":", line, " linenums error-scroll\">"); zephir_concat_self(&html, _32$$23 TSRMLS_CC); } i = firstLine; while (1) { if (!(ZEPHIR_GE_LONG(lastLine, i))) { break; } ZEPHIR_INIT_NVAR(linePosition); ZVAL_LONG(linePosition, (i - 1)); ZEPHIR_OBS_NVAR(currentLine); zephir_array_fetch(¤tLine, lines, linePosition, PH_NOISY, "phalcon/debug.zep", 522 TSRMLS_CC); if (zephir_is_true(showFileFragment)) { if (i == firstLine) { ZEPHIR_INIT_NVAR(_33$$26); ZEPHIR_INIT_NVAR(_34$$26); ZEPHIR_INIT_NVAR(_35$$26); zephir_fast_trim(_35$$26, currentLine, NULL , ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_SINIT_NVAR(_36$$26); ZVAL_STRING(&_36$$26, "#\\*\\/#", 0); zephir_preg_match(_34$$26, &_36$$26, _35$$26, _33$$26, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_34$$26)) { ZEPHIR_INIT_NVAR(_37$$27); ZEPHIR_SINIT_NVAR(_38$$27); ZVAL_STRING(&_38$$27, "* /", 0); ZEPHIR_SINIT_NVAR(_39$$27); ZVAL_STRING(&_39$$27, " ", 0); zephir_fast_str_replace(&_37$$27, &_38$$27, &_39$$27, currentLine TSRMLS_CC); ZEPHIR_CPY_WRT(currentLine, _37$$27); } } } _40$$24 = ZEPHIR_IS_STRING(currentLine, "\n"); if (!(_40$$24)) { _40$$24 = ZEPHIR_IS_STRING(currentLine, "\r\n"); } if (_40$$24) { zephir_concat_self_str(&html, SL(" \n") TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(_41$$29); ZEPHIR_SINIT_NVAR(_42$$29); ZVAL_STRING(&_42$$29, "\t", 0); ZEPHIR_SINIT_NVAR(_43$$29); ZVAL_STRING(&_43$$29, " ", 0); zephir_fast_str_replace(&_41$$29, &_42$$29, &_43$$29, currentLine TSRMLS_CC); ZEPHIR_SINIT_NVAR(_44$$29); ZVAL_LONG(&_44$$29, 2); ZEPHIR_SINIT_NVAR(_45$$29); ZVAL_STRING(&_45$$29, "UTF-8", 0); ZEPHIR_CALL_FUNCTION(&_46$$29, "htmlentities", &_47, 158, _41$$29, &_44$$29, &_45$$29); zephir_check_call_status(); zephir_concat_self(&html, _46$$29 TSRMLS_CC); } i++; } zephir_concat_self_str(&html, SL("</pre>") TSRMLS_CC); } } zephir_concat_self_str(&html, SL("</td></tr>") TSRMLS_CC); RETURN_CCTOR(html); }
/** * 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_Mysql, describeIndexes) { HashTable *_5, *_15; HashPosition _4, _14; zephir_fcall_cache_entry *_20 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema = NULL, *indexes = NULL, *index = NULL, *keyName = NULL, *indexObjects = NULL, *columns = NULL, *name = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3, **_6, **_16, *_7$$4 = NULL, *_8$$3, *_10$$3, *_11$$3, *_9$$6, *_12$$7 = NULL, *_13$$8 = NULL, *_17$$10 = NULL, *_18$$10, *_19$$10; zval *table = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema); if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(table_param) == IS_STRING)) { zephir_get_strval(table, table_param); } else { ZEPHIR_INIT_VAR(table); ZVAL_EMPTY_STRING(table); } 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/mysql.zep", 389); 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_array_fetch_string(&keyName, index, SL("Key_name"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 365 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/mysql.zep", 371 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/mysql.zep", 374 TSRMLS_CC); ZEPHIR_OBS_NVAR(columns); zephir_array_fetch_string(&columns, _9$$6, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 374 TSRMLS_CC); } zephir_array_fetch_string(&_10$$3, index, SL("Column_name"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 377 TSRMLS_CC); zephir_array_append(&columns, _10$$3, PH_SEPARATE, "phalcon/db/adapter/pdo/mysql.zep", 377); zephir_array_update_multi(&indexes, &columns TSRMLS_CC, SL("zs"), 3, keyName, SL("columns")); zephir_array_fetch_string(&_11$$3, index, SL("Non_unique"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 382 TSRMLS_CC); if (ZEPHIR_IS_STRING(keyName, "PRIMARY")) { ZEPHIR_INIT_NVAR(_12$$7); ZVAL_STRING(_12$$7, "PRIMARY", 1); zephir_array_update_multi(&indexes, &_12$$7 TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } else if (ZEPHIR_IS_LONG(_11$$3, 0)) { ZEPHIR_INIT_NVAR(_13$$8); ZVAL_STRING(_13$$8, "UNIQUE", 1); zephir_array_update_multi(&indexes, &_13$$8 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, &_15, &_14, 0, 0, "phalcon/db/adapter/pdo/mysql.zep", 394); 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(index, _16); ZEPHIR_INIT_NVAR(_17$$10); object_init_ex(_17$$10, phalcon_db_index_ce); zephir_array_fetch_string(&_18$$10, index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 391 TSRMLS_CC); zephir_array_fetch_string(&_19$$10, index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 391 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, _17$$10, "__construct", &_20, 15, name, _18$$10, _19$$10); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, name, &_17$$10, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(indexObjects); }
/** * Create/Returns a new transaction or an existing one */ PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getOrCreateTransaction) { HashTable *_2$$5; HashPosition _1$$5; int ZEPHIR_LAST_CALL_STATUS; zval *autoBegin_param = NULL, *dependencyInjector = NULL, *transaction = NULL, *transactions = NULL, *_0, *_5, *_6, **_3$$5, *_4$$7 = NULL; zend_bool autoBegin; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &autoBegin_param); if (!autoBegin_param) { autoBegin = 1; } else { autoBegin = zephir_get_boolval(autoBegin_param); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 188); return; } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); if (zephir_is_true(_0)) { ZEPHIR_OBS_VAR(transactions); zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); if (Z_TYPE_P(transactions) == IS_ARRAY) { zephir_is_iterable(transactions, &_2$$5, &_1$$5, 0, 1, "phalcon/mvc/model/transaction/manager.zep", 200); for ( ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS ; zephir_hash_move_backwards_ex(_2$$5, &_1$$5) ) { ZEPHIR_GET_HVALUE(transaction, _3$$5); if (Z_TYPE_P(transaction) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_4$$7); ZVAL_BOOL(_4$$7, 0); ZEPHIR_CALL_METHOD(NULL, transaction, "setisnewtransaction", NULL, 0, _4$$7); zephir_check_call_status(); RETURN_CCTOR(transaction); } } } } ZEPHIR_INIT_NVAR(transaction); object_init_ex(transaction, phalcon_mvc_model_transaction_ce); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_service"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_6); if (autoBegin) { ZVAL_BOOL(_6, 1); } else { ZVAL_BOOL(_6, 0); } ZEPHIR_CALL_METHOD(NULL, transaction, "__construct", NULL, 354, dependencyInjector, _6, _5); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, transaction, "settransactionmanager", NULL, 355, this_ptr); zephir_check_call_status(); zephir_update_property_array_append(this_ptr, SL("_transactions"), transaction TSRMLS_CC); RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_number") TSRMLS_CC)); RETURN_CCTOR(transaction); }
/** * Sanitizes a value with a specified single or set of filters */ PHP_METHOD(Phalcon_Filter, sanitize) { zephir_fcall_cache_entry *_8 = NULL; int ZEPHIR_LAST_CALL_STATUS; HashTable *_1, *_5, *_10; HashPosition _0, _4, _9; zend_bool noRecursive, _3; zval *value = NULL, *filters, *noRecursive_param = NULL, *filter = NULL, *arrayValue = NULL, *itemKey = NULL, *itemValue = NULL, *sanitizedValue, **_2, **_6, *_7 = NULL, **_11; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &value, &filters, &noRecursive_param); ZEPHIR_SEPARATE_PARAM(value); if (!noRecursive_param) { noRecursive = 0; } else { noRecursive = zephir_get_boolval(noRecursive_param); } if (Z_TYPE_P(filters) == IS_ARRAY) { if (Z_TYPE_P(value) != IS_NULL) { zephir_is_iterable(filters, &_1, &_0, 0, 0, "phalcon/filter.zep", 107); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HVALUE(filter, _2); _3 = Z_TYPE_P(value) == IS_ARRAY; if (_3) { _3 = !noRecursive; } if (_3) { ZEPHIR_INIT_NVAR(arrayValue); array_init(arrayValue); zephir_is_iterable(value, &_5, &_4, 0, 0, "phalcon/filter.zep", 102); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HMKEY(itemKey, _5, _4); ZEPHIR_GET_HVALUE(itemValue, _6); ZEPHIR_CALL_METHOD(&_7, this_ptr, "_sanitize", &_8, itemValue, filter); zephir_check_call_status(); zephir_array_update_zval(&arrayValue, itemKey, &_7, PH_COPY | PH_SEPARATE); } ZEPHIR_CPY_WRT(value, arrayValue); } else { ZEPHIR_CALL_METHOD(&_7, this_ptr, "_sanitize", &_8, value, filter); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, _7); } } } RETVAL_ZVAL(value, 1, 0); RETURN_MM(); } _3 = Z_TYPE_P(value) == IS_ARRAY; if (_3) { _3 = !noRecursive; } if (_3) { ZEPHIR_INIT_VAR(sanitizedValue); array_init(sanitizedValue); zephir_is_iterable(value, &_10, &_9, 0, 0, "phalcon/filter.zep", 119); for ( ; zephir_hash_get_current_data_ex(_10, (void**) &_11, &_9) == SUCCESS ; zephir_hash_move_forward_ex(_10, &_9) ) { ZEPHIR_GET_HMKEY(itemKey, _10, _9); ZEPHIR_GET_HVALUE(itemValue, _11); ZEPHIR_CALL_METHOD(&_7, this_ptr, "_sanitize", &_8, itemValue, filters); zephir_check_call_status(); zephir_array_update_zval(&sanitizedValue, itemKey, &_7, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(sanitizedValue); } ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_sanitize", &_8, value, filters); zephir_check_call_status(); RETURN_MM(); }
/** * Resolves an annotation expression * * @param array expr * @return mixed */ PHP_METHOD(Phalcon_Annotations_Annotation, getExpression) { zephir_nts_static zephir_fcall_cache_entry *_5 = NULL, *_6 = NULL, *_9 = NULL; int ZEPHIR_LAST_CALL_STATUS; HashTable *_2; HashPosition _1; zval *expr_param = NULL, *value = NULL, *item = NULL, *resolvedItem = NULL, *arrayValue, *name = NULL, *type, *_0, **_3, *_4, *_7, *_8; zval *expr = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &expr_param); expr = expr_param; ZEPHIR_OBS_VAR(type); zephir_array_fetch_string(&type, expr, SL("type"), PH_NOISY, "phalcon/annotations/annotation.zep", 100 TSRMLS_CC); do { if (ZEPHIR_IS_LONG(type, 301) || ZEPHIR_IS_LONG(type, 302) || ZEPHIR_IS_LONG(type, 303) || ZEPHIR_IS_LONG(type, 307)) { ZEPHIR_OBS_VAR(value); zephir_array_fetch_string(&value, expr, SL("value"), PH_NOISY, "phalcon/annotations/annotation.zep", 107 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(type, 304)) { ZEPHIR_INIT_NVAR(value); ZVAL_NULL(value); break; } if (ZEPHIR_IS_LONG(type, 305)) { ZEPHIR_INIT_NVAR(value); ZVAL_BOOL(value, 0); break; } if (ZEPHIR_IS_LONG(type, 306)) { ZEPHIR_INIT_NVAR(value); ZVAL_BOOL(value, 1); break; } if (ZEPHIR_IS_LONG(type, 308)) { ZEPHIR_INIT_VAR(arrayValue); array_init(arrayValue); zephir_array_fetch_string(&_0, expr, SL("items"), PH_NOISY | PH_READONLY, "phalcon/annotations/annotation.zep", 124 TSRMLS_CC); zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/annotations/annotation.zep", 132); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(item, _3); zephir_array_fetch_string(&_4, item, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/annotations/annotation.zep", 125 TSRMLS_CC); ZEPHIR_CALL_METHOD(&resolvedItem, this_ptr, "getexpression", &_5, _4); zephir_check_call_status(); ZEPHIR_OBS_NVAR(name); if (zephir_array_isset_string_fetch(&name, item, SS("name"), 0 TSRMLS_CC)) { zephir_array_update_zval(&arrayValue, name, &resolvedItem, PH_COPY | PH_SEPARATE); } else { zephir_array_append(&arrayValue, resolvedItem, PH_SEPARATE, "phalcon/annotations/annotation.zep", 129); } } RETURN_CCTOR(arrayValue); } if (ZEPHIR_IS_LONG(type, 300)) { object_init_ex(return_value, phalcon_annotations_annotation_ce); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_6, expr); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_INIT_VAR(_7); object_init_ex(_7, phalcon_annotations_exception_ce); ZEPHIR_INIT_VAR(_8); ZEPHIR_CONCAT_SVS(_8, "The expression ", type, " is unknown"); ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_9, _8); zephir_check_call_status(); zephir_throw_exception_debug(_7, "phalcon/annotations/annotation.zep", 138 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } while(0); RETURN_CCTOR(value); }
/** * Applies a format to a message before sending it to the log * * @param string $message * @param int $type * @param int $timestamp * @param array $context * * @return string */ PHP_METHOD(Phalcon_Logger_Formatter_Firephp, format) { zval *_18; HashTable *_7; HashPosition _6; zend_bool param, _11, _14; int type, timestamp, ZEPHIR_LAST_CALL_STATUS; zval *message_param = NULL, *type_param = NULL, *timestamp_param = NULL, *context = NULL, *meta, *body = NULL, *backtrace = NULL, *encoded, *len, *lastTrace = NULL, *_0 = NULL, *_1 = NULL, *_2, *backtraceItem = NULL, *key = NULL, _3, _4, *_5, **_8, *_9, *_10, *_12, *_13, *_15, *_16, *_17; zval *message = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &message_param, &type_param, ×tamp_param, &context); zephir_get_strval(message, message_param); type = zephir_get_intval(type_param); timestamp = zephir_get_intval(timestamp_param); if (!context) { context = ZEPHIR_GLOBAL(global_null); } if (Z_TYPE_P(context) == IS_ARRAY) { ZEPHIR_CALL_METHOD(&_0, this_ptr, "interpolate", NULL, 0, message, context); zephir_check_call_status(); zephir_get_strval(message, _0); } ZEPHIR_INIT_VAR(meta); zephir_create_array(meta, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, type); ZEPHIR_CALL_METHOD(&_0, this_ptr, "gettypestring", NULL, 0, _1); zephir_check_call_status(); zephir_array_update_string(&meta, SL("Type"), &_0, PH_COPY | PH_SEPARATE); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); if (zephir_is_true(_2)) { param = 0; ZEPHIR_INIT_NVAR(_1); ZEPHIR_GET_CONSTANT(_1, "PHP_VERSION"); ZEPHIR_SINIT_VAR(_3); ZVAL_STRING(&_3, "5.3.6", 0); ZEPHIR_SINIT_VAR(_4); ZVAL_STRING(&_4, "<", 0); ZEPHIR_CALL_FUNCTION(&_0, "version_compare", NULL, 240, _1, &_3, &_4); zephir_check_call_status(); if (!(zephir_is_true(_0))) { param = (2) ? 1 : 0; } ZEPHIR_CALL_FUNCTION(&backtrace, "debug_backtrace", NULL, 151, (param ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false))); zephir_check_call_status(); Z_SET_ISREF_P(backtrace); ZEPHIR_CALL_FUNCTION(&lastTrace, "end", NULL, 171, backtrace); Z_UNSET_ISREF_P(backtrace); zephir_check_call_status(); if (zephir_array_isset_string(lastTrace, SS("file"))) { zephir_array_fetch_string(&_5, lastTrace, SL("file"), PH_NOISY | PH_READONLY, "phalcon/logger/formatter/firephp.zep", 133 TSRMLS_CC); zephir_array_update_string(&meta, SL("File"), &_5, PH_COPY | PH_SEPARATE); } if (zephir_array_isset_string(lastTrace, SS("line"))) { zephir_array_fetch_string(&_5, lastTrace, SL("line"), PH_NOISY | PH_READONLY, "phalcon/logger/formatter/firephp.zep", 137 TSRMLS_CC); zephir_array_update_string(&meta, SL("Line"), &_5, PH_COPY | PH_SEPARATE); } zephir_is_iterable(backtrace, &_7, &_6, 1, 0, "phalcon/logger/formatter/firephp.zep", 146); for ( ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS ; zephir_hash_move_forward_ex(_7, &_6) ) { ZEPHIR_GET_HMKEY(key, _7, _6); ZEPHIR_GET_HVALUE(backtraceItem, _8); zephir_array_unset_string(&backtraceItem, SS("object"), PH_SEPARATE); zephir_array_unset_string(&backtraceItem, SS("args"), PH_SEPARATE); zephir_array_update_zval(&backtrace, key, &backtraceItem, PH_COPY | PH_SEPARATE); } } _9 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); if (zephir_is_true(_9)) { zephir_array_update_string(&meta, SL("Label"), &message, PH_COPY | PH_SEPARATE); } _10 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); _11 = !zephir_is_true(_10); if (_11) { _12 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); _11 = !zephir_is_true(_12); } _13 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); _14 = zephir_is_true(_13); if (_14) { _15 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); _14 = !zephir_is_true(_15); } if (_11) { ZEPHIR_CPY_WRT(body, message); } else if (_14) { ZEPHIR_INIT_NVAR(body); ZVAL_STRING(body, "", 1); } else { ZEPHIR_INIT_NVAR(body); array_init(body); _16 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); if (zephir_is_true(_16)) { zephir_array_update_string(&body, SL("backtrace"), &backtrace, PH_COPY | PH_SEPARATE); } _17 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); if (!(zephir_is_true(_17))) { zephir_array_update_string(&body, SL("message"), &message, PH_COPY | PH_SEPARATE); } } ZEPHIR_INIT_VAR(_18); zephir_create_array(_18, 2, 0 TSRMLS_CC); zephir_array_fast_append(_18, meta); zephir_array_fast_append(_18, body); ZEPHIR_INIT_VAR(encoded); zephir_json_encode(encoded, &(encoded), _18, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(len); ZVAL_LONG(len, zephir_fast_strlen_ev(encoded)); ZEPHIR_CONCAT_VSVS(return_value, len, "|", encoded, "|"); RETURN_MM(); }
/** * Produce the routing parameters from the rewrite information */ PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { zephir_fcall_cache_entry *_9 = NULL, *_17 = NULL, *_18 = NULL; HashTable *_2, *_7, *_11, *_15; HashPosition _1, _6, _10, _14; int ZEPHIR_LAST_CALL_STATUS; zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers, *controllerSuffix, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *lowercased = NULL, *method = NULL, *collection = NULL, *_0, **_3, *_4, *_5 = NULL, **_8, **_12, *_13 = NULL, **_16; zval *uri = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &uri_param); if (!uri_param) { ZEPHIR_INIT_VAR(uri); ZVAL_EMPTY_STRING(uri); } else { if (unlikely(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(uri_param) == IS_STRING)) { zephir_get_strval(uri, uri_param); } else { ZEPHIR_INIT_VAR(uri); ZVAL_EMPTY_STRING(uri); } } if (!(!(!uri) && Z_STRLEN_P(uri))) { ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(realUri, uri); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_processed"), PH_NOISY_CC); if (!(zephir_is_true(_0))) { ZEPHIR_INIT_VAR(annotationsService); ZVAL_NULL(annotationsService); ZEPHIR_OBS_VAR(handlers); zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC); if (Z_TYPE_P(handlers) == IS_ARRAY) { ZEPHIR_OBS_VAR(controllerSuffix); zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC); zephir_is_iterable(handlers, &_2, &_1, 0, 0, "phalcon/mvc/router/annotations.zep", 208); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(scope, _3); if (Z_TYPE_P(scope) == IS_ARRAY) { ZEPHIR_OBS_NVAR(prefix); zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 117 TSRMLS_CC); if (!(ZEPHIR_IS_EMPTY(prefix))) { if (!(zephir_start_with(realUri, prefix, NULL))) { continue; } } if (Z_TYPE_P(annotationsService) != IS_OBJECT) { _4 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _4); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 129); return; } ZEPHIR_INIT_NVAR(_5); ZVAL_STRING(_5, "annotations", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _5); zephir_check_temp_parameter(_5); zephir_check_call_status(); } ZEPHIR_OBS_NVAR(handler); zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 138 TSRMLS_CC); if (zephir_memnstr_str(handler, SL("\\"), "phalcon/mvc/router/annotations.zep", 140)) { ZEPHIR_INIT_NVAR(controllerName); zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(lowerControllerName); zephir_uncamelize(lowerControllerName, controllerName); ZEPHIR_INIT_NVAR(namespaceName); zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC); } else { ZEPHIR_CPY_WRT(controllerName, handler); ZEPHIR_INIT_NVAR(lowerControllerName); zephir_uncamelize(lowerControllerName, controllerName); ZEPHIR_INIT_NVAR(namespaceName); ZVAL_NULL(namespaceName); } zephir_update_property_this(this_ptr, SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); ZEPHIR_OBS_NVAR(moduleName); zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(sufixed); ZEPHIR_CONCAT_VV(sufixed, handler, controllerSuffix); ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", NULL, 0, sufixed); zephir_check_call_status(); if (Z_TYPE_P(handlerAnnotations) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(classAnnotations) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&annotations, classAnnotations, "getannotations", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(annotations) == IS_ARRAY) { zephir_is_iterable(annotations, &_7, &_6, 0, 0, "phalcon/mvc/router/annotations.zep", 187); for ( ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS ; zephir_hash_move_forward_ex(_7, &_6) ) { ZEPHIR_GET_HVALUE(annotation, _8); ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_9, 0, controllerName, annotation); zephir_check_call_status(); } } } ZEPHIR_CALL_METHOD(&methodAnnotations, handlerAnnotations, "getmethodsannotations", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) { ZEPHIR_INIT_NVAR(lowercased); zephir_uncamelize(lowercased, handler); zephir_is_iterable(methodAnnotations, &_11, &_10, 0, 0, "phalcon/mvc/router/annotations.zep", 203); for ( ; zephir_hash_get_current_data_ex(_11, (void**) &_12, &_10) == SUCCESS ; zephir_hash_move_forward_ex(_11, &_10) ) { ZEPHIR_GET_HMKEY(method, _11, _10); ZEPHIR_GET_HVALUE(collection, _12); if (Z_TYPE_P(collection) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&_13, collection, "getannotations", NULL, 0); zephir_check_call_status(); zephir_is_iterable(_13, &_15, &_14, 0, 0, "phalcon/mvc/router/annotations.zep", 201); for ( ; zephir_hash_get_current_data_ex(_15, (void**) &_16, &_14) == SUCCESS ; zephir_hash_move_forward_ex(_15, &_14) ) { ZEPHIR_GET_HVALUE(annotation, _16); ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_17, 0, moduleName, namespaceName, lowerControllerName, method, annotation); zephir_check_call_status(); } } } } } } } } if (1) { zephir_update_property_this(this_ptr, SL("_processed"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_processed"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } } ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_router_annotations_ce, this_ptr, "handle", &_18, 361, realUri); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Connect: Establish connection to a database * @param string hostname Hostname[:port] overriding datasource specs [optional] * @param string username Username overriding datasource specs [optional] * @param string passname Password overriding datasource specs [optional] * @param string database Database name overriding datasource specsString [optional] * @return boolean */ PHP_METHOD(ADOdb_Connection, connect) { zend_function *_6 = NULL; HashTable *_4; HashPosition _3; zval *hostname_param = NULL, *username_param = NULL, *password_param = NULL, *database_param = NULL, *options = NULL, *_0, *_1, *_2, *option = NULL, *value = NULL, **_5; zval *hostname = NULL, *username = NULL, *password = NULL, *database = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 5, &hostname_param, &username_param, &password_param, &database_param, &options); if (!hostname_param) { ZEPHIR_INIT_VAR(hostname); ZVAL_EMPTY_STRING(hostname); } else { zephir_get_strval(hostname, hostname_param); } if (!username_param) { ZEPHIR_INIT_VAR(username); ZVAL_EMPTY_STRING(username); } else { zephir_get_strval(username, username_param); } if (!password_param) { ZEPHIR_INIT_VAR(password); ZVAL_EMPTY_STRING(password); } else { zephir_get_strval(password, password_param); } if (!database_param) { ZEPHIR_INIT_VAR(database); ZVAL_EMPTY_STRING(database); } else { zephir_get_strval(database, database_param); } if (!options) { ZEPHIR_INIT_VAR(options); array_init(options); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("connection"), PH_NOISY_CC); if (zephir_is_true(_0)) { RETURN_MM_BOOL(0); } if (hostname && Z_STRLEN_P(hostname)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_1, "sethostname", hostname); } if (username && Z_STRLEN_P(username)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_1, "setusername", username); } if (password && Z_STRLEN_P(password)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_1, "setpassword", password); } if (database && Z_STRLEN_P(database)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_1, "setdatabase", database); } ZEPHIR_INIT_VAR(_2); _1 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_static_p1(_2, "ADOdb\\Driver\\DriverManager", "create", _1); zephir_update_property_this(this_ptr, SL("connection"), _2 TSRMLS_CC); zephir_is_iterable(options, &_4, &_3, 0, 0); for ( ; zend_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zephir_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HMKEY(option, _4, _3); ZEPHIR_GET_HVALUE(value, _5); zephir_call_method_p2_cache_noret(this_ptr, "setattribute", &_6, option, value); } RETURN_MM_BOOL(1); }